Logging failure of commands
-
Hello Everyone,
I am facing issue where i am taking images from camera and saving them in a folder the folder is sometimes the image save operation fails. I am using the following commands to save the image.
if(imwrite(filename, matframe)){ qDebug(logInfo())<<"Image Saved : "<<counter<<" Times"; counter++; }else{ qDebug(logCritical())<<"Failed to save Image "<<failCounter<<" Times"; failCounter++; }
When i check the logs it shows the image have been saved in the folder. When i open the folder some of the image files are missing.
Is there any way to exactly determine when the error is happening.
-
imwrite
is a Matlab function, not a Qt one. I think you are in the wrong place to ask this question@VRonin : Thanks for the reply.
Actually i was referencing any function which we want to monitor either qt or c++ or any library which we use. Whether is there any feature where i can catch the run time error if the function produces.
We can use try catch but wanted to know is there any more effective way in Qt doing the same. -
Actually, turns out there's also a function with the same name in opencv but once again you are in the wrong place. The management of errors is 100% dependant on the implementation of that function.
If it can help, see https://stackoverflow.com/questions/22369168/opencv-imwrite-not-saving-image