MATLAB Answers


DCT example gives me an error when using a different picture

Hello, I've been trying to compress an image using the DCT example provided here , but when I put my own images it gives me this error:
BLOCKPROC encountered an error while evaluating the user-supplied function handle, FUN.
The cause of the error was:
Error using *
Arguments must be 2-D, or at least one argument must be scalar. Use TIMES (.*) for elementwise multiplication.
Error in ImageCompression>@(block_struct)T**T'
Error in blockprocFunDispatcher (line 13)
output_block = fun(block_struct);
Error in blockprocInMemory (line 80)
[ul_output fun_nargout] = blockprocFunDispatcher(fun,block_struct,...
Error in blockproc (line 243)
result_image = blockprocInMemory(source,fun,options);
Error in ImageCompression (line 6)
B = blockproc(I,[8 8],dct);


Sign in to comment.




1 Answer

Answer by Walter Roberson
on 8 Dec 2018

You are probably passing in rgb images .
Note that although jpg in theory can handle greyscale images in practice greyscale jpg are very rare and nearly all grey appearing jpg are stored as rgb

  1 Comment

Yeah I'm passing in RGB images. Is there another example that can do image compression with RGB images?

Sign in to comment.