2

I wrote:

 Mat sobel = new Mat();
 Imgproc.Sobel(threshold,sobel, sobel.depth(), 1, 0);
 Highgui.imwrite("Sobel.jpg", sobel); 
 sobel.create( sobel.height(),sobel.width(), CvType.CV_8UC(2));    
 System.out.println(sobel.dump());

 //display matrix

Then I tried to get an array from sobel. But I confused how to get value from Mat and put in Array.

1 Answer 1

3

image filters like canny or sobel just binarize / highlight the image.

if all you wanted was to access the pixels:

byte [] pixels = new byte[ sobel.height() * sobel.width() ];
sobel.get(0,0,pixels);

if you wanted a list of points / contours, you'd have to use http://docs.opencv.org/java/org/opencv/imgproc/Imgproc.html#findContours(org.opencv.core.Mat,%20java.util.List,%20org.opencv.core.Mat,%20int,%20int)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.