i am trying to divide a RGB image into 4*4 block.below program is not running.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
pritha Das
am 6 Mai 2015
Kommentiert: Walter Roberson
am 8 Mai 2015
the program is
function pd_repmt=repmat(n,d,k)
img=imread('F:\Images.jpg', 'jpg');
s=size(img);
%block calculation
n=4; %block size
bs=[n n n];
nb=s./bs;
a_bl=mat2cell(img,repmat(bs(1),1,nb(1)),repmat(bs(2),1,nb(2)));
celldisp(a_bl);
pd_repmt=a_bl;
end
it is givving this error
Maximum recursion limit of 500 reached. Use
set(0,'RecursionLimit',N)
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
or
Error using ==> rdivide
Matrix dimensions must agree.
Error in ==> repmat at 7
nb=s./bs;
how to correct it??
3 Kommentare
Joseph Cheng
am 6 Mai 2015
Bearbeitet: Joseph Cheng
am 6 Mai 2015
did i? I try to keep things as comments unless i test out the problem or have a really good explanation. I didn't have the time at the moment to fully debug it but saw a clear issue if the code was able to run 1 step further. Besides who does it for the points anyways its disheartening to even attempt to catch up. Only foreseeable way is to start answering people's homework for the number of doitforme questions.
Walter Roberson
am 6 Mai 2015
By making your comment into an answer, it can be Accepted, which marks the question as solved.
Akzeptierte Antwort
Joseph Cheng
am 6 Mai 2015
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.
2 Kommentare
Walter Roberson
am 8 Mai 2015
That tells me that you continued to call your routine "repmat". You need to rename it.
Your code is also attempting to divide into blocks of 4 along the color axis (RGB), the third dimension, but there are only 3 planes there.
Weitere Antworten (1)
Image Analyst
am 6 Mai 2015
Try some code that works, like the two samples in the FAQ for dividing your image into blocks. http://matlab.wikia.com/wiki/FAQ#How_do_I_split_an_image_into_non-overlapping_blocks.3F
If you want to process the blocks as you move along, then you'd be best off calling blockproc(). I can attach examples of blockproc() if you request them.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!