Home > 13-Two-View-Geometry > Functions > get_image_window.m

get_image_window

PURPOSE ^

get_image_window: cuts image subwindow from large one at given position

SYNOPSIS ^

function [window,success] = get_image_window(Image,z,width)

DESCRIPTION ^

 get_image_window: cuts image subwindow from large one at given position

 [window,success] = get_image_window(Image,z,width)

 Wolfgang Förstner 2/2011
 wfoerstn@uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % get_image_window: cuts image subwindow from large one at given position
0002 %
0003 % [window,success] = get_image_window(Image,z,width)
0004 %
0005 % Wolfgang Förstner 2/2011
0006 % wfoerstn@uni-bonn.de
0007 
0008 function [window,success] = get_image_window(Image,z,width)
0009 
0010 [N,M,~]= size(Image);
0011 
0012 % width = odd
0013 hwidth = (width-1)/2;
0014 
0015 y = round(z(1));
0016 x = round(z(2));
0017 
0018 if x-width > 0 && y-width > 0 && x < N-width && y < M-width
0019     window = Image(x-hwidth:x+hwidth, y-hwidth:y+hwidth,:);
0020     success = 1;
0021 else
0022     success = 0;
0023     window  = 0;
0024 end

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005