Question

I am working in a android project where in i have to change the color of the wall. For e.x if I take a picture of the wall having corners and select some color say blue. The color of the wall should change in such a way that the wall looks as if it is painted with that color. I mean to say that the shades at the corners of the wall should be retained after changing the color. Wall should not look like painted like flat rectangle.

Please let me know the way to do it.

Thanks in advance. Regards

OTHER TIPS

Here is something I did for getting it done:

public static Bitmap changeImageColor(Bitmap srcBmp, int dstColor) {

    int width = srcBmp.getWidth();
    int height = srcBmp.getHeight();

    float srcHSV[] = new float[3];
    float dstHSV[] = new float[3];

    Bitmap dstBitmap = Bitmap.createBitmap(width, height, Config.RGB_565);

    for (int row = 0; row < height; row++) {
        for (int col = 0; col < width; col++) {
            Color.colorToHSV(srcBmp.getPixel(col, row), srcHSV);
            Color.colorToHSV(dstColor, dstHSV);

            // If it area to be painted set only value of original image
            dstHSV[2] = srcHSV[2];  // value

            dstBitmap.setPixel(col, row, Color.HSVToColor(dstHSV));
        }
    }

    return dstBitmap;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top