Hand Gesture Detection + Distance Prediction? Machine learning Lets go! (part 4)

Hello guys, welcome back. as you see this blog tagline "trust me, don't trust this site" is quiet great ahahaha

by the way, i want to tell you my story this afternoon. While i took a nap, i got dreamed about my lab mate. He texted me like this "Mari kita tegakkan apa yang seharusnya kita patahkan". and it surprised me. I immediately woke up from my sleep and realizing "what an amazing word".

do you know what it means? ahahahah i will tell you on our next part.

Today i wanna show you about my progress. It's about predicting object distances. YEA

WATCH THE VIDEO!

Before we get started. i just want you to know that i'm using haarcascade machine learning agorithm. in this post, i tried using haarcascade classifier for hand palm, open and closed hand palm. you can get the xml file on this link

https://github.com/Aravindlivewire/Opencv/tree/master/haarcascade

thank you Mr. Aravind!

Back to topic, this is what i have done with my programming script



the number above the square is the width value of rectangle. now we can do some mathematical calculation by using data that i got from sets of hand palm pictures and width value.

I used ruller to get the actual distance and using "q-pressing code" to capture the data in my monitor.
the green mark is a width value. You have to convert it to string (using str()) because it was an integer data-type.

the blue mark is the rectangle and text code. You have to knowing the parameters inside those code. you can see all the parameters using the documentation in here
https://docs.opencv.org/4.1.2/
if you can't read the documentation (i confused at the first time i read it) you can find out by typing cv2. (on your pycharm IDE) and you'll find a lot of codes and the code function is on the link above.

OKAY NEXT.
I measured from 60 cm to 20 cm, and put the data to excel. i made a scatter diagram and checked the trendline feature. i used polinomial second order function because it's the closest trend with the regression.



then i put it on my code.

the "dist" is my function based on my data samples. now we can try it.
and this is what i got.
pretty cool right?
i measured it on 30cm in front of the camera. now we calculate it manually we got 99.7% accuracy for distance prediction.

now we can calculate the error by using the 'input' code where we put the true value and the computer take its prediction and compared it.
the green rectangle is my code to calculate error manually. i also put input code to give the true value to the computer.
the red rectangle is the result.

i think it was great! because the error is below 10% and that is pretty sweet ahahahahah
if you want to see my code just go to this link, feel free to develop it because i'm still noob xD
 SEE YOU!

Komentar