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
...... " "
0 个评论
回答(2 个)
Walter Roberson
2011-3-10
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)
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!