# How to measure a cylinder average diameter using Matlab Image Processing?

4 visualizzazioni (ultimi 30 giorni)
Ario Madani il 26 Ago 2015
Commentato: Ario Madani il 18 Set 2015
<<
<<
<<
>>
>>
>>
Hi, I would like to measure average diameter of cylinders (Diamater 7-15") using matlab image processing. I am using a checkerboard and using a V shape jig so I can place the cylinder's center align with checkerboard plane. I calibrate my camera and capture the edges of the cylinder and get an average of each edge and calculate the diameter. Then I can rotate the cylinder and repeat the process. I have two problems: 1.No matter from what direction you look, the cylinder has the same diameter, but the checkerboard angle is different, resulting in different diameters. 2. I have ensured that the checkerboard and cylinder are level but when I get the boundaries in world coordinate, my cylinder is tilted, any idea why? I greatly appreciate it if you have any better ideas on how to measure the diameter of the cylinder (not by looking at it from the top). Thank You Ario
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Tim Jackman il 2 Set 2015
If I understand your first question correctly, the issue is that if you take images from different camera positions, the diameter is the same but the checkerboard you use for calibration changes perspective and this alters the computed diameter of the cylinder. If this is the case, you should be able to perform a projective transformation of each subsequent image to your "gold standard" image. You could use "cpselect" to manually select the control points, "fitgeotrans" to create the transformation matrix, and "imwarp" to transform the image into the desired reference field.
Another potential consideration would be to use a cylinder of known diameter for calibration in place of the checkerboard. You may have reasons to not use a cylindrical calibration object that I haven't thought of yet, but it may be worth considering.
Regarding question #2, what do you mean when you say the cylinder is tilted? Tilted in which direction and with respect to what?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Ario Madani il 2 Set 2015
Dear Tim, Thank you for taking the time and answering my question. You got the first question right and I will try to implement your suggestions. I hope I can manage to do it. About the second question, I solved the problem and all is good. Thank You,
Ario

Accedi per commentare.

### Più risposte (1)

Image Analyst il 2 Set 2015
Also, unless your checkerboard is in the plane of the max diameter or you have parallel light rays, you'll have a magnification. For this reason, telecentric lenses are often used in caliper/gauging industrial applications.
Here's an excellent description:
and some others:
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Ario Madani il 18 Set 2015
Thank You Image Analyst.

Accedi per commentare.

### Categorie

Scopri di più su MATLAB Support Package for USB Webcams in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by