Showing posts with label Geometric transform on an object. Show all posts
Showing posts with label Geometric transform on an object. Show all posts

Tuesday, 26 August 2014

Geometric transform on an object

 htrans2 = vision.GeometricTransformer;
 img2 = checker_board(20,10);
 tfMat=[1      0     -15*2     0      1      15*2; ...
        0.4082 0      15*2    -0.4082 1.0204 35*2; ...
        1     -0.4082 5.4082*2 0      0.4082 44.5918*2]';

 polyROI  = [50  0 50 49 99 49 99 0; ...
              0  0  0 49 49 49 49 0; ...
             50 50 50 99 99 99 99 50]' * 2;

 htrans2.BackgroundFillValue = [0.5 0.5 0.75];
 htrans2.ROIInputPort = true;
 htrans2.ROIShape = 'Polygon ROI';
 transimg2 = step(htrans2,img2,tfMat,polyROI);
 imshow(img2);
 figure;imshow(transimg2);