What "blkproc(I,[8 8],'dct2')" means?

4 views (last 30 days)
Hello everyone, I have question about blkproc function for image processing. If I do this code below,
T=dctmtx(8);
fun=@(block_struct) T*block_struct.data*T';
block=blkproc(I,[8 8],fun);
is that the same code with this?
block=blkproc(I,[8 8],'dct2');
but when I do the first code, it results this error :
Attempt to reference field of non-structure array.
Error in @(block_struct)T*block_struct.data*T'
Error in blkproc (line 103)
firstBlock = feval(fun,x,params{:});
Error in analize (line 15)
blok2 = blkproc(I_subs,[8 8],fun);
what's wrong with the first code? thank you..

Accepted Answer

Walter Roberson
Walter Roberson on 27 Feb 2014
You are confusing blkproc() and blockproc()
  3 Comments
Dishant Arora
Dishant Arora on 6 Mar 2014
fun = @(block_struct) dct2(block_struct.data)
b = blockproc(Image,[8,8],fun);
Walter Roberson
Walter Roberson on 6 Mar 2014
Possibly you need
T .* block_struct.data .* T'
but I suspect that will not work either.
You should debug to see whether the error always occurs, or if instead the error is only occurring on a border. See the 'PadPartialBlocks' option.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!