±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 2378  |  »Ø¸´: 1

ÇàÖñzjc

гæ (³õÈëÎÄ̳)

[ÇóÖú] ͼÏñλÉî¶È¸Ä±ä

ÓÃMATLAB´¦Àí.bmpÎļþʱ£¬Í¼ÏñµÄλÉî¶ÈÊÇ24λµ¼ÖÂȫϢ³ÌÐòÒ»Ö±³ö´í£¬¿ÉÄÜÊÇλÉîÌ«´ó¡£ÈçºÎ¼ÓÒ»¶Î³ÌÐò½«¶ÁÈëµÄ.bmpͼƬλÉΪ8λ£¿Ï£Íû¸÷λ´óÉñÄܰïæ£¬Ð»Ð»£¡
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

jinjinliu

Òø³æ (ÖøÃûдÊÖ)

Overview of Image Class Conversions


You can convert uint8 and uint16 image data to double using the MATLAB double function. However, converting between classes changes the way MATLAB and the toolbox interpret the image data. If you want the resulting array to be interpreted properly as image data, you need to rescale or offset the data when you convert it.

For easier conversion of classes, use one of these functions: im2uint8, im2uint16, im2int16, im2single, or im2double. These functions automatically handle the rescaling and offsetting of the original data of any image class. For example, this command converts a double-precision RGB image with data in the range [0,1] to a uint8 RGB image with data in the range [0,255].
RGB2 = im2uint8(RGB1);


Back to Top
Losing Information in Conversions


When you convert to a class that uses fewer bits to represent numbers, you generally lose some of the information in your image. For example, a uint16 grayscale image is capable of storing up to 65,536 distinct shades of gray, but a uint8 grayscale image can store only 256 distinct shades of gray. When you convert a uint16 grayscale image to a uint8 grayscale image, im2uint8 quantizes the gray shades in the original image. In other words, all values from 0 to 127 in the original image become 0 in the uint8 image, values from 128 to 385 all become 1, and so on.

Back to Top
Converting Indexed Images


It is not always possible to convert an indexed image from one storage class to another. In an indexed image, the image matrix contains only indices into a colormap, rather than the color data itself, so no quantization of the color data is possible during the conversion.

For example, a uint16 or double indexed image with 300 colors cannot be converted to uint8, because uint8 arrays have only 256 distinct values. If you want to perform this conversion, you must first reduce the number of the colors in the image using the imapprox function. This function performs the quantization on the colors in the colormap, to reduce the number of distinct
2Â¥2015-08-19 20:22:31
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ ÇàÖñzjc µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 306·Ö²ÄÁÏÓ뻯¹¤Çóµ÷¼Á +4 Àè°ÉÀ²À²ÄãºÜÓÐà 2026-04-03 4/200 2026-04-03 11:24 by wangjy2002
[¿¼ÑÐ] ²ÄÁÏר˶322·Ö +11 ¹þ¹þ¹þºðºðºð¹þ 2026-04-01 11/550 2026-04-03 11:10 by wangjy2002
[¿¼ÑÐ] »¯Ñ§µ÷¼Á +8 °¬Ö¾ºã 2026-04-03 9/450 2026-04-03 10:22 by macy2011
[¿¼ÑÐ] ר˶ 351 086100 Ò²ÊÇ¿¼µÄ²Ä¿Æ»ù ±¾¿ÆÒ²ÊDzÄÁÏ +8 202451007219 2026-04-02 8/400 2026-04-03 09:50 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 085602 ÕÒµ÷¼Á +3 ÄæÊ±Õë¿ìÀÖ 2026-04-02 3/150 2026-04-02 21:23 by dongzh2009
[¿¼ÑÐ] 311Çóµ÷¼Á +16 zchqwer 2026-04-01 18/900 2026-04-02 10:15 by ²»³Ôô~µÄ؈
[¿¼²©] 26ÄêÉ격 +3 staryer 2026-03-30 4/200 2026-04-01 23:21 by ai4pharm
[¿¼ÑÐ] Ò»Ö¾Ô¸Äϲý´óѧ324Çóµ÷¼Á +12 hanamiko 2026-03-27 12/600 2026-04-01 22:34 by ÔËÆøyunqi
[¿¼ÑÐ] 070300Ò»Ö¾Ô¸211£¬312·ÖÇóµ÷¼ÁԺУ +14 С»ÆÑ¼±¦ 2026-03-30 14/700 2026-04-01 20:19 by Àµ´ºÑÞ
[¿¼ÑÐ] ²ÄÁÏרҵµ÷¼Á +5 À²À²À²¿Þ 2026-03-31 6/300 2026-04-01 16:48 by JourneyLucky
[¿¼ÑÐ] 318Çóµ÷¼Á +8 ÆßÒä77 2026-04-01 8/400 2026-04-01 10:37 by Jaylen.
[¿¼ÑÐ] Ò»Ö¾Ô¸»ªÄÏʦ·¶361·Ö£¬»¯Ñ§Çóµ÷¼Á +4 Nicole88888 2026-04-01 4/200 2026-04-01 10:08 by ÌÆãå¶ù
[¿¼ÑÐ] Çó0861½»Í¨ÔËÊäר˶or²ÄÁÏר˶µ÷¼Á +4 ÀÕ²¼ÀÊ@ 2026-03-31 4/200 2026-04-01 09:54 by Ò»Ö»ºÃ¹û×Ó?
[¿¼ÑÐ] Ò»Ö¾Ô¸±±¾©¿Æ¼¼´óѧ085601²ÄÁϹ¤³ÌÓ¢Ò»Êý¶þ³õÊÔ×Ü·Ö335Çóµ÷¼Á +5 Ë«ÂíβƦÀϰå2 2026-03-31 5/250 2026-04-01 09:04 by oooqiao
[¿¼ÑÐ] 340Çóµ÷¼Á +4 Ï£ÍûÈç´Ëi 2026-03-31 4/200 2026-03-31 16:40 by 690616278
[¿¼ÑÐ] 0703»¯Ñ§ +20 ÄÝÄÝninicgb 2026-03-27 20/1000 2026-03-31 13:33 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] 334Çóµ÷¼Á +7 Trying] 2026-03-31 7/350 2026-03-31 12:33 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] Ò»Ö¾Ô¸Õã½­´óѧ¹¤¿Æ¶¯Á¦¹¤³Ì370,ÊýÒ»121,רҵ¿Î135£¬ÏÖÔÚÄÜÈ¥ÄÄÀï +3 080700µ÷¼Á 2026-03-30 4/200 2026-03-31 12:00 by KLMY666
[¿¼ÑÐ] 370Çóµ÷¼Á +3 080700µ÷¼Á 2026-03-30 3/150 2026-03-31 01:09 by A_Zhe
[¿¼ÑÐ] Ò»Ö¾Ô¸ÄϾ©º½¿Õº½Ìì´óѧ²ÄÁÏѧ˶Çóµ÷¼Á +3 @taotao 2026-03-28 3/150 2026-03-28 10:26 by JourneyLucky
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û