H
H
HaruAtari2016-01-12 16:48:57
Images
HaruAtari, 2016-01-12 16:48:57

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: 451f6333d2ca4c68b793c5ac20a71ab9.jpg
And such patterns: a70d67f474fd4f0ea95404b47adfdaa6.jpge26f5d4c9ca84b28b8a740a2348b170e.jpg2145c9c2d0844648a4b58b3c84ccb398.jpg
I feed this image to the program and it says that the second pattern can be placed here like this: d9c944a473994982910e492cb8a0a552.jpgIdeally, 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

3 answer(s)
G
GavriKos, 2016-01-12
@GavriKos

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.

F
FoxInSox, 2016-01-12
@FoxInSox

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.

V
Vasily, 2016-01-12
@Foolleren

reminded
habrahabr.ru/post/274527

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question