Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use norm with Java?

I have a code that is written in both Python and C++ that I am now converting to Java. I use the norm function to compare 2 points of an RGB image. In Python and C++ getting these pixel values is simple, and you can just plug them into the norm function. In java, when getting these values the data type changes from Mat to double[] array. The norm function however takes Mat as its arguments. Is it possible to convert the double array to Mat, or to get the pixel values as a Mat?

This is the current methods I am using:

double[] right_pt = image_to_read.get(middlexint+radiint, middleyint); // get pixel value point1
double[] pti = image_to_read.get(middlexint+radiint-i,middleyint);    // get pixel value point2
double e_dist = Core.norm(right_pt, pti);  // calculate euclidean distance