arccoder / opencvdragrect

Drag a rectangle on an image window using opencv
https://arccoder.github.io/opencvdragrect/
40 stars 21 forks source link

Late finding #13

Open oldAlNow opened 6 months ago

oldAlNow commented 6 months ago

It seems the waitkey() in clearCanvasNDraw() of the selectinwindow.py causes the recursive stack.

My temporary solution is to comment it out:

selectinwindow.py:

def clearCanvasNDraw(dragObj):
    # Draw
    # ...
    drawSelectMarkers(tmp, dragObj)
    cv2.imshow(dragObj.wname, tmp)
    #  cv2.waitKey()                # <-- comment out

script.py:

cv2.imshow(wName, rectI.image)     # draw image once

while True:
    # display the image
    #  cv2.imshow(wName, rectI.image)   <-- move to outside of the loop
    key = cv2.waitKey(1) & 0xFF
    # if returnflag is True or 'q' is hit, break from the loop
    if rectI.returnflag or key == ord('q'):
        break