This demo shows the basic operations of the v4 computer vision python interface
from numpy import *
from v4 import vx
x = vx.Vx("int16", [0, 6, 0, 4],1)
x.i[0][2] = 10
x.i[1][1] = 10
x.i[2][2] = 20
x.i[3][3] = 30
print x.i
The basc VX image class may be created either from a v4 file or explicity as shown above. The structure element .i is the image data in a numpy array. x also contains the image metadata.
kern = ones((3,3));
print kern;
from scipy import ndimage
res = ndimage.convolve(x.i, kern, mode='constant', cval=0.0)
print res;
import matplotlib.pyplot as plt
import matplotlib.cm as cm
plt.imshow(res, origin='lower', cmap=cm.gray);