jpeg2000 compression of hyperspectral image data (imwrite not working)
3 views (last 30 days)
Show older comments
I am trying to apply add noise to a hyperspectral image data matrix(m-n-layers) by applying jpeg2000 compression on each of the layers saparately. So we can't use it like a nomal .jgp or .png image. I tried the imwrite scheme in loop format (not actual code here),
a = image(:,:,1); % a can only be a gray scale or rgb or an indexed data as I remember
imwrite(a,'image1.jpg', 'Compression','jpeg','CompressionRatio',10);
% the upper line threw an error that "not valid arguments"
% neither the next line work
imwrite(a,'image1.jpg','Mode','lossy','CompressionRatio',10); %according to the documentation
%the syntax doesn't allow the output to be a data matrix like the input itself too
imwrite(a,imageNoise(:,:,1), 'Compression','jpeg','CompressionRatio',10);
, but apparantely it allows compression for HDF format only. I want to store the output in a data matrix format(m-n-layers) only (compression applied layerwise). Can you suggest me any alternate way to apply jpeg2000 compression without imwrite. Thanks in advance.
4 Comments
Walter Roberson
on 7 Apr 2019
'Compression' as an option is available only for HDF4 and TIFF.
'CompressionRatio' as an option is available only for JPEG2000. To get JPEG2000 you need to use the 'jp2' option (before the keyword/value pairs), or you need to use 'jp2' or 'jpx' as the file extension. JPEG2000 options are not available for .jpeg file extension.
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!