Hello. Engaged in the development of service for the selection of colors for the paint company. Need to repaint the image of the house inside and out.
To repaint the image using multiple canvas. One canvas - the original image and one for each element (for example for the floor, walls, windows, care, etc.) on this canvas is located only part of the image.
Currently developed such an algorithm:
- We translate the color in which you want to repaint in HSV.
- I take each pixel to the canvas on which a part of the image is located and write the number of βVβ * 100 values ββto the object (in order to round it off and get statistics).
- After the previous step, I get an object that contains the number of occurrences of the βVβ values. I find the maximum value in this object - thus I get the main color of the image.
- I repaint each pixel of a part of the image using βHβ and βSβ from step 1, and get βVβ by the formula (V of step 1 + (V of the original image pixel β V maximum in the part of the image)).
There are several problems in my algorithm:
- If the image is not monotonous, then it may turn out that the βVβ parameter found in step 3 is not quite the main color of the image due to the fact that there may be several maxima (a good example of a parquet is that light and dark colors are mixed there) - for example V = 10 and V = 90 and 10 is slightly more than 90 and then the output image is faded.
- If we repaint for example white, and V = 10, then the texture is very light and vice versa, if the texture is very dark, then the output is black.
At the moment, I set the parameter from 3 points to manual, but I donβt like the selection.
If you have a desire to help with the algorithm, stretch your brains or just suggest a working solution I will be glad to discuss.
Example code: http://kvil.goodsol10.tmweb.ru/repair-school/color-service/color/Test2.php
I can not insert it because of restrictions. There you can see how the image is repainted in purple. The problem area is the baseboard and floor. The problem is that with proper repainting the color of the baseboard and the floor should be more saturated.