Measuring Line Profiles in IMages
16 views (last 30 days)
Show older comments
I have a image such as below which has horizontal and vertical lines in the field of view. I want to segment the vertical line adjacent to the dark area such as in red below and vertical line in the intersection of the horizontal line(as seen in black).The full image has many such structiures. I want to stack all similar segmented structures within the fov (Average measuremnet of red and black) and display.I also want to measure the average x and y as shown below if the red line concaves at the max conving location in y.


0 Comments
Accepted Answer
Matt J
on 11 Sep 2025
I=im2double(im2gray(imread('image.png')));
BW=imbinarize(I);
D=bwareaopen(abs(gradient(I))>0.06,20);
D=imclose(D,strel('disk',5));
black=(median(BW,2)>0);
red=~black;
L=D.*red+2*D.*black;
imshow(labeloverlay(I,L,Colormap=[1,0,0;0,0,0]));
6 Comments
Matt J
on 29 Sep 2025
Edited: Matt J
on 29 Sep 2025
Please illustrate by drawing one rectangle (e.g. with drawrectangle) on the example segmented image above, demarcating one of the regions that we will want to overlay on other regions.
As part of the illustration, please also show us how the positions of the different edges of the rectangle are selected.
More Answers (1)
Tim Jackman
on 10 Jan 2026 at 18:19
You may want to consider using uicaliper:
The tool can be interactively or programmatically placed, and it detects edge gradients for applications that seem very similar to yours.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
