Basic operation of MATLAB image

Source: Internet
Author: User

(1) Display:

Image () can display 8-digit images directly, but 8-bit images and double-type data have different meanings in image ().

Binary graphs can be stored by uint8 or double;

Indexed image uint8 and double type display methods are not different. However, there is a deviation between the value of the 8-bit data matrix and the color category with a value of 1. Call format image (x); ColorMap (map);

For grayscale images, the Uint8 range 0~255,double range 0~1, the two modes of conversion: i8 = UINT (round (i64*255)); i64 = Double (i8)/255 ;

Imshow (F,[low,high]) all smaller than low display black, all larger than high display white;

Imshow (f,g) G denotes gray scale series;

Imshow (f,[]) Resolve Uint8 range 0~255 convert to 0~1;

(2) Read:

[r width, c height, d]=imread () different processing according to the file image type. The gray image is stored in a 8-bit matrix and the color graph matrix is converted to a double-precision matrix, and the RGB image is stored in a 8-bit RGB matrix.

The matlab read-in image is a uint8 type, and a double is used in the matrix, so it needs to be converted. Im2double (), Im2uint8 (),im2uint16 ();

(3) Access:

MATLAB defaults to storing the image double type, also supports Uint8 or uint16, the advantage is to save space.

Mat2gray () Converts an array of type double to 0~1, converting the matrix into a grayscale image to produce a double format.

The Isgray () function determines whether the matrix is an image data matrix.

(4) Conversion:

Gray2ind () Ind2gray () [X,map]=rgb2ind () Ind2rgb (X,map) Rgb2gray () IM2BW (rgb,level) threshold

(5) Write:

Imwrite (i, ' snight.jpg ') or imwrite (i, ' snight ', ' jpg ')

Basic operation of MATLAB image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.