Get values of a Mat object

asked 2017-02-24 13:54:33 -0500

Davaaron gravatar image

updated 2017-02-24 14:06:23 -0500

berak gravatar image

Hi guys,

I'm pretty stuck right now. My goal is the following one: JavaFX Image -> Mat -> byte values So I already made it to convert the image to a openCV mat, but I'm confused about the getter and setter methods of the Mat object. I mean, at a specific row and column, let' say X=30 and Y=20, I would get a array back, in all cases, for one value? Like this:

double[] arr = mat.get(j, i);

Why should I even consider to do this? And what's the point behind the getter method "mat.get(int col, int row, byte[] array)? I mean, what's that byte doing there?

Anyways, I want to manipulate specific mat values and I need a byte representation of each value. How would you do this?

I appreciate any help :)

edit retag flag offensive close merge delete


rule 1: never attempt to do anything per pixel here.

what are you trying to achieve ? 99% probability, there's something "high-level", that lets you do this without "trying to defeat the devs", by doing the same in a more lame, error prone way.

berak gravatar imageberak ( 2017-02-24 14:11:21 -0500 )edit

I'd like to extract "image" (pixel...) values from certain spots of my images to manipulate and store them in a database. After that, I want to replace the old values by the new calculated values and convert the Mat object to a javafx Image again. Yea the thing with pixel. I realized fighting the opencv dev's will mostly goes a bad way.

Davaaron gravatar imageDavaaron ( 2017-02-24 15:45:48 -0500 )edit