I’m not too sure how to catch the exception using the try and catch method, never played around much of it. (yes, I am beginner c++) I’ll figure it out soon but I do know how to play around with the debugger.
I think the gtk is disabled on opencv. I do know I have gtk3-3.24.34 installed in the OS.
I have come up with this code:
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main( int argc, char** argv )
{
int e;
try
{
Mat img = imread( argv[1]);
if( img.empty() ) {return -1;}
namedWindow( "Example1", WINDOW_AUTOSIZE );
imshow( "Example1", img );
waitKey( 0 );
destroyWindow( "Example1" );
throw e;
}
catch (int e)
{
std::cout << "An exception occurred. Exception Nr. " << e << '\n';
}
return 0;
}
I do not get any exceptions, same error as to the 1st post.
Edit:
I was able to fix the problem. I needed to recompile OpenCV with GTK3 enabled since for some reason it is disabled for the FreeBSD’s distribution of OpenCV. I would like to know if anyone was able to get OpenCV 4.6.0 compiled and working on FreeBSD 13.1 since 4.6.0 is not available on the FreeBSD distribution yet.