November 2018
Intermediate to advanced
492 pages
12h 19m
English
In the earlier example, the magnitude and direction of the edges were shown in different images. We can create an RGB image and set the R, G, and B values as follows to display both magnitude and direction in the same image:

With the same code as in the last example, we only replace the right bottom subplot code with the following code:
im = np.zeros((im.shape[0],im.shape[1],3))im[...,0] = im_mag*np.sin(im_ang)im[...,1] = im_mag*np.cos(im_ang)pylab.title(r'||grad||+$\theta$', size=30), pylab.imshow(im), pylab.axis('off')
And then, using a tiger image instead, we get the output shown ...
Read now
Unlock full access