Here is my original image
This is my fist project regarding image processing so please bear with me. I am trying to
  1. detect the shape of few fabric shapes, the attached code and image "detected shape" show my effort on this.
  2. 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)
  3. 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 件のコメント

Alex Taylor
Alex Taylor 2026 年 10 月 8 日 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.

サインインしてコメントする。

 採用された回答

Image Analyst
Image Analyst 2018 年 1 月 15 日
編集済み: Image Analyst 2018 年 1 月 15 日

1 投票

Get the area with regionprops() or bwarea(). See my Image Segmentation Tutorial where I go over how to threshold an image and measure area and other features of blobs. https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
See attached shape description demos.

3 件のコメント

Ramesh Warusavitharana
Ramesh Warusavitharana 2018 年 1 月 17 日
Thank you for this information. In this method we are measuring the perimeter of the shape. Can I take five separate measurements of the five sides of the polygon? (like shown in the figure)
Image Analyst
Image Analyst 2018 年 1 月 17 日
Yes. Use my demo to find the vertices. Then use sqrt() to find the distance between them. Please try it yourself, since I may not have time to do it for you for several days, if ever.
Ramesh Warusavitharana
Ramesh Warusavitharana 2018 年 1 月 17 日
Thank you for your help. I will try that method.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by