Convert an image to pixel per row format
out = im2col(im) is a matrix (NxP) where each row represents a single of the image im (HxWxP). The pixels are in image column order (ie. column 1, column 2 etc) and there are N=WxH rows.
out = im2col(im, mask) as above but only includes pixels if:
Machine Vision Toolbox for MATLAB © 1990-2014 Peter Corke.