back
2 comments
FYI I tried building something similar running completely client-side a little while ago; I did not get very far TBH: http://users.telenet.be/bull/sudoku/ As for solving the sudoku: that's the easy part: https://github.com/ToJans/learninghaskell/blob/master/0003Su...
Nice!

Yeah, I am using Vision's rectangle detection.. but it's really touchy. I've got a lot of heuristics in there to throw out bad results and smooth things out.

It doesn't do well if there's something near the puzzle though (like a horizontal rule or text like you might see in a newspaper layout).

Any suggestions on a better way to segment the rectangles? Or any preprocessing tips (I couldn't really find anything that made it detect things more reliably)

I've got a very old and slightly broken blog post on what I was doing:

https://www.cmgresearch.com/2009/08/14/How-does-it-all-work....

My approach was to adaptive threshold the image and then assume that that the object of interest was the biggest connected region in the image. Then run that though rectangle detection.

Have you tried setting the aspect ratio and minimum width on the Vision rectangle detector? That might filter out any nonsense.

The parameters are not very well documented. (Or at least it wasn't when I was coding that part). But yeah I did get those set finally.

Whatever I do though I can't get it to recognize any rectangles here: http://www.telegraph.co.uk/news/science/science-news/9359579...

For our demo video we ended up photoshopping out the horizontal line right above it and that seemed to work.

Just tried it on my old app and it worked well :)

I think you'll have to roll your own rectangle detection and use heuristics to make it better.

So in mine I assume that the connected object in the thresholded image with the largest number of pixels must be the puzzle. That makes it a lot easier.

Good luck!

Cool I'll put that on my todo list. Thanks!