getPatch; matlab function to get a patch from a matrix
function mat = getPatch(srcMat, rect) %function getPatch(srcMat, rect) %rect is [x y width height] stX = max(rect(1),1);stY = max(rect(2),1); endX = min(rect(1)+rect(3)-1, size(srcMat,1));endY = min(rect(2)+rect(4)-1, size(srcMat,2)); mat = srcMat(stY:endY, stX:endX);
Advertisement
Categories: code, matlab, matlab Code
code, matlab