Shape matching and distance measuring methods
Show older comments
Here is my original image

This is my fist project regarding image processing so please bear with me. I am trying to
- detect the shape of few fabric shapes, the attached code and image "detected shape" show my effort on this.
- measure measure distance of the shape border, the attached image "measured image" show how i would like to measure my shape. (some method to automatically measure distances like in imtool)
- match those distance values with set values to check if they have correct size. It is a quality check application to test if the cut fabric parts are with in the given tolerance.(+ or - 5 mm)
I have completed shape detection part and searched the internet for months to find method to accurately measure distance in the method shown in "measured image". Please guide me in correct path. thank you
if true
%%read image
I = imread('D:\ICBT files\Bng final project\Test samples\Original pocket.JPG');
%%convert the image into gray image
Igray = rgb2gray (I);
%imshow (Igray)
%%Sobel edge detection
bw = edge(Igray,'Sobel',[0.04],'both','nothinning');
Ifilled = imfill(bw,'holes');
imshow(Ifilled);
%imtool(Ifilled);
end

1 Comment
Alex Taylor
on 8 Oct 2026 at 18:07
Several years late getting to this question but as of R2026b there is now edge-based shape matching and subpixel measurement workflows enabled by the Visual Inspection Toolbox.
The examples shown here would be a worthwhile thing to check out that use the new shapemodel and matchshape functionality in Visual Inspection Toolbox for locating objects based on their contour profiles and automating measurements relative to the AnchorPoint defined by a shapemodel.
Accepted Answer
More Answers (0)
Categories
Find more on Object Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!