0

picture example

I have recently started learning Python with Spyder IDE and I'm a bit lost so I ask for advice.

The thing is that I need to program an algorithm that, given a random image representing a board with black spots in it (in the picture I upload It is a 4x5 board) so It recognizes the edges properly and draw a AxB grid on it. I also need to save each cell separately so as to work with them.

I know that open CV treat images and I have even tried auto_canny but I don't really know how to solve this problem. Can anybody give me some indications please?

1 Answers1

0

as I understand from your question you need to have as an output the grid of the matrix in your picture (eg. 4x3) and each cell as separate image.

This is the way I would approach this problem:

  1. Use canny + corner detection to get the intersection of the lines
  2. With the coordinates of the corners you can form your regions of interest, crop each individually and save it as a new image
  3. For the grid you can check the X's and the Y's of the coordinates, for example you will have something like: ((50, 30), (50,35),(50,40)) and from this you can tell that there are 3 points on the horizontal axis. I would encourage you to set a error margin as the points might not be all on the same coordinate, but may not differ a lot.

Good luck!

razvanv
  • 53
  • 6