Name: Yuke Brilliant Hestiavin
Departement: Computer Engineering
Nrp: 5024241016
This project is related to the task as an intern software engineer in the Robotics UKM Research Team (IRIS) week 2, Computer Vision chapter.
demo.mp4
- Set up the camera in a fixed position
- Prepare an object with known dimensions (preferably the same color as your tracking target)
- Mark several distances on the floor (e.g., every 10cm from 10cm to 100cm)
- Collect radius measurements at each distance point
- Record at least 4 data pairs of radius (pixels) and actual distance (cm)
- Use regression calculator (arachnoid.com)
- Input the collected data pairs
- Set polynomial degree
- Create calculateDistance() function using polynomial coefficients
- Implement quadratic equation solver
- Add error handling for invalid radius values
- Add boundary checking for calculated distances
- Integrate the function with the main tracking loop
- Test the system at known distances
- Calculate error margins
- Adjust coefficients if necessary
- Document the accuracy at different distances
- Basic color tracking implemented
- Contour detection working
- Minimum enclosing circle calculation added
- Complete the polynomial regression implementation
- Add detailed documentation
- Optimize for better accuracy
- OpenCV 4.x
- C++ 11 or higher
Clone this repo
git clone https://github.com/yukebrillianth/opencv-object-tracking-with-distance-measurement.git distance-measuring
cd distance-measuring
Make a build directory
mkdir build
cd build
run cmake
cmake ..
compile before run the program (run in build directory)
make
run the program
./DistanceMeasurement
Radius (pixels) | Distance (cm)
----------------|---------------
254 | 10
142 | 20
105 | 30
78 | 40
65 | 50
46 | 70
Mode: normal x,y analysis
Polynomial degree 3, 8 x,y data pairs.
Correlation coefficient = 0.9943957141940097
Standard error = 2.64455698786371
Output form: simple list (ordered x^0 to x^n):
1.7015679224939916e+002
-2.8134763868498247e+000
1.7367481282684945e-002
-3.4546683821398511e-005