OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 29 Aug 2018 13:15:23 -0500How to use norm with Java?http://answers.opencv.org/question/198310/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
accdevWed, 29 Aug 2018 13:15:23 -0500http://answers.opencv.org/question/198310/Error in documentation for fitline L1 normhttp://answers.opencv.org/question/37741/error-in-documentation-for-fitline-l1-norm/This is my first post. I was reading the documentation for [fitline](http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html#fitline) and saw what appeared to be an error in the description of the L1 norm.
The description currently is
`* distType=CV\_DIST\_L1
.. math::
\rho (r) = r
`
Whereas the last line probably should be
` \rho (r) = |r|`
I guess this is not a question. The question is how do I get it corrected?Arif ZamanTue, 22 Jul 2014 01:26:09 -0500http://answers.opencv.org/question/37741/magnitude of a matrixhttp://answers.opencv.org/question/28622/magnitude-of-a-matrix/I have used sobel to get the gradient of an image in X and Y direction:
cv::Sobel( Min1, grad_x, Min1.depth(), 1, 0, 3);
cv::Sobel( Min1, grad_y, Min1.depth(), 0, 1, 3);
now I have the gradient of the Min1 in X direction stored in Mat grade_x and in Y direction stored in Mat grade_y.
How do I calculate the magnitude of grad_x and grad_y? Is there any function in Opencv to get the norm of a matrix?
Thanks in advance...mahsaWed, 19 Feb 2014 02:41:47 -0600http://answers.opencv.org/question/28622/Norm function for Point2f and Point3fhttp://answers.opencv.org/question/7195/norm-function-for-point2f-and-point3f/When i try to use the norm function for the classes of the template Point_ and Point3_ I get an error that says that there is no known conversion from Point_ to InputArray. Is this a bug? Please tell me how to resolve this. I can write my own norm function but that does not solve the problem.
Also norm seems to do ok with Point but not Point2f.
I am using opencv 2.3.1 do i need to upgrade?benzunSat, 09 Feb 2013 10:39:09 -0600http://answers.opencv.org/question/7195/cv::gpu::norm speed uphttp://answers.opencv.org/question/3788/cvgpunorm-speed-up/Hi all,
I use the function cv::gpu::norm in a program. This function gets called a lot. With CPU i get about 5 Hz, with GPU it's not usable (a couple of seconds). I suppose the problem is, that the matrices are very small (4x4 - 16x16), so that I can't really make use of the GPU's performance.
Just some background information:
I use the norm function to calculate the radial basis function:
double calculateRBFresponse(boost::shared_ptr<cv::gpu::GpuMat> input, boost::shared_ptr<cv::gpu::GpuMat> neuron, double beta){
double response = cv::gpu::norm(*input, *neuron, cv::NORM_L2);
return cv::exp( -beta * cv::pow ( response, 2.0 ));
}
Is there any way to speed this up? Or is it - as i suppose - the wrong task for a GPU?
Or is there maybe a way to parallelize the task, so that multiple norm calls are run in parallel?
Cheers,
Andreasandreas_Mon, 05 Nov 2012 15:19:52 -0600http://answers.opencv.org/question/3788/