MATLAB: Is there any way to do an operator on a specific region

Image Processing Toolboxspecific region blockproce

Is there any way to do an operator on a specific region ?? for example I want to do imfill just on the Lower left quadrant of the page… I search and find blockproce but I could not do this for Lower left quadrant of the page??? thanks

Best Answer

Something like this would work.
[r,c]=size(BWImage);
rHalf=round(r/2);
cHalf=round(c/2);
lowerLeftQuadrant=BWImage(rHalf:r,1:cHalf);
lowerLeftQuadrant=imfill(lowerLeftQuadrant);
BWImage(rHalf:r,1:cHalf)= lowerLeftQuadrant;
Note that You can make the code shorter by replacing the last three lines of code as follow:
BWImage(rHalf:r,1:cHalf)= imfill( BWImage(rHalf:r,1:cHalf) );