Find array of edges with imageJ

[亡魂溺海] 提交于 2019-12-13 08:25:13

问题


I have already found edges of an image thanks to imageJ library.

Now, I'd like to get an array which would contain these edges.

There is a topic about it here but i couldn't comment and there wasn't the answer: Find Edges with ImageJ Programmatically


回答1:


As documented in §29.3 Find Edges, the command uses the Sobel operator. Each point of the final image is the magnitude of the gradient of the horizontal and vertical convolutions. A copy of the whole array is returned by the get*Array() methods of the chosen ImageProcessor; the individual elements of the array can be accessed using the various get*() methods.

Addendum: You say, "My aim is to get the edges. My problem is not getting each pixel value."

Edge detection is not trivial; it is typically a multi-stage process. The array of magnitudes is merely the initial result of applying the first-order Sobel operator. The next stages in the pipeline, e.g. thresholding, linking, thinning, depend on your goal.




回答2:


Yes, I know this is old, but this needs an answer. Using imageJ programatically

 float edgePixels[][];
 ImagePlus imp = null;
 Opener op = new Opener();
 imp =  op.openImage("lib/EP07-J.jpg");
 ImageProcessor improc = imp.getProcessor().duplicate();

 improc.medianFilter();
 improc.findEdges();
 edgePixels = improc.getFloatArray();

Congrats, you now have a multi-dimensional array representing the pixels after edge detection.



来源:https://stackoverflow.com/questions/14170238/find-array-of-edges-with-imagej

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!