MATLAB Answers

How to detect the inner and outer diameters of one image in high quality simultaneously (0.98M 2168×2072)?

6 views (last 30 days)
Andy Zhao
Andy Zhao on 19 Mar 2020
Commented: Andy Zhao on 15 Jul 2020
Hi,everyone.
I have two problems.
Problem 1. To detect the inner and outer diameters in the same image in high quality simultaneously, and the image is 0.98M(2168×2072pixel). After trying by matlab, I just can use "imfindcircles" to detect the daimeter less than 200 pixels.
Problem 2. The circles in image below is not totally circular. As a matter of fact, the two circles are a little oval. Therefore, just thinking the two circles as ovals, I want to detect Major and minor axes of the inner and outer circles in the image.
I just read the other question (https://www.mathworks.com/matlabcentral/answers/455501-detect-and-measure-radius-of-round-object-quality-photos?s_tid=srchtitle), I cannot solve it.
Can you please advise on:
  • Any advice on code is welcome, I am just starting with my project, so I will go in required direct.
  • Providing some Internet links about taking photos by industrial cameras and image processing by matlab.
  • Some cases or Internet links about using matlab as software to do image processing in manufacturing plant.
Thank you, best regrads!
19.03.2020
  1 Comment
Andy Zhao
Andy Zhao on 19 Mar 2020
I shrink the image for calculating its radius(or diameter), but I just get the inner circle's radius.
tic
rgb = imread('RingSeal_20200314.jpg');
subplot(2,2,1),imshow(rgb);
d = imdistline;
I = rgb2gray(rgb);
subplot(2,2,2),imshow(I)
[c,r] = imfindcircles(rgb,[80,150]);
%when proccessing with an image of higher properties those parameters [x, y] are changed, althou i havent had success
subplot(2,2,3),imshow(rgb);
viscircles(c,r);
subplot(2,2,4),imshow(I);
viscircles(c,r);
[c,r]
toc
After calculating by Matlab, the answer is followed:
ans =
line 1
183.669253750496
line 2
172.680044458067
line 3
92.6226833779506
10.791631 seconds.
shrinked image

Sign in to comment.

Accepted Answer

Shubh Sahu
Shubh Sahu on 26 Mar 2020

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by