node-opencv: terminating with uncaught exception when running in parallel

Whenever I try and process a large number of images (usually happens around image 150, I’m processing max 16 in parallel) node-opencv crashes and brings down the entire node process.

OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-rp0FJY/opencv-2.4.9/modules/core/src/array.cpp, line 2482
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-rp0FJY/opencv-2.4.9/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat

If I decrease my parallel limit to 1 everything works as expected.

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

OK so the best way to avoid this error and avoid having your nodejs process crash (sometimes silenty with no error!) is to completely avoid async calls to detectObject.

Even though detectObject is an async function, you have to call it synchronously (call it, wait for it to finish, and only call it “one-at-a-time”), which probably means you’ll probably have to process images sequentially.

EDIT: as @LinusU pointed out, this seems to be a bug with opencv.