Please help me soon with this! Thanks a ton!
I need to divide an image of size 72×72 into 64 blocks of size 9×9 each. Then, I need to perform some sort of processing on each block by accessing each value within each block. Should I use blockproc or mat2cell? How do I access each element within a block? If I use blockproc, how do I use the third parameter to create my own function that will be called for each block?
The following code threw this error
??? Cell contents reference from a non-cell array object.
Error in ==> module2 at 21 x=myCell{1,1}{j,k};
[final_img]=module1;myCell = mat2cell(final_img,[9 9 9 9 9 9 9 9], [9 9 9 9 9 9 9 9]);% C={myCell};
y=1; %initial previous value
w=1;o=1; %o-output vector index
p=1;rx = zeros(64,1);ry = zeros(64,1);rx(1)=0;ry(1)=0;for i=1:8 for l=1:8 [m,n]=size(myCell{1,1}); %m-rows n-column m=n=9
for j=1:m for k=1:n x=myCell{1,1}{j,k}; z=myCell{1,1}{k,j}; if x~=y %compare with previous value
rx(o)=rx(o)+1; %horizontalcount++
end if z~=w ry(p)=ry(p)+1; %verticalcount++
end y=x; w=z; end end end o=o+1; p=p+1; end
So, how do I get the value of x and z?
Best Answer