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.

 채택된 답변

Matt J
Matt J 2018년 5월 9일

0 개 추천

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

댓글 수: 6

Constantin Alin
Constantin Alin 2018년 5월 10일
편집: Constantin Alin 2018년 5월 10일
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 2018년 5월 10일
That's got nothing to do with me. Your @boxcountingmethod are producing those numbers.
Constantin Alin
Constantin Alin 2018년 5월 10일
편집: Constantin Alin 2018년 5월 10일
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 2018년 5월 10일
편집: Matt J 2018년 5월 10일
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 2018년 5월 10일
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 2018년 5월 10일
You are quite welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

질문:

2018년 5월 7일

댓글:

2018년 5월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by