Ask Your Question

the Mat problem

asked 2013-04-25 07:45:51 -0500

Derek gravatar image

updated 2013-04-25 08:24:45 -0500

Hi OpenCV team,

I have added the OpenCV(V 2.4.5) in the eclipse and the program compiles normally. When eclipse executes the following line the program pointer of eclipse enters the constructor of Mat class.

(Mat m = new Mat());

and then eclipse shows the message of Source not found and enters InvocationTargetException.class,after leaving the constructor of Mat class.

Do I miss some parameter to be set?

Please help me, thank you.

edit retag flag offensive close merge delete



Did you have an error or what?

Daniil Osokin gravatar imageDaniil Osokin ( 2013-04-26 03:25:30 -0500 )edit

no, there is any error after compiling. if there was an error, the eclipse would not enter the debug mode and the simulator of the phone.

Derek gravatar imageDerek ( 2013-04-26 07:53:07 -0500 )edit

Then what exactly are you asking from us? You have no error and your code does exactly nothing? You got me confused :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-26 08:12:16 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-26 22:26:11 -0500

wuling gravatar image

HI, I think you should check the source Mat is empty or not. for example:

Mat a=imread(image_path) // if image is loades, the a is not empty

of course , if you use

Mat m = new Mat()  // where m is empty.
edit flag offensive delete link more


I have tried to use the method that you said. when I use Mat m=new Mat(image_path) instead of Mat m=new Mat(), the eclipse doesn't show the message of Source not found. Mat m = new Mat() is a legal line, but why can not work normally?

Derek gravatar imageDerek ( 2013-04-27 09:49:01 -0500 )edit

I think you don't read opencv fact, Mat format don't new constructor.for for example Mat image(200, 200, CV_8UC3, Scalar(0)); //you just give initial value.where image size:200x200 format 3 channels 8 bits & all value are zero. so i think you have better to read the opencv example or ref:

wuling gravatar imagewuling ( 2013-04-27 11:09:07 -0500 )edit

thank you for your opinion. I will study it.

Derek gravatar imageDerek ( 2013-04-29 11:37:44 -0500 )edit

Question Tools


Asked: 2013-04-25 07:45:51 -0500

Seen: 180 times

Last updated: Apr 26 '13