Click here to Skip to main content
15,794,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I would like to write WinForms C# programm that contains rectangle pieces of image and use genetic algorithm to complete the puzzle. I think, we need to compare edge pixels of each piece to get best candidate to snap to a concrete piece, but I don't know how to do this. If anyone had same task or have any ideas how to do this, i will glad to khow.

What I have tried:

I have wrote programm that divides image into pieces, count rows and cols sets by user and than I got stuck on write algorithm.
Updated 19-Oct-20 22:14pm
Gerry Schmitz 19-Oct-20 18:57pm    
What if all the pieces are the same color? You need better "rules".
Sandeep Mewara 20-Oct-20 1:40am    
It would be good once you share your program - others can help extend. Use Improve Question to edit and update with what you have tried so far.

1 solution

This is not a trivial task to solve and a number of papers[^] have been written on this subject. The things they tend to have in common is that they start off with the assumption that they are dealing with computer vision processing, that any piece with a flat side must be an edge piece (if you're dealing with the traditional jigsaw form), and that a piece with two flat sides will be an edge. Part of the issue you are going to face is that you cannot guarantee what orientation each piece is, so you will also have to consider rotation when solving your code.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900