samedi 18 avril 2015

Border Interpolation using OpenCV on Android

I am trying to do some border interpolation using the below code and I am not seeing quite the interpolation working well.


Code:



Rect ROI = Rect(x, y, width, height);
addWeighted(OriginalImage(ROI), 0, ImageToAdd, 1, 0.0, OriginalImage(ROI));

SaveImage(OriginalImage, path);

int border=5;
Mat gray_canvas = imread(OriginalImage, 0);

Mat NewImage_buf(OriginalImage(ROI).rows + 10, OriginalImage(ROI).cols + 10, OriginalImage(ROI).depth());
Mat gray(gray_canvas, Rect(border, border,ImageToAdd.cols,ImageToAdd.rows));
cvtColor(ImageToAdd, gray, CV_RGB2GRAY);
copyMakeBorder(gray, NewImage_buf, border, border, border, border, BORDER_REPLICATE);

SaveImage(OriginalImage, path);


Basically what I am trying to do is, first adding an image to the original image at a certain location in the original image and saving this image. Then what I am trying to do is to do some border interpolation between the newly added image and the original image to minimize the difference between the color pixels of the two images at the border of the added image.


Do you have any suggestions how can I alter the code so that I can improve the interpolation? Any help is really appreciated.


Aucun commentaire:

Enregistrer un commentaire