Coder Social home page Coder Social logo

ali619 / object-detection-size-measurement Goto Github PK

View Code? Open in Web Editor NEW
29.0 1.0 5.0 133 KB

With this project you can measure height and width of an object with a normal & simple camera. I find out that I can use another object as a main measure and then use it to measure other objects in the camera.

Python 100.00%
python opencv opencv-contrib-python aruco-markers

object-detection-size-measurement's Introduction

Hello everyone

In this repository you can find a basic and simple Object Measurement project that is work with aruco marker. While i don't have any camera with laser to measure the distance of the objects, I find out that i can use ArUco markers as a main measure and then use it to measure other objects in the camera. Here in the photo blow, the green line is the aruco marker and the blue line is a detected object. Also the red dot is the center of the blue box. So we can calculate the height and width of a detected box-object from there.

Requirements:

Important Note: For this project I used opencv-contrib-python package. If you just and only install opencv, you will get error. If you still getting error after installing opencv-contrib-python package, you can find the solution here.

I put 5x5_aruco-10.svg file to print it. But be sure that you print it by 5x5 centimiter size if you want to use the exact code that I write. If you print it with other sizes, you should change the code as well. (The part that pixels will convert to centimiters)

About the project:

The program will first detect ArUco and draw a green line around it. Then it will calculate how many pixels that the green line have. Next it will convert the amount of pixels to Centimeter and in this way the program can measure the objects in camera.

The size of ArUco (the one that i used in this project) is 5x5 centimeter. So we can divide the amount of Pixels that the camera detect by 20 and calculate the size.

How to run the project:

  • You should run measure_object_size_camera.py file

I hope you guys enjoy it ๐Ÿ‘

object-detection-size-measurement's People

Contributors

ali619 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

object-detection-size-measurement's Issues

face problem when letting camera detect image in my ipad

I did't print the image of aruco marker, I just use image in my ipad to let camera detect. It shows error below.
Traceback (most recent call last):
File "c:/Users/lxy20/Desktop/Object-Detection-Size-Measurement-master/Object-Detection-Size-Measurement-master/measure_object_size_camera.py", line 35, in
contours = detector.detect_objects(img)
File "c:\Users\lxy20\Desktop\Object-Detection-Size-Measurement-master\Object-Detection-Size-Measurement-master\object_detector.py", line 16, in detect_objects
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
ValueError: too many values to unpack (expected 2)
[ WARN:0] terminating async callback

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.