[ACCEPTED]-Detect an object in a camera image in C#-edge-detection

Accepted answer
Score: 10

use the free AForge.Net image processing library for 2 this. there's a ton of cool stuff to play 1 with.

Score: 3

You need to perform filters operation and 7 masks on image.

I think there are no simple ways to just fetch object from 6 the image, you need to use edge-detection 5 algorithms, clipping, and set the criteria 4 for valid objects/image.

You can also use 3 image thresholding to detect object. You 2 may want to look at below Image processing 1 library.

  1. Filters API for C, C++, C#, Visual Basic .NET, Delphi, Python
  2. http://www.catenary.com/
  3. CIMG richer than above library however it is written in C++
Score: 1

One of the (I guess many possible) approaches:

  1. Find 9 a filter that "gets/calculates" straight 8 lines (edges, etc.) from a given image.

  2. Now 7 you have the collection (array) of all the 6 lines (xStart,yStart & xEnd,yEnd). You 5 can easily calculate all the line-lengths 4 from the coordinates.

  3. Now, considering that you can always (!) expect "one-biggest-square / rectangle" inside the image, it would be quite easy to find and calculate the wanted-sudoku-rectangle region and crop it from the image to do some further processing.

EDIT: Solving/programming 3 that kind of problems is always challenging 2 BUT really interesting at the same time 1 :).

Score: 1

You could try first to find the bold line 7 intersections and use them as registration 6 marks.

This would be a good start because:

  • They're pretty uniformly shaped
  • You know how many there are
  • You know where (roughly) they should be in relation to each other
  • Can tolerate scale variations

So:

  1. Apply an edge filter
  2. Scan a mask* of what the ideal + should look like across the image, recording all that are a good match
  3. Choose the set that matches your expectations best, according to location relative to one another
  4. You now also know where the numbers should be, so you can easily extract them.

* A 5 more sophisticated solution would be to 4 use a Neural Net instead of a mask to recognise 3 the intersections. This might be worth it 2 since your're probably going to use one 1 for the OCR of the numbers.

Score: 1

You might try using the Hough Transform.

0

Score: 1

I would start by using a corner detector 27 (The Harris detector works nice) to find 26 the intersections and corners of the sudoku 25 grid.

Then I would use those points to do 24 an image rectification to transform the 23 image to have the grid as rectangular as 22 possible. Now you should have no trouble 21 finding each square to do OCR.

Image rectification 20 is not simple and entails quite a lot of 19 math.

Be prepared to do some reading :)

If 18 the images of the game boards are already 17 close to rectangular you can of course skip 16 the rectification part and directly use 15 the corner points to find your squares for 14 OCR.

A lot of people have been suggesting 13 to use Neural Networks. I am quite certain 12 that throwing a neural network on this problem 11 is totally unneccessary. NNs are (sometimes) good 10 if you need to classify objects where the 9 definition of the object is vague. "Find 8 cars in image" is a problem which could 7 have use for a Neural Network since cars 6 can look very different but have some features 5 the same. Thus, given enough data, you can 4 train your NN to detect cars. In this problem 3 you have something that is very regular 2 and always looks almost the same, so a NN 1 will not make anything easier or better.

Score: 1

Without rejecting any of the other ideas, step 9 1 really should be the detection of the 8 image rotation. You can do this by determining 7 the local gradient at each point and creating 6 a histogram thereof. This will have 4 major 5 components at 90 degree offsets. Ideally, these 4 would be 0, 90, 180 and 270 but if they're 3 not you should rotate your image. E.g. in 2 the sample image you should start with a 1 rotation over about 8 degrees CW.

Score: 1

Use aforge colorfiltering

There are many filtering method provided 3 for c#, mainly I prefer aforge filters, for 2 this purpose they have few filters, they 1 are

* ColorFiltering
* ChannelFiltering
* HSLFiltering
* YCbCrFiltering
* EuclideanColorFiltering

See here

Score: 1

Take a look at: https://github.com/dajuric/accord-net-extensions

The library "joins" the 3 free AForge.NET and Accord.NET library and 2 adds image-processing and object tracking-algorithms. Samples 1 included :)

Score: 0

You should google for CamShift or Blob tracking or Particle filters. They are 4 all usefull for your problem. And most of 3 them are shipped with OpenCV and it's C# wrapper 2 AForge.NET. You will find some nice demos 1 on Youtube showing how they work.

Good luck

More Related questions