Detect a edge as a function

I have a image that are edges of an object (file attached)
Now, i want to detect all of edges as functions like X and Y vector. X contains position on x-axis, Y contains position on y-axis of every point in a edge (curve). Every edge (curve) has a function (a set of x,y vector). But i have no any algorithm to do that. I need a help

 Accepted Answer

cellfun(@(Col) find(YourImage(:,Col)), 1:size(YourImage,1), 'Uniform', 0)

3 Comments

Nguyen Tan Duoc
Nguyen Tan Duoc on 25 Sep 2015
Edited: Nguyen Tan Duoc on 25 Sep 2015
Thanks for your answer. Perhaps you misunderstood my mean. I want to detect EVERY edge(curve) in that image as a set of x-axis position and y-axis ones of every point in this edge. For example, imagine i have a GRAPH of function y=2x, x=0:0.1:5 (a line). Now i want to creat a set X and Y that contain position of every point in this line respect to x- and y-axis (X=[0 0.1 0.2 0.3 .... 5], Y=[0 0.2 0.4 0.6 .... 10]). After that, I can use this set to reshow my graph. If i have 2 or more curve in my graph, there will be 2 or more set X, Y. The most important thing is the set X,Y must be arranged so that they discript a curve from the started point to the ended ones.
Thanks a lost!

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 25 Sep 2015
If you can get a binary image instead of that, then you can use bwboundaries(). It looks like you used either edge() or bwperim(). Don't use bwperim if you want edge coordinates. You might want to experiment with activecontour() instead of edge().

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!