Object dimension measurement

血红的双手。 提交于 2020-12-15 04:54:12

问题


The following image is of a coin (for reference) and a pill. I need to measure the pill's dimensions. The objects are back-illuminated.

I followed pyimagesearch.com tutorial for object height and width measurement.

The coin has a diameter of 24.97 mm, and the actual dimensions of the pill are 9.43 mm x 19.33 mm. I am getting results with some error ranging from 0.5 mm to 2 mm. As mentioned on the website this is because of distortion and it is to be corrected.

Can someone help me in calibrating the camera to remove the distortion effect so that I can measure correct dimensions in mm?

I have also tried camera calibration but that is also not working.


回答1:


Just doing a quick manual measurement of these two shapes, I get pill sizes of 20.51 mm and 9.89 mm. If your actual pill sizes are 19.33 mm and 9.43 mm, then either your coin is not 24.97 mm, or you have a problem with object thickness. I don't think camera calibration has anything to do with this.

This is how thickness plays a role in apparent object size: Note first that you are obtaining a projection of the object. The goal is to create a projection whose size matches the object's size. This is however not easy! There are two effects playing a role. Please refer to the figure below.

  1. Focal length. If the camera is relatively close to the object, the front of the object is closer to the camera than the back of the object. The shadow of the object will be larger when projected back onto the screen the object is lying on. This is the effect illustrated as "A" below. If the coin is thinner than the pill, the pill will have a relatively larger projection than the coin. To correct for this, put the camera very far away, and use a lens with a long focal length. There are many examples of this for portrait photography online, for example here. Noses look way larger if the lens has a short focal length, because with a short focal length you need to be close to the face to take the picture, and then the distance of the noise to the camera is much closer, relatively, than the cheeks.

  2. Oblique angle. This is case "B" below. A tick object, when photographed at an angle, will produce a much larger projection than one photographed straight on. Make sure your camera is straight above the object to measure. I would suggest you first take a photograph of the coin, remove the coin and place the pill, then take the photograph of the pill. Of course, the camera has to be fixed (tripod) and not touched at all (trigger cable).



来源:https://stackoverflow.com/questions/51485494/object-dimension-measurement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!