Transparent Border Area - Opencv

asked 2014-05-23 00:45:23 -0500

Farrakh Javed gravatar image

Hi guys, I am merging two images, after merging foreground image have colored border which i don't want. I am using below code to merge background and foreground image.

public void overlayImage1(Mat background, Mat foreground,Mat output)//, Point location) { background.copyTo(output); Mat dst = new Mat(); Imgproc.resize(foreground, dst, background.size()); double alpha; for(int y = 0; y < background.rows() ; ++y) { for(int x = 0; x < background.cols() ; ++x) { double info[] = dst.get(y, x); alpha = info[3]; if(alpha>0) {
double infof[] = dst.get(y, x); output.put(y, x, infof); } } } }

Below is output image.image description

edit retag flag offensive close merge delete