arccoder / opencvdragrect Goto Github PK
View Code? Open in Web Editor NEWDrag a rectangle on an image window using opencv
Home Page: https://arccoder.github.io/opencvdragrect/
Drag a rectangle on an image window using opencv
Home Page: https://arccoder.github.io/opencvdragrect/
Is possible to make the rectangle rotated !
If possible can you help me.
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
TypeError: an integer is required (got type tuple)
Traceback (most recent call last):
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 124, in dragrect
mouseMove(x, y, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 235, in mouseMove
clearCanvasNDraw(dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 356, in clearCanvasNDraw
drawSelectMarkers(tmp, dragObj)
File "/home/anarchaos/Downloads/opencvdragrect/selectinwindow.py", line 394, in drawSelectMarkers
(0, 255, 0), 2)
I'm unable to draw multiple rectangles in the same image. Can anyone help me with this?
What version of OpenCV is this written in?
Run script.py which seems to run selectwindow.py properly at first. White image pops up and allows selection of a rectangle, changing sizes, moving etc. as shown in the demo. Double clicking inside the rectangle then closes the window but the program seems to stay stuck in selectwindow.py and does not return to script.py.
Trouble shooting with print statements I see that the program seems to go all the way through dragrect in selectwindow.py. Even if I put a return statement after the double click it only stops executing within dragrect, but does not seem to break out of selectwindow.py.
if event == cv2.EVENT_LBUTTONDBLCLK:
mouseDoubleClick(x, y, dragObj)
print('double click')
return
print('past return')
This prints "double click" but not "past return". The program however never goes back to script.py.
I am running python 3.7 and using Spyder 3.
I am probably missing something simple, but not seeing what it is. Thanks for the help.
Hi, I'm getting a segmentation fault with the default script.py
file, and I can't seem to fix it. Can anyone help? I just drag a rectangle and double click in it (which I assume is how you confirm your selection). Here's a traceback:
Fatal Python error: Segmentation fault
Current thread 0x00007f50564d9740 (most recent call first):
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 267 in mouseUp
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 109 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 267 in mouseUp
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 109 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 196 in mouseMove
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 111 in dragrect
File "/home/tabulate/random-junk/python/face_timelapse/opencvdragrect/selectinwindow.py", line 297 in clearCanvasNDraw
...
fish: Job 1, 'python script.py' terminated by signal SIGSEGV (Address boundary error)
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
If the mouse is moved fast while dragging a rect, the app crashes (on Windows, Python 3.9). The GUI seems to be overloaded. This can be fixed as follows.
In the beginning of selectwindows add
from timeit import default_timer as timer
lastt=timer()
In the beginning of def dragrect(event, x, y, flags, dragObj):
global lastt
ctime=timer()
gap=ctime-lastt
if gap < 0.1 and event == cv2.EVENT_MOUSEMOVE: return
lastt = ctime
You can change the 0.1 to sth larger or a bit smaller.
I get the problem of ‘Segmentation fault (core dumped)’ when I debug the code after
_if pointInRect(eX, eY, dragObj.outRect.x, dragObj.outRect.y, dragObj.outRect.w, dragObj.outRect.h):
dragObj.returnflag = True
cv2.destroyWindow(dragObj.wname)_
I use the same opencv and numpy version as you. How to solve the problem? Thanks :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.