Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

change colour of canny output

I have a small script to visualise focus on an image, and very happy with the result but I want to be able to change the highlighted edges (currently white) to a different colour before overlaying on to the original image. My (cut-and-paste) code below, please help.

import cv2
import numpy as np
import matplotlib.pyplot as plot

im = cv2.imread('tests.jpg',0)
im2 = cv2.imread('tests.jpg')
edges = cv2.Canny(im,100,200)
out = np.bitwise_or(im2, edges[:,:,np.newaxis])
implot = plot.imshow(cv2.cvtColor(out, cv2.COLOR_BGR2RGB))
plot.show()

Thanks in advance