I am using Python with PIL and SciPy. I want to capture an image from a webcam and then process it using numpy and Scipy. Can someone please help me with the code.
Here the code is the predefined image "lena", but I want to use my own captured image instead of the image "lena". What changes have I made to the code?
from scipy import misc lena = misc.lena() lx, ly = lena.shape import matplotlib.pyplot as plt crop_lena = lena[lx / 4: - lx / 4, ly / 4: - ly / 4] plt.imshow(crop_lena)
Another example
import scipy from scipy import ndimage import matplotlib.pyplot as plt import numpy as np l = scipy.misc.lena() plt.figure(figsize=(10, 3.6)) plt.subplot(131) plt.imshow(l, cmap=plt.cm.gray) plt.show()
source share