Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can blend the two images with addweighted() function

you can blend the two images with addweighted() functionfunction. But what is your goal and why you want to do that?

you can blend the two images with addweighted() function. function or you can just apply something like src += canny_image; but you will need first convert your canny image to bgr. But what is your goal and why you want to do that?

you can blend the two images with addweighted() function or you can just apply something like src += canny_image; but you will need first convert your canny image to bgr. But what is your goal and why you want to do that?

Mat dst, detected_edges;
Canny( gray, detected_edges, 30, 100, 3 );

imshow("canny", detected_edges);

dst = Scalar::all(0);

Mat addweight;
src.copyTo( dst, detected_edges); // copy part of src image according the canny output, canny is used as mask
cvtColor(detected_edges, detected_edges, CV_GRAY2BGR); // convert canny image to bgr
addWeighted( src, 0.5, detected_edges, 0.5, 0.0, addweight); // blend src image with canny image
src += detected_edges; // add src image with canny image

imshow("addition", src );
imshow("copyTo", dst );
imshow("addwweighted", addweight );
waitkey();

source:

image description

addition:

image description

copyTo:

image description

addweighted:

image description

you can blend the two images with addweighted() function or you can just apply something like src += canny_image; but you will need first convert your canny image to bgr. But what is your goal and why you want to do that?

Mat dst, detected_edges;
Canny( gray, detected_edges, 30, 100, 3 );

imshow("canny", detected_edges);

dst = Scalar::all(0);

Mat addweight;
src.copyTo( dst, detected_edges); // copy part of src image according the canny output, canny is used as mask
cvtColor(detected_edges, detected_edges, CV_GRAY2BGR); // convert canny image to bgr
addWeighted( src, 0.5, detected_edges, 0.5, 0.0, addweight); // blend src image with canny image
src += detected_edges; // add src image with canny image

imshow("addition", src );
imshow("copyTo", dst );
imshow("addwweighted", addweight );
waitkey();

source:

image description

canny:

image description

addition:

image description

copyTo:

image description

addweighted:

image description

you can blend the two images with addweighted() function or you can just apply something like src += canny_image; but you will need first convert your canny image to bgr. But what is your goal and why you want to do that?

Mat dst, detected_edges;
Canny( gray, detected_edges, 30, 100, 3 );

imshow("canny", detected_edges);

dst = Scalar::all(0);

Mat addweight;
src.copyTo( dst, detected_edges); // copy part of src image according the canny output, canny is used as mask
cvtColor(detected_edges, detected_edges, CV_GRAY2BGR); // convert canny image to bgr
addWeighted( src, 0.5, detected_edges, 0.5, 0.0, addweight); // blend src image with canny image
src += detected_edges; // add src image with canny image

imshow("addition", src );
imshow("copyTo", dst );
imshow("addwweighted", addweight );
waitkey();

source:

image description

canny:

image description

addition:

image description

copyTo:

image description

addweighted:

image description