tennis-court-detection
tennis-court-detection copied to clipboard
Sharing my experience with a windows laptop
tl;dr: with some changes, this project still work in 2022. However the speed is not impressive, especially given there are solutions like YOLO which may be much faster.
Before I start, I have a windows laptop with core i5 1035g.
I tried using anaconda + conan + cmake, I gave up because I couldn't make cmake/gcc work correctly. In fact, I wish I had a linux machine to start with.
I switched to visual studio for compilation. It worked.
Things I changed:
- Created a profile in conan with detection.
- Need to place conan generated files to VS folder.
conan install . -if=C:\Users\user\...\build\x64-Release
- opencv version changed to 3.4.17, which is available in conan.
- CourtLinePixelDetector.cpp:filterLinePixels, changed at
<float>
toat<Vec2f>(0,0)[0]
andat<Vec2f>(0,0)[1]
- CourtLineCandidateDetector::getRefinedParameters changed
X.at<float>(0,i)
toX.at<float>(i,0)
What I got:
- Court detection works, even on clay court
- Accuracy seems a bit low. I can see the physical line not overlapping with the drawn line
- Speed is extremely slow on my laptop. 30s with power and 2min without power on a single 720p frame.
Video properties (frames: 272, w: 1280, h: 720, fps: 29) Reading frame with index 136 Starting court line detection algorithm... getLuminanceChannel 55.0567 ms detectLinePixels 61.3653 ms filterLinePixels 2149.21 ms CourtLinePixelDetector::run 2270.32 ms After binaryImage. getRefinedParameters 467.52 ms removeDuplicateLines 0.709 ms getRefinedParameters 494.985 ms removeDuplicateLines 1.4295 ms getRefinedParameters 429.952 ms removeDuplicateLines 1.1865 ms getRefinedParameters 431.008 ms removeDuplicateLines 1.3693 ms getRefinedParameters 430.741 ms removeDuplicateLines 1.1077 ms CourtLineCandidateDetector::run 2297.78 ms After candidateLines findBestModelFit 25178.5 ms TennisCourtFitter::run 25181.2 ms LineDetection 29755.4 ms Elapsed time: 29s.