Measuring Diameter of Calibration Pin

조회 수: 2 (최근 30일)
Ang Xian Jia
Ang Xian Jia 2019년 11월 28일
편집: Ang Xian Jia 2019년 11월 30일
I want to measure the diameter of the pin but getting a bad edge detection image. Can someone help me to further improve it?
untitled.png
My edge detection image:
Edge.png
My coding:
%% Read and Binarize
load image.mat
I4 = imgaussfilt(I3);
I4 = I4 <120;
%%
I5 = edge(I4,'Sobel');
imshow(I5)

채택된 답변

Image Analyst
Image Analyst 2019년 11월 28일
Why are you doing edge detection???? I see no need for that. If the edges are about where you put them, then try thresholding and getting the area and divide by the width:
mask = grayImage < someValue;
mask = imfill(mask, 'holes');
diameter = nnz(mask) / size(mask, 2); % height = area / width. Answer is in pixels.
It's trickier if you want the inner, instead of outer, dark thing.
  댓글 수: 5
Image Analyst
Image Analyst 2019년 11월 30일
Do you have another, more trusted method? If not, then why do you doubt the image analysis? Why do you assume it's wrong if you don't have another more trusted method? If it's the only thing you have that gives you an answer, then why do you doubt it?
What you really need to ask is if the image analysis meets your needs. For example does it properly identify diameters that are for usable parts and unusable parts? If not, you can construct an ROC curve.
Ang Xian Jia
Ang Xian Jia 2019년 11월 30일
편집: Ang Xian Jia 2019년 11월 30일
In measurement field, I think it's a headache to ask myself whether the image analysis had met my need. I think using more sample as you had mentioned is the best way to know whether I had done enough step/coding to process the pin image. Thank you so much, Image Analyst! #LongLiveImageAnalyst

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by