Change of part of the picture on canvas
-
Got it. https://colorup.tikkurila.com/index.html#/l/ru/6/8/photo/37 A color selection for an interrier and an exterrier. It selects the image and can repaint the part of the image into the chosen color.
I'm doing this job. I wanted to put the SVG under the texture, but without the arrangement, it doesn't look good.
There are several layers on the service:
- A layer with a basic image, it's slightly light, with transparency.
- A layer from a masculine object, originally a black mask
Coupled in the code, and about the next algorithm.
- The user chooses color to paint the object.
- Set up a list of non-transparent picks (by mask)
- Cyclome on each picsel of the basic image and fit the colour of the picsel of the basic image the colour chosen for the transposition.
- Remaining from the previous point in canvas with the mask
Algorithm's not hard, but maybe I forgot a function or missed a simpler option.
-
To date has developed such an algorithm:
- We'll translate the color to which we need to paint in HSV.
- I take every pixel in the canvas where the part is located. Figures and number of values of " V " * 100 per facility (for To round up and get the statistics.
- After the previous step, receive the facility Number of entries of " V " values. I find the maximum value This object the main color of the image.
- Removing each picsel of the part of the image using H and S step 1, and " V " received by formula (V step 1 + (V peaks) Original image - V maximum in the picture).