Ask Your Question
0

OpenCV Mat explained

asked 2017-06-28 04:18:07 -0600

arqam gravatar image

updated 2017-06-29 01:52:27 -0600

berak gravatar image

I am reading through how the image data is stored in the matrices format, this explains it very beautifully how matrices determine each pixel.

So I would like to know in the context of OpenCV when we store the image in the MAT format then how can we see the value of the image that is presented in the MAT format.

Like if I see the value that is being stored int the Mat object it is something like this : Mat [ 286*195*CV_8UC3, isCont=true, isSubmat=false, nativeObj=0x7f9aa26914f0, dataAddr=0x11c85d020 ] So if possible can anyone explain how this data is representing the image and where are the pixel values that is used to form the matrices while representing the image.

edit retag flag offensive close merge delete

Comments

May be you will find your answer in this tutorial

LBerger gravatar imageLBerger ( 2017-06-28 04:23:16 -0600 )edit

@LeBerger any way how to see the formatted format of MAT in JAVA?

arqam gravatar imagearqam ( 2017-06-28 04:36:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-06-28 06:34:32 -0600

KjMag gravatar image

updated 2017-06-28 06:38:36 -0600

In Java, there is a function Mat.dump() and Mat.toString() that prints all the values of the Mat object as a string in a format that is similar to Matlab's.

Another option is to iterate over pixels with Mat.get(), but I think it's too slow to do it just for debugging, so you may use one of the get() variations that takes a Java array as the third argument and copy the entire Mat object to a native Java array thus enabling its values to be viewed via your debugger.

I'm not aware of any other way like a debugger plug-in that would let you see individual pixel values.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-28 04:18:07 -0600

Seen: 2,085 times

Last updated: Jun 28 '17