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

1 view (last 30 days)
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.
• 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.
19.03.2020
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
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

Shubh Sahu on 26 Mar 2020
##### 2 CommentsShowHide 1 older comment
Andy Zhao on 15 Jul 2020
Group-attributes:
Children: [2×1 Line]
Visible:'on'
HitTest:'on'
Show all properties
ans =
487.3544 652.1783
It took 9.470028 seconds.