
The things I'll be looking for are basically just a bunch of lines on the ground (like tennis or basketball courts), so the first step is to convert the original image into an array of line segments (i.e. pairs of points, (x1, y1) - (x2, y2)). In order to do that, the image is converted into gray-scale and 1st and 2nd derivatives of each horizontal and vertical line are taken:

Note that these images aren't really binary 0-or-1 images, it's just the way OpenCV shows them. Instead, each pixel is a floating-point number which is the value of the derivative in the corresponding point.
Now, I'm interested in thin bright lines (i.e. the court boundaries, usually made with white paint), so I need to find the spots where the 1st derivative is somewhat large and positive (which means that the brightness is growing rather fast, transitioning from the green/blue/gray background to the bright-white court boundary line), and the 2nd derivative is somewhat large (by modulus) and negative (which means it wants to make the 1st derivative smaller and eventually negative, for the transition back from the white line to the darker background). Simultaneously scanning the 1st and 2nd derivatives for such spots produces the following:

The left image is the result of scanning the horizontal derivatives, the right one - of the vertical derivatives. The horizontal derivatives are better for finding the vertical lines and vice versa, which is to be expected - e.g. in the extreme case, when horizontal derivatives are taken along a horizontal line, the brightness doesn't change, so there's no information to gain as both derivatives will be constant.
The next step is to build the actual lines: I first merge the neighboring pixels into little horizontal and vertical segments ("slices"). Then I start at one of those slices - let's say a horizontal one - and see if there's another one immediately underneath it, such as that the projection of one of the second one's ends falls within the first one. If there is such a slice, I connect the two slices' centers with a line and look further down, hoping to find a third slice, that attaches to the 2nd one. If there is one, I discard the line between the 1st and 2nd slices and now make a line between the 1st and the 3rd one, but check if the line still goes through the 2nd slice. The process continues until an intermediate slice is no longer crossed by the line being built - then the last line that goes through all intermediate slices is taken and added to the glorious array of lines.
Quite often there's a gap between slices, so that there's no slice immediately under the previous one. In this case, I look along the line built so far to see if there are good candidates further down. This allows to "mend" broken lines and makes for stronger, longer lines.
Side note: OpenCV has an implementation of the Canny algorithm, but it tends to make somewhat jagged lines, especially when working on Terraserver's images, which aren't very sharp (and not particularly new). Half-way into the project I've discovered that USGS has greater (and public domain) imagery, for which the Canny algorithm may work better, but this slices sorcery was already implemented by then, so why throw away a working thing.
There's also a Hough transform implementation for making lines out of pixels, but that didn't work quite well for me... Perhaps I need to play with it some more, although since this is a hobby project, it is more fun to make stuff up by myself.

Once I have the lines, the actual search begins: first I locate a pair of perpendicular line segments (L1, L2) that are close enough to each other to be a part of the model shape... I guess I haven't written about the model shapes yet, but it is basically a set of lines that make up what I want to find (e.g. 11 lines for a tennis court), with some of the corners marked as "key" points, which represent unique ways of applying the model shape to an intersection of two lines.
The model is rotated so that the lines adjacent to the "key" point are parallel to that pair of perpendicular lines (L1 and L2) I found in the previous paragraph and then moved to the intersection point of L1 and L2. Then for each of the model shape's lines I look for a "matching" line within the rest of the image. "Matching" means it is more or less parallel to the model shape's line (a leeway of pi/60 is allowed) and, to quote the code comment (yes! I do have comments there ;))
1. at least one of the shorter segment's ends is "within" the longer segment ("within" means the end's projection onto the longer segment lies within the segment)
2. distance(s) from the end(s) of the shorter segment that are "within" the longer segment to the longer segment are less than a threshold.
3. the shorter line's length is at least a certain portion of the longer one (like 40%)
If enough of the model shape's lines have a matching line in the image, then...

It's a match!
A few more things are done that I didn't describe - e.g. the array of lines is sorted by the the angle each line makes with abscissa (the x axis), so that just a little portion of the array will have to be traversed when looking for matches/perpendiculars. Also, to avoid false positives, I check how many lines fall completely within the model shape and if there are too many, the match is discarded. This happens quite often when processing ocean shots, where sun's reflection off the waves produces a lot of rather randomly-directed lines, so a "matching" line for the model shape's lines can almost always be found - something akin to "comb jamming", I guess.
The next thing I'd like to try is finding the basketball courts, which pose some unique challenges, because they:
a) are of very varying sizes (and I'm not talking about different standard sizes, like "high school" vs "NCAA" vs "NBA" - it would seem that quite often these courts are drawn to take the available space, so if there's no room to make it as long as it should be, then it's just made shorter)
b) contain circles
Circles are probably a blessing in disguise, because even though it is harder to look for them then for the straight lines, they seem to be of standard size mostly, at least the middle one and the half-circles on top of the free-throw line. I think what I need to do is to find a suitable rectangle that is between the "high school" and "NBA" standards in size and then see if there are appropriate (half)circles where they should be.
I also intend to make the source code available if anyone wants it, I just need to clean it up somewhat - mostly remove all the experimental stuff that just sits there unused.
Any thoughts on trying to use this to add features to OpenStreetMap, http://www.openstreetmap.org?
ReplyDeleteNice effort !!
ReplyDeleteVery nice! reminds me of captcha breaking :p
ReplyDeleteVery cool, I had no idea there were so many tennis courts around! Where do the mistakes come from? I spotted very few false positives (excluding cases where a single court was tagged multiple times) but a fair number of cases it misses (for example it only finds 2 of 10 or so courts in the sunnyvale municipal tennis center)
ReplyDeleteFor refinement purposes mitchell park in PA is a good case as it has an example of a court that was missed (it's a half sized kids court) and two that were double counted.
ReplyDeleteHi there,
ReplyDeleteI'm the tech lead at www.juump.com. We provide service for tennis lover (players, coaches, etc) to find each other to organize games & such.
Our tennis place info has geocode information, but a lot of the time the actual court location isn't at the address. I'd love to apply your technique here to correct our geocode location, resulting in a more precise poiter to where the courts actually are.
Your saying "make the code available" is music to my ears. How can I get it? It'll be used for a good cause of helping tennis players here in Vancouver (and the US soon, hopefully)
Thanks
- halhx
One thing that may interest you is that Washington, DC has a list of public tennis courts available free as KMZ/ESRI files: http://data.octo.dc.gov/ .
ReplyDeleteSee which ones you detect in the photos against a list of all courts might help you improve your algorithm.
視訊美女聊天KK俱樂部 -
ReplyDeleteUThome視訊聊天室 -
辣妹妹影音視訊聊天室 -
免費視訊辣妹 -
免費視訊173LiveShow -
視訊辣妹脫衣秀 -
免費觀看視訊辣妹脫衣秀 -
Love99影音聊天室 -
免費線上聊天室 -
MSN線上聊天室 -
UT線上聊天室 -
BBS線上聊天室 -
正妹無名相簿 -
無名相簿正妹照片 -
一夜情留言版 -
一夜情交友 -
交友影音部落格 -
成人影音部落格 -
影音視訊部落格 -
影音免費聊天室 -
一夜情成人聊天室 -
情色免費聊天室 -
成人免費聊天室 -
UT影音聊天室 -
176影音聊天室 -
KK影音聊天室 -
S383影音聊天室 -
UTHOME影音聊天室 -
免費成人圖片 -
熊貓成人貼片 -
線上交友網 -
美女免費貼圖 -
MSN聊天交友 -
免費AV女優下載 -
流行音樂試聽 -
情色貼圖貼片 -
AV女優情色圖片 -
情色影音聊天室 -
金瓶梅情色小站 -
真愛視訊聊天室 -
Everyone fastens where there is gain.........................................
ReplyDeletethx u very much, i learn a lot
ReplyDeletetake care yourself!! ^^ ........................................
ReplyDelete嘿,你的部落格不錯哦!........................................
ReplyDelete籃子打水空費力,經驗必需靈活用。......................................................
ReplyDeletethx u very much, i learn a lot
ReplyDelete知識可以傳授,智慧卻不行。每個人必須成為他自己。 ..................................................
ReplyDelete080人聊天室尋夢元聊天性愛性交性愛線上性愛線上看免費辣妹電影免費影片 go2v免費幹片免費貼影區免費貼影片區免費情愛片免費情電影免費情慾片免費淫蕩影片免費現上成人影片免費無碼片線上看免費無碼色片免費無碼站免費無碼做愛片免費短片區免費短片影片免費短片觀賞免費短影片免費影片18免費影片人片免費線上下載影片免費線上女優a片免費線上小電影免費線上分享免費線上成人片直播金瓶梅成人漫畫金瓶梅情色小說文學上班族聊天室成人遊戲
ReplyDelete性愛巴士線上看sex性愛85cc性愛紅爺性愛本土美女性愛銀赫歐美av線上歐美av線上看歐美女自慰歐美成人女星歐美成人片女星歐美成人免費線上歐美成人情色歐美色情圖貼歐美免費成人電影歐美免費成人影片觀看歐美免費自拍歐美免費做愛片歐美免費情色影片模特兒平台標題樣?嫚雪兒免費小說影片avi影片a直播影片下?影片分享fuck影片成人片影片成人免費影片收尋成人小說 言情小說 情色自拍漫畫貼圖
ReplyDeleteNever put both feet in your mouth at the same time, because then you will not have a leg to stand on. ....................................................
ReplyDelete天下沒有走不通的路,沒有克服不了的困難,沒有打不敗的敵人。........................................
ReplyDeleteyou have a good taste!............................................................
ReplyDeleteNever put off till tomorrow what may be done today...................................................................
ReplyDelete成熟,就是有能力適應生活中的模糊。....................................................................
ReplyDelete成熟,就是有能力適應生活中的模糊。.................................................................
ReplyDelete成熟,就是有能力適應生活中的模糊。.................................................................
ReplyDeleteHello~安安唷~很高興見到你哦!!............................................................
ReplyDeletePay somebody back in his own coin.............................................................
ReplyDeletePoverty is stranger to industry.............................................................
ReplyDelete看看blog調整心情,又要來繼續工作,大家加油..................................................................
ReplyDelete耐心是一株很苦的植物,但果實卻很甜美。.......................................................
ReplyDelete好看耶~一定每天有空給你支持............................................................
ReplyDelete你不能左右天氣,但你可以改變心情.................................................................
ReplyDelete所有的資產,在不被諒解時,都成了負債..................................................................
ReplyDelete很精彩的部落格 期待你的繼續加油..................................................
ReplyDelete時間就是塑造生命的材料。..................................................... ............
ReplyDelete生、死、窮、達,不易其操。......................................... ........................
ReplyDelete感謝分享 功德無量............................................................
ReplyDeleteGreat work! Did you ever make the source code available?
ReplyDeleteBest,
Dan
Hello,
ReplyDeleteYour blog provided us valuable information to work on. These images are quite nice. Thanks a lot for this site.
Dade County Tennis
Another smart thought that I suggest that you quick for one day seven days while you are on your health improvement plan, particularly in the event that you have an exceptionally bustling timetable and don't have room schedule-wise to rest amid the day.
ReplyDeletehttps://ideal-shops.com/
When you use a genuine service, you will be able to provide instructions, share materials and choose the formatting style. https://racquetsportshq.com/
ReplyDeletehttps://freeprosoftz.com/idm-crack-latest-version-serial-key/
ReplyDeletenice post
ReplyDeleteMiniTool Partition Wizard crack
Avast Premier Crack
ReplyDeleteBandicam Crack
VueScan Pro Crack
Hotspot Shield Elite Crack
Final Cut Pro Crack
Microsoft Flight Simulator Crack
EaseUS Todo Backup Crack
Avast SecureLine VPN Crack
DraftSight Crack
Sejda PDF Desktop Crack
Let's start! This is the best article I've ever read!
ReplyDeleteWhen I read your post, I returned to my cozy living room.
a friend of mine! He always took.
This is the article I'm going to send you.
I have no doubt it will be interesting to read. I appreciate you sharing this with us.
vmware workstation pro crack
autocad crack
advanced systemcare pro crack
corel videostudio crack
This great article has really peaked my interest.
ReplyDeleteNo errors were found during the check.
You can use it. I hope you like it.
fineprint crack
tweakbit driver updater crack
artlantis studio crack
movavi video converter premium crack
I'm impressed, to say the least. I've rarely come across a blog that's both educational and entertaining.
ReplyDeleteme just say that your performance was flawless
There are few men and women who are able to speak sensibly about a problem with their heads.
I couldn't be happier to have discovered myself on this journey.
There you go.
ashampoo burning studio crack
apowersoft video download capture crack
wintousb enterprise crack
microsoft office 2007 crack
On the Internet, I was happy to discover this installation.
ReplyDeleteIt was a wonderful read and I owe it to you at least once.
It touched my interest a little and you kindly kept it.
Become a fan of a new article on your site
bridgechecker crack
microsoft office 2016 crack
advanced systemcare ultimate crack
mixxx crack
Fantastic and useful information.
ReplyDeleteI'm glad to hear you're doing well.
Thanks for providing this useful information! Please keep us posted.
Here you go. Thanks for sharing.
driver booster pro license key
anydesk crack
driver booster pro crack
anydesk crack
This plan is stupid! Of course you know how to entertain the reader.
ReplyDeleteBetween your ease and your videos, it almost inspired me to start my own blog (well, almost ... ha ha!) Good job.
I liked what you said and, moreover, the way you presented it.
That's it!
adobe indesign crack
minitool partition wizard crack
guitar pro crack
sony vegas pro crack
Hello there, I just discovered your blog on Google, and I like it.
ReplyDeleteis quite useful. I'll keep an eye out for brussels sprouts.
If you keep doing this in the future, I will be grateful. A large number of people will profit.
based on your writing Cheers!
cyberduck crack
movavi slideshow maker crack
activatorwinrar crack
driver talent crack
I really like your site. Fantastic colors and themes.
ReplyDeleteDid you create this site yourself? Reply again because I hope to create my own
site itself and I would like to know where you have come to
it is here or where the item is named from.
Thank you!
vmware workstation 12 license key
stellar data recovery crack
windows 10 home crack
Cool Edit Pro Full Version Crack
ReplyDeleteBitdefender Total Security Key
BitTorrent Pro Crack
Anno 1800 Crack
Voicemod Pro Crack
Virtual DJ Studio Crack
IObit Software Updater Pro Crack
ESET Internet Security Crack
f1 crack
AnyToISO Crack
This is a large cup. On your website, keep up the good work.
ReplyDeleteYour blog has a lot of potential, and I look forward to exploring it further.
Thank you very much for your hard work. I'm going to go out and find it for myself.
It's something I'd suggest to others. They will, I am certain.
utilise this website
xsplit broadcaster crack
roundcube webmail crack
avast secureline vpn crack
shadow defender crack
pro tools crack
xilisoft video converter ultimate crack
daemon tools pro crack
winzip free download with crack
Your writing abilities are genuinely remarkable.
ReplyDeleteI also admire your writing abilities.
driver navigator crack
malware hunter crack
smadav pro crack
file viewer plus crack
On the Internet, I was happy to discover this installation.
ReplyDeleteIt was a wonderful read and I owe it to you at least once.
It touched my interest a little and you kindly kept it.
Become a fan of a new article on your site
asphalt 8 airborne crack
goldwave crack
auto tune pro crack
apowersoft video download capture crack
microsoft toolkit crack
adobe indesign crack
malwarebytes crack
just cause crack
Thank you so much for sharing this amazing information. Keep it up.
ReplyDeleteXenonauts 2 Crack
Dragon Ball FighterZ Crack
blufftitler ultimate crack
SnowRunner Crack
nice post
ReplyDeleteMiniTool Partition Wizard Crack
Unity Pro Crack
Ableton Live Crack
In the future, I want to avoid reading a blog article that has disappointed me so much that I won't even bother to open it.
ReplyDeleteIt was my choice to read, but I was hoping you might have something to say.
The only thing I hear from you, if you weren't thirsty for attention, is a scream for help over something that could easily be addressed.
inpixio photo focus crack
inpixio photo focus crack
spellforce 3 pc crack license key free download 2020
windows 7 activator
Oh my goodness! Impressive article dude! Thanks, However I am having troubles with your RSS. I don’t understand the reason why I am unable to join it. Is there anybody having the same RSS issues? Anyone that knows the answer will you kindly respond? Thanx!!
ReplyDeletehd video converter factory pro crack
3d tennis apk
bandlab cakewalk crack
windows 10 enterprise crack
any video downloader crack
cyberlink photodirector crack
billiards master apk cracked mod
I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot.I hope to have many more entries or so from you.
ReplyDeleteVery interesting blog.
xcrack.org
IDM Crack
TeamViewer Crack
I am very impressed with your post because this post is very beneficial for me and provide a new knowledge to me. this blog has detailed information, its much more to learn from your blog post.I would like to thank you for the effort you put into writing this page.
ReplyDeleteI also hope that you will be able to check the same high-quality content later.Good work with the hard work you have done I appreciate your work thanks for sharing it. It Is very Wounder Full Post.This article is very helpful, I wondered about this amazing article.. This is very informative.
“you are doing a great job, and give us up to dated information”.
designcoreldraw graphics crack
allavsoft video downloader crack
idm ultraedit crack
audials one platinum crack
opencloner ripper crack
Thank you so much for letting me express my feeling about your post.
ReplyDeleteYou write every blog post so well. Keep the hard work going and good luck.
Hope to see such beneficial post ahead to.
avg internet security crack
em client crack
wondershare recoverit crack
glasswire elite crack
aiseesoft video converter ultimate crack
I wonder if blogs use WYSIWYG editors or if you have to write your articles by hand.
ReplyDeleteHTML coding book required.
I start right away.
I want to create a blog soon, but I know nothing about coding, so I need some information.
from history to real life.
Thanks for all the help you can give.
enjoy good luck!
avg internet security crack
coreldraw graphics suite 2018 crack
auslogics boostspeed license key
icecream screen recorder crack
parallels desktop crack
Sincerely, I am so glad I found your site, I accidentally found you while searching on google
ReplyDeletefor something else, I am still here and I want to congratulate you on a nice post and
a nice blog all over (love the theme/design too),
I don't have time to watch anywhere in the minute, but I noticed and added
your RSS feeds, so if I have time, I will return to
read on, keep up the good work.
driver talent pro crack
sublime text crack
beyond compare crack
hide all ip crack
avast internet security crack
Fabulous Post
ReplyDeleteAutodesk 3ds Max Crack
MAGIX ACID Pro Crack
CCleaner Professional Crack
Thanks for posting the great article! It contains beautiful and useful messages. Cape-ups and lip work
ReplyDeletemastercam crack
vero alphacam crack
recore definitive edition crack
conan exiles crack
funbag fantasy crack
battle brothers crack
valkyria chronicles 4 crack
world war z crack
stellaris federations v2 7 1 crack
starsector v0 9 1a rc8 early access crack
Nice Post MEN
ReplyDeleteFL Studio 20 Crack ---------------------------------------
Filmora 11 Crack
AVG Internet Security Key
Nice Post MEN I really like your site. Fantastic colors and themes.
ReplyDeleteDid you create this site yourself? Reply again because I hope to create my own
site itself and I would like to know where you have come to
it is here or where the item is named from.
Thank you!
FL Studio 20 Crack ---------------------------------------
Filmora 11 Crack
AVG Internet Security Key
AVG Antivirus Crack
You can Also download cracked softwares for windows and mac's.Check my web pageidm crack
ReplyDeleteFoxit pdf editor cracked Amazing blog. I liked it. thanks for this.
ReplyDelete