There are several ways to apply the Canny filter to an RGB image. (I assume this is an RGB image?)
There are many ways to convert a multi-component image to a scalar image. A simple listing is not defined. This may mean brightness, vector magnitude, etc.
One option is to run the algorithm independently on each channel of the image and get an image with a red edge, an image with a blue edge and an image with a green edge. Here are a few pseudo codes:
for i in range(rgbimage.GetNumberOfComponentsPerPixel()): component_image = sitk.VectorIndexSelectionCast(rgbimage, i, sitk.sitkFloat32) edge_images[i] = sitk.CanneyEdgeDetection(component_image) edge_image = sitk.Compose(edge_images)
Alternatively, you may need a scalar edge image. You can get brightness, brightness or brightness through RGB channels, and then run the Canny filter only once.
source share