How to detect black and white region edge coordinates in image j batch process?

Is there a way to detect the white to black transforming edge and get the coordinates for an image? At least for specific points, for a batch process?

Thanks.

syhbyz

Would

run("Create Selection");
getSelectionCoordinates(xpoints, ypoints);

do the job? You’ll get some additional points at the border of the image but you can easily filter them out.

Best regards,
Volker

1 Like

Dear Mr. Volker,

Thank you so much for your answer. That is exactly what i want in this form,

run(“Find Edges”);
getSelectionCoordinates(xpoints, ypoints);

However, i don’t know how to save x and y coordinate results as a list or table, and export results for each photo in a stack. Additionally, it is OK for just specific point coordinates, it doens’t have to be for all shape.

I am very new at writing macros and image j, sorry if this is an easy question.

Best Regards.

Hi,
once you have the coordinates, it is very easy to display them in a table and to save them:

run("Create Selection");
getSelectionCoordinates(xpoints, ypoints);
Table.create("coordinates");
Table.setColumn("x", xpoints);
Table.setColumn("y", ypoints);
Table.save("/home/baecker/Desktop/coords.txt")

Do you start from a binary image? I think the run(“Find Edges”); command is probably not doing what you expect. You can transform a binary image (a mask) into a selection with run("Create Selection"); and then get the coordinates of the selection.

Best regards,
Volker