ronheywood / opencv

Experimenting using Machine Vision OpenCV and Python to create software suitable for driving a Golf launch monitor similar to technology like SkyTrak, GC2 and GC Quad
MIT License
36 stars 4 forks source link

I would like to help #1

Open supershanesta opened 3 years ago

supershanesta commented 3 years ago

I have been looking into doing this with the hq raspberry pi camera. I do not know ML but I can create a front end to display info after analysis of the footage or still images. I would also like to learn about how to analyze the dimples on the golf ball using a camera and opencv. Let me know how I can help.

ronheywood commented 3 years ago

Hi

Not sure if you're interested in learning computer vision, or more about contributing in creating a front end.

If you're interested in the computer vision aspect, I had most recently been trying to use image processing techniques to identify the logo on the golf ball, as it seemed to be an easier first target than trying to focus on the dimples.

https://github.com/ronheywood/opencv/blob/ball-logo-identification/ball-logo-template-matching.py But I think that's maybe going to need some trained models

natterman12 commented 3 years ago

Hi there,

I'm not sure how much I could actually help as I'm not a coder, but I tried to create a similar project. A DYI golf ball launch monitor using two webcams (one overhead and one to the side). I haven't looked at your code yet but it looks to be more in-depth than mine was. Here is some detail about my project.

I was able to create a python program that could identify the golf ball by color and shape. I used trackbars with a range to dial in the color of the golf ball (green/yellow) in my case. I used a range to dial in the color because I was using two different cameras. One was a 1080p 60fps webcam, the other was a EPL high Speed camera that could run 1920X1080 MJPEG@ 60fps1280X720 MJPEG@ 120fps, 640X360MJPEG@ 260fps. I was able to sync the cameras at 640x360 at 80-90fps.

My next task was to detect the speed of the ball. I found this more challenging as I didn't find many helpful tutorials for detecting speed. My thought was to create two regions of interests (ROI), one around the tee and then another at some X distance away. In the first ROI it would detect that the ball was there and then track it and calculate the speed from the time it took to leave the first ROI and to enter the second ROI or from two points within the second ROI. I thought I might be able to calculate the launch angle using the ROI's as well. I wasn't able to get the speed or launch angle to actually work, my knowledge of the python and its extensive libraries is very limited (you could easily say I know nothing lol).

Instead of trying to track the ball logo, would it be easier to track the alignment line one the ball to calculate the ball spin? You could draw a black line long the longitude and latitude of the ball to get back spin and side spin (one from the side camera and one for the overhead). With the overhead you could also detect club path. You could even get swing speed.

There is one system out there call GSA Simulators that is able to do all of this however, I actually haven't been able to get it to work. I found his software clunky and it crashed a lot. Here is a link to his page on simulator theory. https://www.golf-simulators.com/GolfSimulatorTheory.html

Let me know what you think and if I might be able to help.

ParnoldAlmer commented 2 years ago

Hey I'm interested in contributing, we could interface with the gspro open api.

Moinster commented 2 years ago

I can see this being an easy open source add-on for putting with GSPro. Since it has an open API and putting doesn't require the same compute as a driver or something else high speed. Setting up the camera at a set distance from the ground and measuring the path of a ball sent through it seem doable. I'm not a coder myself but will download your project and see if I'm able to do anything to help.

natterman12 commented 2 years ago

I can see this being an easy open source add-on for putting with GSPro. Since it has an open API and putting doesn't require the same compute as a driver or something else high speed. Setting up the camera at a set distance from the ground and measuring the path of a ball sent through it seem doable. I'm not a coder myself but will download your project and see if I'm able to do anything to help.

Hi Moinster, I'm part of the GSPro community! Since trying to do my own thing I've bought an R10. Its been great so far but putting would be amazing. Shoot me a message on Discord if you want to talk about the putting thing, you can find me in the SGT Sim channel as Natter. I did some work before and I posted it in the R10 section.

Moinster commented 2 years ago

Awesome, I've got a skytrak myself and putting can be so hit or miss. I know mevo+ suffers the same. I've been busy in the course building discord, so I'll jump over to SGT and hit you up. My discord is the same username Ive got here.

ronheywood commented 2 years ago

Hi - I think putting mode will be the easiest part of the problem to solve, although the ball does still move quite quickly across the field of view so I really think hooking up a laser gate is the best way to kick the algorithm off to calculate velocity.

I'd be interested in seeing what input variables are required for GSPro - I'm guessing it needs ball speed and degrees off line for putting?

natterman12 commented 2 years ago

Hey there!

Yeah putting would be the easiest part to solve first. GSPro has an open API on their website somewhere and it tells you all in parameters it's looking for. But simply, ball spread and HLA ( horizontal launch angle/ degrees offline) is all that should be needed. If you head over to my GitHub page you can see where I started and left off on my try. Don't trust the speed as I know it's not calculated correctly lol.

On Thu, Feb 3, 2022, 3:34 AM ronheywood @.***> wrote:

Hi - I think putting mode will be the easiest part of the problem to solve, although the ball does still move quite quickly across the field of view so I really think hooking up a laser gate is the best way to kick the algorithm off to calculate velocity.

I'd be interested in seeing what input variables are required for GSPro - I'm guessing it needs ball speed and degrees off line for putting?

— Reply to this email directly, view it on GitHub https://github.com/ronheywood/opencv/issues/1#issuecomment-1028726941, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB6C6RORMJM6OH3NVFVYPDUZI43DANCNFSM5CMYVXVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

ParnoldAlmer commented 2 years ago

for putting you need ballspeed and HLA

Moinster commented 2 years ago

I started thinking about this further. For putting, CV may not be the way to go. I'm going to spin up a project and use two IR sensor strips to calculate ball speed and HLA. Having a know distance between where the ball starts and the first strip will make it possible to capture the HLA. It could be relevant to this project too as a way to capture club face angle and swing path. @ronheywood the laser gate idea really sparked me to think beyond using cameras. GSPro APi doc is here - https://gsprogolf.com/GSProConnectV1.html

ParnoldAlmer commented 2 years ago

Can we take this conversation to discord? What are your SGT usernames?

Moinster commented 2 years ago

Can we take this conversation to discord? What are your SGT usernames?

Monsterx on discord, I haven't joined the SGT yet as I've been spending more time building my local course for GSPro 🤣

ronheywood commented 2 years ago

I'm Garfvynneve on Discord also not in SGT

On Thu, 3 Feb 2022, 22:31 Moinster, @.***> wrote:

Can we take this conversation to discord? What are your SGT usernames?

Monsterx on discord, I haven't joined the SGT yet as I've been spending more time building my local course for GSPro 🤣

— Reply to this email directly, view it on GitHub https://github.com/ronheywood/opencv/issues/1#issuecomment-1029462676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM4EOJA4EWWP7YHEJBFKG3UZL64DANCNFSM5CMYVXVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

natterman12 commented 2 years ago

For the ones not on the SGT discord, can send your discord name and the

xxxx number. I will add you guys to a group chat.

On Fri, Feb 4, 2022 at 7:12 AM ronheywood @.***> wrote:

I'm Garfvynneve on Discord also not in SGT

On Thu, 3 Feb 2022, 22:31 Moinster, @.***> wrote:

Can we take this conversation to discord? What are your SGT usernames?

Monsterx on discord, I haven't joined the SGT yet as I've been spending more time building my local course for GSPro 🤣

— Reply to this email directly, view it on GitHub https://github.com/ronheywood/opencv/issues/1#issuecomment-1029462676, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAM4EOJA4EWWP7YHEJBFKG3UZL64DANCNFSM5CMYVXVQ

. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675

or Android < https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ronheywood/opencv/issues/1#issuecomment-1029932044, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB6C6XBG6KMYPPURYWX2UTUZO7BRANCNFSM5CMYVXVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

supershanesta commented 2 years ago

supershanesta#3425

natterman12 commented 2 years ago

Or join this server

https://discord.gg/aKNYsyt7Wx

On Fri, Feb 4, 2022, 12:55 PM supershanesta @.***> wrote:

supershanesta#3425

— Reply to this email directly, view it on GitHub https://github.com/ronheywood/opencv/issues/1#issuecomment-1030218359, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWB6C6TJWXQIPQZGADBAEYLUZQHHRANCNFSM5CMYVXVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>