what will be the output of the following code for JPEG image compression

4 次查看(过去 30 天)
"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
...... " "

回答(2 个)

nasim alam
nasim alam 2011-3-10
error :- ??? Error using ==> Untitled The input must be a unit8 image.

Walter Roberson
Walter Roberson 2011-3-10
This is effectively the same question as your earlier one
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)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by