improc: ass2 draw border around affine transformed region in original image.

parent 2393aae2
from interpolation import pv from interpolation import pv
from pylab import array, matrix, zeros, show from pylab import array, matrix, zeros, show, subplot, plot, figure
from numpy.linalg import lstsq, inv from numpy.linalg import lstsq
# url: http://www.leptonica.com/affine.html # url: http://www.leptonica.com/affine.html
...@@ -56,5 +56,12 @@ if __name__ == '__main__': ...@@ -56,5 +56,12 @@ if __name__ == '__main__':
result = affine_transform(image, (0., half_height), (half_width, 0.), result = affine_transform(image, (0., half_height), (half_width, 0.),
(image.shape[0], half_height), 128, 128) (image.shape[0], half_height), 128, 128)
figure(1)
subplot(121)
x = [0, half_width, image.shape[0], half_width, 0]
y = [half_height, 0, half_height, image.shape[1], half_height]
plot(x, y, '-')
imshow(image, cmap='gray')
subplot(122)
imshow(result, cmap='gray') imshow(result, cmap='gray')
show() show()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment