Object Size Using Computer Vision

In this post, we are trying to calculate the dimensions of objects in an image and the distances between the object is computed. First, we must find the value of pixels per a given metric. To find this value, we need a reference object from the image. We must store the input image in the memory.

  1. Perform the grayscale which identifies the objects present in the picture
  2. Perform a gaussian filter to remove the unnecessary noise in the picture.
  3. Edge detection method is done to detect the edges of the object present in the picture using contours.
  4. Sort the objects present in the picture in order and compare against an object library
  5. If contour area is too small disregard the object otherwise calculate the dimensions of the object.
  6. Get pixels per metric ratio, Height & Width (pixels). For finding pixels per metric ratio, we need two parameters and they are Height & Width of the reference object.

One more important factor is that to know the details about height of the camera – the perspective. (Coming Soon)

Measuring size of objects in an image with OpenCV