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.

 Risposta accettata

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

6 Commenti

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.
Constantin Alin
Constantin Alin il 10 Mag 2018
Modificato: Constantin Alin il 10 Mag 2018
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.
Matt J
Matt J il 10 Mag 2018
Modificato: Matt J il 10 Mag 2018
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.

Accedi per commentare.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by