Measure size of objects with image | Computer Vision | Opencv with Python | Pyresearch

Поделиться
HTML-код
  • Опубликовано: 20 авг 2024
  • #Pyresearch
    #Measure #size #objects #image #ComputerVision #Opencv #Python #Pyresearch
    Measure the size of objects in an image using OpenCV
    The project provides a script to read an image and based on the dimensions of a reference object find the dimensions of other objects in a scene. The reference object must be the leftmost object in the scene. In the sample images given, a box of dimension 2cm x 2cm is taken as a reference object.
    For any other reference, the object provides the actual width of the object. (change line 59 in file 'size_object.py')
    Constraints
    1. Shadow effect: use a dark background
    2. Object boundary: use a contrasting background
    Getting Started
    Prerequisites
    Python 3
    Pip
    OpenCV
    Numpy
    Other prerequisites:
    - pip install numpy
    - pip install opencv-python
    Algorithm
    1. Image pre-processing
    - Read an image and convert it to no grayscale
    - Blur the image using Gaussian Kernel to remove unnecessary edges
    - Edge detection using Canny edge detector
    - Perform morphological closing operation to remove noisy contours
    2. Object Segmentation
    - Find contours
    - Remove small contours by calculating their area (the threshold used here is 100)
    - Sort contours from left to right to find the reference objects
    3. Reference object
    - Calculate how many pixels are there per metric (centi meter is used here)
    4. Compute results
    - Draw bounding boxes around each object and calculate its height and width
    code: github.com/noo...
    Please let me know your valuable feedback on the video by means of comments. Please like and share the video. Do not forget to subscribe to my channel for more educational videos.
    Any type of problem you can comment down.
    Want more education? Connect with me here:
    Twitter: / noorkhokhar10
    Github:github.com/noo...
    Subscribe: / @pyresearch
    Organizations: / pyresearch
    RUclips: / pyresearch
    #python #opencv #cvzone #computervision #ai #shorts

Комментарии • 16

  • @anusiyakumari7321
    @anusiyakumari7321 Год назад +2

    Hello sir the video was really useful for me. But i have a struggle in measuring a particular object ( example: I want to measure the size of single tree in image where as the image has many trees and other noisy background). Can you please suggest me to measure the particular object with exact edges in image. Please. Waiting for you reply.

    • @Pyresearch
      @Pyresearch  Год назад +2

      Use an image segmentation algorithm to separate the tree of interest from the background. There are various techniques available for image segmentation, such as thresholding, region growing, watershed, and active contours.
      Once you have segmented the tree of interest, you can use techniques like edge detection or boundary tracing to extract the exact edges of the tree.
      Finally, you can measure the size of the tree by calculating its area, perimeter, or other relevant metrics.
      Some popular image processing libraries like OpenCV or scikit-image have built-in functions for image segmentation and edge detection. You can explore those libraries and their documentation for more details.
      I hope this helps!

    • @anusiyakumari7321
      @anusiyakumari7321 Год назад +1

      @@Pyresearch thank you so much sir

    • @Pyresearch
      @Pyresearch  Год назад

      @@anusiyakumari7321 keep connect with us

  • @slavic_cousin9988
    @slavic_cousin9988 Год назад +2

    Does this work for curved objects? Ie, a thick curved line, or a thick circle

    • @Pyresearch
      @Pyresearch  Год назад

      you can try it, we are nnot used in curved shape

  • @gog7114
    @gog7114 3 месяца назад +1

    Do you have a Volume measure like 3d estimation?

    • @Pyresearch
      @Pyresearch  3 месяца назад

      You try it this code into your way

  • @anushakv4104
    @anushakv4104 20 дней назад +1

    Please share report

    • @Pyresearch
      @Pyresearch  20 дней назад

      code: github.com/noorkhokhar99/Measure-size-of-objects-in-an-image-using-OpenCV

  • @maliksalman6192
    @maliksalman6192 Год назад +2

    I can’t find code

  • @-BMadhan
    @-BMadhan Год назад +1

    May I know the distance between camera and the object

    • @Pyresearch
      @Pyresearch  Год назад

      depen on your camera your camera angle

  • @nuramirabintiabubakar824
    @nuramirabintiabubakar824 Год назад +1

    is it run using gpu or cpu?