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.

 Akzeptierte Antwort

Matt J
Matt J am 9 Mai 2018

0 Stimmen

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

6 Kommentare

Constantin Alin
Constantin Alin am 10 Mai 2018
Bearbeitet: Constantin Alin am 10 Mai 2018
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]
Matt J
Matt J am 10 Mai 2018
That's got nothing to do with me. Your @boxcountingmethod are producing those numbers.
Constantin Alin
Constantin Alin am 10 Mai 2018
Bearbeitet: Constantin Alin am 10 Mai 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 am 10 Mai 2018
Bearbeitet: Matt J am 10 Mai 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);
Matt J
Matt J am 10 Mai 2018
Constantin comented:
Thank you very much, I had a code problem. Now they are returning different values for each processed block.
Matt J
Matt J am 10 Mai 2018
You are quite welcome.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by