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.

    1. The user chooses color to paint the object.
    2. Set up a list of non-transparent picks (by mask)
    3. 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.
    4. 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:

    1. We'll translate the color to which we need to paint in HSV.
    2. 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.
    3. 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.
    4. 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).



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2