Compute fun handler for blockproc

조회 수: 3 (최근 30일)
Constantin Alin
Constantin Alin 2018년 5월 10일
댓글: Constantin Alin 2018년 5월 11일
Hello, i want to compute a function handler for blockproc() like
fun = @(block_struct) ...
FD(block_struct.data) * ones(size(block_struct.data));
A = blockproc(I,[16 16],fun)
to process a imagine I and then calculate Box Counting in every blocks. My question is how to compute handler (fun) to do that ? Thanks in advance.

채택된 답변

Walter Roberson
Walter Roberson 2018년 5월 10일
Make FD a function that accepts one variable that is an array of data, and have it do the box counting on that array.
Just watch out for incomplete blocks: along the bottom edge and the right edge you will get blocks that are not 16 x 16 unless the size of the image happens to be an exact multiple of 16 in each direction.
  댓글 수: 4
Constantin Alin
Constantin Alin 2018년 5월 11일
The code returns a matrix of the same size as the original image (512x512) and returns the same fractal dimension everywhere. A is a matrix 512x512 double.
Walter Roberson
Walter Roberson 2018년 5월 11일
fun = @(block_struct) BoxCountfracDim(block_struct.data);
out = blockproc(img, [16 16], fun, 'trim', false);
imagesc(out);

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

추가 답변 (1개)

Constantin Alin
Constantin Alin 2018년 5월 11일
Thank you so much for your answers. It's work, but in some region of Matrix i have NaN values. Why ?
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 5월 11일
BoxCountfracDim produces NaN if all of the entries in the input it is passed are zero. It produces NaN+NaN*i if the sum of the entries is negative.
Constantin Alin
Constantin Alin 2018년 5월 11일
Thanks, i understand Now.

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

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by