arrayToDims

PURPOSE ^

Pads or crops I appropriately so that size(IC)==dims.

SYNOPSIS ^

function IC = arrayToDims( I, dims, padEl )

DESCRIPTION ^

 Pads or crops I appropriately so that size(IC)==dims.

 For each dimension d, if size(I,d) is larger then dims(d) then
 symmetrically crops along d (if cropping amount is odd crops one more
 unit from the start of the dimension).  If size(I,d) is smaller then
 dims(d) then symmetrically pads along d with padEl (if padding amount is
 even then pads one more unit along the start of the dimension).

 USAGE
  IC = arrayToDims( I, dims, [padEl] )

 INPUTS
  I         - n dim array to crop window from (for arrays can only crop)
  dims      - dimensions to make I
  padEl     - [0] element with which to pad

 OUTPUTS
  IC        - cropped array

 EXAMPLE
  I=randn(10); delta=1; IC=arrayToDims(I,size(I)-2*delta);

 See also ARRAYCROP, PADARRAY

 Piotr's Computer Vision Matlab Toolbox      Version 2.0
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]

Generated by m2html © 2003