First time here? Check out the FAQ!

Ask Your Question
0

OpenCV Mat explained

asked Jun 28 '17

arqam gravatar image

updated Jun 29 '17

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.

Preview: (hide)

Comments

May be you will find your answer in this tutorial

LBerger gravatar imageLBerger (Jun 28 '17)edit

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

arqam gravatar imagearqam (Jun 28 '17)edit

1 answer

Sort by » oldest newest most voted
1

answered Jun 28 '17

KjMag gravatar image

updated Jun 28 '17

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.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Jun 28 '17

Seen: 2,257 times

Last updated: Jun 28 '17