Presentation is loading. Please wait.

Presentation is loading. Please wait.

imshow function uint8 data type (0-255) double data type ( )

Similar presentations


Presentation on theme: "imshow function uint8 data type (0-255) double data type ( )"— Presentation transcript:

1 imshow function uint8 data type (0-255) double data type (0.0-1.0)
imshow(x) is ok double data type ( ) Wrong example: c=imread('caribou.tif'); cd=double(c); imshow(c), figure, imshow(cd) Right method: imshow(cd/255) 或 imshow(cd, [])

2 Bit planes Bit plane 0 Bit plane 1 Show multiple images in a figure
c0=mod(cd, 2); Bit plane 1 c1=mod(floor(cd/2), 2); Show multiple images in a figure figure, subplot(1,2,1), imshow(c0); subplot(1,2,2), imshow(c1); Exercise#1: Show bit plane 0 to 7 in a figure (3 by 3 arrangement)

3 Quantization 量化 Reduce the number of gray levels
Example: 256 levels -> 4 levels f=floor(double(cd)/64); q=uint8(f*64); % scale it Exercise#2: quantize to 2, 8, 16, 64 levels Original values Output values 0-63 64-127 1 2 3

4 Halftoning and dithering
Halftoning(半色調): representing an image with only two tones Simply quantization cause false contours Dithering(混色): adding random values to the image before quantization D=[0 128; ]; r=repmat(D,128,128); x=cd>r; imshow(x);

5 Idea of dithering Exercise#3: dithering using

6 Arithmetic operations
Image addition and subtraction a=uint8(double(c)+128); a1=imsubtract(c, 128);

7 Lookup tables (LUT) Example: MATLAB code: T=uint8(floor((0:255)/2));
ct=T(c); % what’s wrong index LUT

8 Piecewise linear function using LUT
255 t1=0.6667*[0:96]; t2=2*[97:160]-128; t3=0.6632*[161:255]+85.89; T2=uint8(floor([t1 t2 t3])); cT2=T2(cd+1); 192 64 96 160 255

9 Exercise#4 For the tire image, build a LUT that performs gamma transform s=cr0.5


Download ppt "imshow function uint8 data type (0-255) double data type ( )"

Similar presentations


Ads by Google