MATLAB: I am trying to divide a RGB image into 4*4 block.below program is not running.

digital image processingimage processingImage Processing Toolbox

the program is
function pd_repmt=repmat(n,d,k)
img=imread('F:\Images.jpg', 'jpg');
%block calculation
n=4; %block size
bs=[n n n];
it is givving this error
Maximum recursion limit of 500 reached. Use
to change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.
Error in ==> imformats>find_in_registry
Error using ==> rdivide
Matrix dimensions must agree.
Error in ==> repmat at 7
how to correct it??

Best Answer

  • first off i would highly recommend that you do not call your function repmat() as it is already a matlab function. in the line a_bl= matcell() is the repmat that you're calling in the line the same repmat function that it resides? At this point it looks like its a call within a call within a call within a call within a call. Without running the function, it looks to be never ending loop.
    However, put a breakpoint at line 7. See what the dimensions are.