DCT example gives me an error when using a different picture

2 views (last 30 days)
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*block_struct.data*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);

Answers (1)

Walter Roberson
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
Yiannis Hadjicharalambous
Yeah I'm passing in RGB images. Is there another example that can do image compression with RGB images?

Sign in to comment.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!