webcam-pulse-detector icon indicating copy to clipboard operation
webcam-pulse-detector copied to clipboard

Plotting error: assertion failed

Open hyperknot opened this issue 11 years ago • 22 comments

When enabling plotting, the following error is happening:

bpm plot enabled

OpenCV Error: Assertion failed (mat.isContinuous()) in unknown function, file ..
\..\..\opencv-2.4.4\modules\core\src\opengl_interop.cpp, line 1153
Traceback (most recent call last):
  File "get_pulse.py", line 127, in <module>
App.main_loop()
  File "get_pulse.py", line 122, in main_loop
self.key_handler()
  File "get_pulse.py", line 94, in key_handler
self.key_controls[key]()
  File "get_pulse.py", line 64, in toggle_display_plot
self.make_bpm_plot()
  File "get_pulse.py", line 80, in make_bpm_plot
bg = self.processor.grab_faces.slices[0])
  File "e:\docs\test\webcam-pulse-detector-master\lib\interface.py", line 113, i
n plotXY
cv2.imshow(name,z)
cv2.error: ..\..\..\opencv-2.4.4\modules\core\src\opengl_interop.cpp:1153: error
: (-215) mat.isContinuous()

I have Windows, Python 2.7, OpenCV 2.4.4 and OpenMDAO 0.5.5 and the 'S' part works perfectly.

hyperknot avatar Apr 16 '13 10:04 hyperknot

Hmm, OpenCV is very picky when it comes to data formatting sometimes, and the errors that different builds give are difficult to replicate across platforms.

Just before line 113 of lib/interface.py (the last line), try explicitly casting z to a numpy array first:

z = np.array(z)

and see if that helps. Odd as it may sound,that fixed a few bugs that came up for me in a few places.

thearn avatar Apr 16 '13 12:04 thearn

Same probleme here, the fix didn't work

OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in polylines

P is :

[[ 10 18] [ 78 61] [148 70] [216 52] [287 26] [315 32] [350 33] [381 35] [412 39] [445 35] [478 25] [503 26] [535 22] [565 14] [595 12] [630 10]] [[ 10 150] [ 98 116] [187 98] [275 90] [364 90] [452 97] [541 115] [630 147]] [[ 10 170] [630 230]]

mlequeux avatar Apr 16 '13 14:04 mlequeux

Similar issue....

bpm plot enabled OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in polylines, file /build/buildd/opencv-2.3.1/modules/core/src/drawing.cpp, line 2064 Traceback (most recent call last): File "get_pulse.py", line 127, in App.main_loop() File "get_pulse.py", line 122, in main_loop self.key_handler() File "get_pulse.py", line 94, in key_handler self.key_controlskey File "get_pulse.py", line 64, in toggle_display_plot self.make_bpm_plot() File "get_pulse.py", line 80, in make_bpm_plot bg = self.processor.grab_faces.slices[0]) File "/home/tomtom/Downloads/webcam-pulse-detector/lib/interface.py", line 112, in plotXY cv2.polylines(z, P, False, (255,255,255),1) cv2.error: /build/buildd/opencv-2.3.1/modules/core/src/drawing.cpp:2064: error: (-215) p.checkVector(2, CV_32S) >= 0 in function polylines

Python 2.7.3, libCV2.3, openMdao 0.5.5 and s part also works.

Feighery avatar Apr 16 '13 14:04 Feighery

I just added a quick check of cv's polylines's function in test_webcam.py, since it seems to be tricky for a few people.

What happens when you run that?

thearn avatar Apr 16 '13 15:04 thearn

for me, it's only when i press the key 'D' in the get_pulse.py

mlequeux avatar Apr 16 '13 15:04 mlequeux

Update: I changed part of how it is used in interface.py, but since I can't seem to replicate the error I'm not sure if that will fix it

thearn avatar Apr 16 '13 15:04 thearn

Same issue, I've just pulled.

VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument face detection lock = True bpm plot enabled OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in polylines, file /build/buildd/opencv-2.3.1/modules/core/src/drawing.cpp, line 2064 Traceback (most recent call last): File "get_pulse.py", line 127, in App.main_loop() File "get_pulse.py", line 122, in main_loop self.key_handler() File "get_pulse.py", line 94, in key_handler self.key_controlskey File "get_pulse.py", line 64, in toggle_display_plot self.make_bpm_plot() File "get_pulse.py", line 80, in make_bpm_plot bg = self.processor.grab_faces.slices[0]) File "/home/flacoste/homework/webcam-pulse-detector/openmdao-0.5.5/webcam-pulse-detector/lib/interface.py", line 112, in plotXY cv2.polylines(z, [p], False, (255,255,255),1) cv2.error: /build/buildd/opencv-2.3.1/modules/core/src/drawing.cpp:2064: error: (-215) p.checkVector(2, CV_32S) >= 0 in function polylines

ghost avatar Apr 16 '13 15:04 ghost

Re-pulled - I've seen that you modified test_webcam.py. Here's the error I have with it now.

python test_webcam.py VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in polylines, file /build/buildd/opencv-2.3.1/modules/core/src/drawing.cpp, line 2064 Traceback (most recent call last): File "test_webcam.py", line 15, in cv2.polylines(img, [pts1, pts2], False, (255,255,255),1) cv2.error: /build/buildd/opencv-2.3.1/modules/core/src/drawing.cpp:2064: error: (-215) p.checkVector(2, CV_32S) >= 0 in function polylines

ghost avatar Apr 16 '13 15:04 ghost

Just pulled

VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument init done opengl support available bpm plot enabled OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in polylines, file /home/abuild/rpmbuild/BUILD/OpenCV-2.3.1/modules/core/src/drawing.cpp, line 2064 Traceback (most recent call last): File "get_pulse.py", line 127, in App.main_loop() File "get_pulse.py", line 122, in main_loop self.key_handler() File "get_pulse.py", line 94, in key_handler self.key_controlskey File "get_pulse.py", line 64, in toggle_display_plot self.make_bpm_plot() File "get_pulse.py", line 80, in make_bpm_plot bg = self.processor.grab_faces.slices[0]) File "/home/lequeu_m/Downloads/webcam-pulse-detector/lib/interface.py", line 112, in plotXY cv2.polylines(z, [p], False, (255,255,255),1) cv2.error: /home/abuild/rpmbuild/BUILD/OpenCV-2.3.1/modules/core/src/drawing.cpp:2064: error: (-215) p.checkVector(2, CV_32S) >= 0 in function polylines

mlequeux avatar Apr 16 '13 15:04 mlequeux

pts1 = numpy.array([[0,0],[100,100]], numpy.int32)
pts2 = numpy.array([[0,0],[0,500],[200,200]],numpy.int32)

seems to fix the problem in test_webcam.py

ghost avatar Apr 16 '13 15:04 ghost

Yes

mlequeux avatar Apr 16 '13 15:04 mlequeux

interesting - I'll test that out on my end and add that change in.

I also replaced cv2.polylines with iterations over cv2.line, since a google search shows that a ton of opencv installations seem to have problems with polylines (for some reason). The python bindings for opencv may not be entirely complete across platforms...

thearn avatar Apr 16 '13 15:04 thearn

Apparently, the last push you did fixed this issue, however I'm getting this error now:

../bin/python get_pulse.py VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument face detection lock = True bpm plot enabled Traceback (most recent call last): File "get_pulse.py", line 127, in App.main_loop() File "get_pulse.py", line 122, in main_loop self.key_handler() File "get_pulse.py", line 94, in key_handler self.key_controlskey File "get_pulse.py", line 65, in toggle_display_plot moveWindow(self.plot_title, self.w,0) File "/home/flacoste/homework/webcam-pulse-detector/openmdao-0.5.5/webcam-pulse-detector/lib/interface.py", line 15, in moveWindow return cv2.moveWindow(args,*kwargs) AttributeError: 'module' object has no attribute 'moveWindow'

ghost avatar Apr 16 '13 15:04 ghost

Same than flacostec

mlequeux avatar Apr 16 '13 15:04 mlequeux

Fixed my issue by returning nothing in that function.

lib/interface.py:14 def moveWindow(args,*kwargs): return

ghost avatar Apr 16 '13 15:04 ghost

ITS WORKING

mlequeux avatar Apr 16 '13 15:04 mlequeux

Excellent, thanks for the feedback on these bugs!

thearn avatar Apr 16 '13 15:04 thearn

Thanks :+1:

ghost avatar Apr 16 '13 16:04 ghost

I have this error now, upon pressing D. S and test-webcam works OK.

face detection lock = True bpm plot enabled OpenCV Error: Assertion failed (mat.isContinuous()) in unknown function, file .. ....\opencv-2.4.4\modules\core\src\opengl_interop.cpp, line 1153 Traceback (most recent call last): File "get_pulse.py", line 127, in App.main_loop() File "get_pulse.py", line 122, in main_loop self.key_handler() File "get_pulse.py", line 94, in key_handler self.key_controlskey File "get_pulse.py", line 64, in toggle_display_plot self.make_bpm_plot() File "get_pulse.py", line 80, in make_bpm_plot bg = self.processor.grab_faces.slices[0]) File "e:\docs\webcam-pulse-detector\lib\interface.py", line 120, in plotXY cv2.imshow(name,z) cv2.error: ......\opencv-2.4.4\modules\core\src\opengl_interop.cpp:1153: error : (-215) mat.isContinuous()

On 16 April 2013 17:02, flacostec [email protected] wrote:

Thanks [image: :+1:]

— Reply to this email directly or view it on GitHubhttps://github.com/thearn/webcam-pulse-detector/issues/3#issuecomment-16453719 .

hyperknot avatar Apr 16 '13 17:04 hyperknot

Sorry, was away. Just did a pull and all working now. Zero errors.

Feighery avatar Apr 16 '13 21:04 Feighery

Sorry, this is still active. Pulled latest today, but still have the original bug:

bpm plot enabled
OpenCV Error: Assertion failed (mat.isContinuous()) in unknown function, file ..
\..\..\opencv-2.4.4\modules\core\src\opengl_interop.cpp, line 1153
Traceback (most recent call last):
  File "get_pulse.py", line 131, in <module>
App.main_loop()
  File "get_pulse.py", line 126, in main_loop
self.key_handler()
  File "get_pulse.py", line 98, in key_handler
self.key_controls[key]()
  File "get_pulse.py", line 65, in toggle_display_plot
self.make_bpm_plot()
  File "get_pulse.py", line 84, in make_bpm_plot
bg = self.processor.grab_faces.slices[0])
  File "e:\dev\libs-nosync\OpenMDAO\webcam-pulse-detector\lib\interface.py", lin
e 126, in plotXY
cv2.imshow(name,z)
cv2.error: ..\..\..\opencv-2.4.4\modules\core\src\opengl_interop.cpp:1153: error
: (-215) mat.isContinuous()

hyperknot avatar May 12 '13 00:05 hyperknot

Same problem with 'D' part. Win, Python 2.7, OpenCV 2.4.5, OpenMDAO 0.8.1

mFoxRU avatar Dec 04 '13 05:12 mFoxRU