Find array of edges with imageJ
Asked Answered
T

2

0

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

Tactile answered 5/1, 2013 at 8:58 Comment(5)
What will you do with the array of edges?Bezel
My goal is listing these (horizontal) edges. Example: consider an image where I have found edges (with methods of ij you used in your post). If a line appears as an edge, I would like to list it: it would be a segment with a starting point and an end point. Do you understand what I mean?Tactile
Yes. With ImageJ you can only get edge-detected version of the image, not the edges, as I know. First, get the edge-detected version of the image. Non-edge pixels will be black, edge pixels will be different. You need to find start and end points of these by yourself.Bezel
I know but it seemed you did it in your post, not finding precisely start and end points, but array of edges. Thanks btwTactile
The title of my question mislead you, I see. I only found the edge-detected image. Sorry for that.Bezel
T
2

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.

Tace answered 5/1, 2013 at 10:6 Comment(6)
True, but my aim is to get the edges. My problem is not getting each pixel value. Ismet Alkan user seems to hava managed this operation, but I don't know how to contact him and I can't comment his post.Tactile
I've elaborated above; please edit your question to clarify what result you expect.Tace
My goal is: find connex component. Each major edge would be a connex component which could be referenced.Tactile
@Archos007: I don't understand connex component. Please edit your question to include a link and for others to see your clarification in the active queue.Tace
In my first post, there is a link. And my goal is about what users talk in the last posts. One of them says he managed to find edge-found array, but he doesn't explain how. And I can't comment because I've just joined the site.Tactile
Sorry, I don't think you'll get a different answer, but editing your question is a way to find out.Tace
P
0

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.

Pithecanthropus answered 23/4, 2013 at 22:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.