what will be the output of the following code for JPEG image compression
Show older comments
"if ndims(x)~=2 | ~isreal(x) | ~isnumeric(x) | ~isa(x, 'uint8') error ('The input must be a unit8 image.'); end ...... " is this statement is true for uint8image? i want to know the this statement is true or not and is this go to the next level of the coding as given below:- " ............ if nargin<2 quality=1; %default value of quality end
...... " "
Answers (2)
nasim alam
on 10 Mar 2011
0 votes
Walter Roberson
on 10 Mar 2011
The "if" test will be true if the uint8 array is 3 or more dimensions, or is complex. When the test is true, an error is generated.
For example,
x = uint8(complex(1,2));
would trigger the error.
If you are seeing the error being generated, then your x array is probably 3 dimensional, such as would be the case for an RGB image. That routine cannot be used to compress RGB images. It can, though, be used to compress gray-scale images, rgb2gray(x)
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!