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

Community
  • 1
  • 1
antisrdy
  • 1
  • 4
  • 1
    What will you do with the array of edges? – İsmet Alkan Jan 06 '13 at 01:14
  • 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? – antisrdy Jan 06 '13 at 15:53
  • 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. – İsmet Alkan Jan 06 '13 at 15:57
  • I know but it seemed you did it in your post, not finding precisely start and end points, but array of edges. Thanks btw – antisrdy Jan 06 '13 at 16:01
  • The title of my question mislead you, I see. I only found the edge-detected image. Sorry for that. – İsmet Alkan Jan 06 '13 at 16:06

2 Answers2

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.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • 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. – antisrdy Jan 05 '13 at 15:16
  • I've elaborated above; please edit your question to clarify what result you expect. – trashgod Jan 05 '13 at 18:55
  • My goal is: find connex component. Each major edge would be a connex component which could be referenced. – antisrdy Jan 05 '13 at 19:44
  • @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](http://meta.stackexchange.com/q/48578/163188). – trashgod Jan 05 '13 at 19:49
  • 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. – antisrdy Jan 06 '13 at 09:29
  • Sorry, I don't think you'll get a different answer, but [editing your question](http://meta.stackexchange.com/questions/21788/how-does-editing-work) is a way to find out. – trashgod Jan 06 '13 at 10:04
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.

John
  • 1