Catching Errors?
I came across this question when searching for an answer to a similar problem.
http://stackoverflow.com/questions/18646547/cant-catch-node-opencv-errors
Can you shed any light on this?
yeah, like the comments say, I haven't added exception handling in the c++ code yet, so it's a bit of a crap shoot at the moment - do you have a particular scenario that you're running into these issues? I could probably add a try catch for that..
Basically I need to send images to the server. It's possible some could be the wrong format or possibly just corrupt. When it fails to read the image (corrupt) or when it fails to use the image in object detection (wrong params) I'd like to respond to an error and keep processing images coming in rather then crash the process.
Thanks
+1
Could you add try catch for this error?
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /build/buildd/opencv-2.3.1/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
what(): /build/buildd/opencv-2.3.1/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
My code is this:
if (fs.existsSync(ruta)) {
//Vamos a escanear las caras
cv.readImage(ruta, function(err, im){
if (err){
me.mg.mgConn.close();
callback(err, null);
return false;
} else {
im.detectObject(global.R + "/node_modules/opencv/data/haarcascade_frontalface_alt.xml", {}, function(err, faces){
if (err){
callback(err,null);
return false;
} else {
me.mg.mgConn.close();
callback(false, faces);
}
});
}
});
} else {
me.mg.mgConn.close();
callback("Fichero no encontrado", null);
return false;
}
Hi.
So we are about to go into production using this package. We're running into an issue where a crash in the C++ level code, kills our node process. PM2 restarts it gracefully, but it's hard to figure out where these crashes are.
Is there any plans for improving the error handling in the C++ bindings?
Hi,
No immediate plans, as I haven't really got time at the moment to do this - it's definitely something that needs to be done, and I'd love to get it in, but I don't have a timetable for it at the moment.
Ideally it could be done with some macros so it would be easy to apply it across all the methods.