I am trying to do foreground extraction(Grab cut algorithm) in open CV using python. I am using the code from the link . The code runs but everytime I am moving the mouse it is drawing a rectangle.
Problem: I cannot draw the touching strokes even after pressing the 0,1,2,3 keys as mentioned. Can someone please suggest how to come out of the rectangle mode and fix the rectangle after i release the mouse button.
I am new to open CV,any help would be appreciated
The code is structured very clearly. You might start by adding print statements in the onmouse
method, in each of the
if event == ...
blocks, to figure out which events are correctly registered and which don't come through.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.