peterbraden / node-opencv

OpenCV Bindings for node.js
MIT License
4.37k stars 858 forks source link

[BUG] Nodemon crashes when using cv.findContour() function #682

Open Jovaaa opened 3 years ago

Jovaaa commented 3 years ago

I read the image, convert to grayscale, use gaussian blur, use canny, and now I started with findContours(). This is where the problem starts. It finds the contours - sometimes works once, and then the second time crashes.

This is my code:

image

And this is what I get in console:

image

I'm also wondering if this is a problem with load balancing, I never used pm2.

When I use this endpoint without the findContours() function, it works every time.

I'm using react as a frontend to send the image. I've noticed that npm starts multiple node.exe instances when starting both express backend and react - maybe this is an issue?

image

If someone can help I will much appreciate that. Thanks

Edit: I didn't mention, I'm using OpenCV 2.4 version like it says in the opencv npm package, I followed these instructions for installation: https://github.com/peterbraden/node-opencv/issues/378#issuecomment-254715793