Answer the question
In order to leave comments, you need to log in
How to automatically split an image into separate fragments?
Good afternoon.
There is a small color image and a set of patterns (the arrangement of a group of pixels). It is necessary to break the image into these patterns, so that each of them includes pixels of similar colors.
For example, there is such an image:
And such patterns:
I feed this image to the program and it says that the second pattern can be placed here like this: Ideally, with a large number of patterns, the program should split the entire image into them without
I don’t know what exactly I need to look for ? What algorithms, what is the name of the task? Has anyone had a similar problem and can you tell me how it's done?
Answer the question
In order to leave comments, you need to log in
It's like packing a backpack. With additional terms. You can see the algorithms for solving it.
Well, just in case - look at genetic algorithms.
To begin with, you can just think, and not look for a ready-made solution / algorithm. This is what the tasks are aimed at, why solve them at all if it all comes down to finding an algorithm?
"Similar colors" are those colors in which the RGB models are similar. Those. RGB(255, 0, 0) and RGB(150, 0, 0) are similar (the second shade of red is darker), RGB(255, 0, 0) and RGB(0, 255, 0) are opposite, the first red , the second is green.
The algorithm might look like this:
1. First create a map of blocks/rectangles/RGB models. It can be a banal enumeration of pixels.
2. Take the first block and check for "similarity" with the neighboring block.
3. Repeat the previous paragraph until you go around all the blocks with a similar color and make a figure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question