python 3.x - Skimage Python33 Canny -


long story short, i'm trying canny edged image of image.jpg.

the documentation spotty i'm getting confused. if can that'd appreciated.

from scipy import misc import numpy np skimage import data skimage import feature skimage import io   im=misc.imread('image1.jpg') edges1 = feature.canny(im) ... 

and i'm getting error

valueerror: parameter `image` must 2-dimensional array 

can explain how create 2d array image file? thanks!

i suspect image1.jpg color image, im 3d, shape (num_rows, num_cols, num_color_channels). 1 option tell imread flatten image 2d array giving argument flatten=true:

im = misc.imread('image1.jpg', flatten=true) 

or apply canny 1 of color channels, e.g.

im = misc.imread('image1.jpg') red_edges = feature.canny(im[:, :, 0]) 

Comments