How to acccess each block after processing ?

Hello everyone, i want to perform split in several parts of an image using blockproc () and then i want to access these blocks to perform Box Counting Algorithm. If i use
I=~I2bw(I)
blockSize=64
T=blockproc(I, blockSize, @boxcountingmethod);
My response from Matlab is a matrix with BoxCounting applied on the full image, not on every block.
Also i need to store the results in a matrix. Thanks in advance.

 采纳的回答

Using MAT2TILES (Download),
Tcell=mat2tiles(I, blocksize*[1,1]);
result=cellfun(@boxcountingmethod, Tcell, 'uni',0);

6 个评论

Thanks a lot Mr., but the result is the same in every row
result =
Columns 1 through 5
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727] [1.55305545522727]
Columns 6 through 8
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
[1.55305545522727] [1.55305545522727] [1.55305545522727]
That's got nothing to do with me. Your @boxcountingmethod are producing those numbers.
Yes, this algorithm calculate Haussdorff Dimension on entire image. What i want is to divide image into blocks (i.e 64x64 )after that i need to perform in each block boxcounting. Hope you understand my question. The result may be a matrix with the values of BoxCounting not a cell array. Thanks in advance.
Yep. I've understood from the beginning. The code I gave you is applying your function boxcountingmethod() to every 64x64 block. Why this gives the same result for every block is not for me to say, because I didn't implement boxcountingmethod() nor do I have your input image. Rest assured however, it is being applied block-by-block.
If you want to convert the result to a matrix, you can use cell2mat,
result=cell2mat(result);
Constantin comented:
Thank you very much, I had a code problem. Now they are returning different values for each processed block.
You are quite welcome.

请先登录,再进行评论。

更多回答(0 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by