detect and wall and change wall color in android similar to colorsnap and asian paints app

//  Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.splashscreen);
          //  IplImage image = IplImage.create(bm.getWidth(), bm.getHeight(),IPL_DEPTH_8U, 4);
        IplImage image = cvLoadImage("/Users/nileshsatpute/Documents/OpenCv-for-Android-Color-Detection/app/src/main/res/drawable/splashscreen.png");
            CvSize cvSize = cvGetSize(image);
            IplImage hsvImage = cvCreateImage(cvSize, image.depth(), image.nChannels());
            IplImage hChannel = cvCreateImage(cvSize, image.depth(), 1);
            IplImage sChannel = cvCreateImage(cvSize, image.depth(), 1);
            IplImage vChannel = cvCreateImage(cvSize, image.depth(), 1);
            cvSplit(hsvImage, hChannel, sChannel, vChannel, null);
            IplImage cvInRange = cvCreateImage(cvSize, image.depth(), 1);
            CvScalar source = new CvScalar(72 / 2, 0.07 * 255, 66, 0); //source color to replace
            CvScalar from = getScaler(source, false);
            CvScalar to = getScaler(source, true);
            cvInRangeS(hsvImage, from, to, cvInRange);
            IplImage dest = cvCreateImage(cvSize, image.depth(), image.nChannels());
            IplImage temp = cvCreateImage(cvSize, IPL_DEPTH_8U, 2);
            cvMerge(hChannel, sChannel, null, null, temp);
            cvSet(temp, new opencv_core.CvScalar(45, 255, 0, 0), cvInRange);// destination hue and sat
            cvSplit(temp, hChannel, sChannel, null, null);
            cvMerge(hChannel, sChannel, vChannel, null, dest);
            cvCvtColor(dest, dest, CV_HSV2BGR);
            cvSaveImage("output.png", dest);