Digital Image Processing
HW1
Yi-Chun Wei Visual Communications LabNational Central University
Mar. 2, 2012
2
Outline• Work Chart• Introduction to Bitmap File• Homework Details - Construct color histogram - Color image transform to gray-level image - Resize the image• Grading• Demo Schedule• References
3
Work Chart
Extract header
information
512*512
Extract pixel information
Construct the histogram on Y
ChannelHW1-1
Transform to gray-level image
Resize image
512*512
640*480
HW1-2
4
Introduction to Bitmap File(1/2)Bitmap File Header
Identifier (ID) 2File Size 4Reserved 4
Bitmap Data Offset 4Bitmap Info Header
Bitmap Header Size 4Width 4Height 4Planes 2
Bits Per Pixel 2Compression 4
Bitmap Data Size 4H-Resolution 4V-Resolution 4Used Colors 4
Important Colors 4Color Table (Palette)
Palette N*4Bitmap Array
Bitmap Data N/A
• Header file
- File header (14 bytes)
- Info header (54 bytes)
• Image content
- Bit array
(pixel information)
• Color table
- ex: a 8 bit image,
N=28
Y. C. Dong, “Digital Image Processing HW1”, 2009
5
Introduction to Bitmap File(2/2)
Header + Color paletteHeader54
bytes54 bytes +1024 bytes
Image content
Image content
24-bit Lena 8-bit Lena
Scale: 512*512 Scale: 512*512
Y. C. Dong, “Digital Image Processing HW1”, 2009
6
Color Image Transform to Gray-Level Image
Y = 0.299R + 0.587G + 0.114B
24-bit Lena8-bit Lena
7
Gray-level Histogram
Y histogram
number
Blue
196
Green
122
Red
83
Gray level pixel value
Gray level
?
8
Resize Image
• P: Desired Point• Q: Known Points (four closet pixels)• R: Point on the line
with known points
Z = A X + B Y + C XY+ D
J. Nett,” Bilinear Interpolation”, 2009.
Bilinear Interpolation:
Gray level value known points
Where A, B, C and D are obtained from the gray-level of the four neighbors.
9
Grading• Demo Code (80%) - Extract header file (20%) - Color image transform to gray-level image (20%) - Construct color histogram (20%) - Resize image to 640*480 (20%)• Report (20%) - Plot all your experimental results. (10%) - Describe your finding as rich as possible. (10%)
10
Demo Schedule• Thursday night, March , 2012. - Begin around at 19:00 at R3-307.(VCLab)
NOTE: We will use another image to test your code. The details will be announced on our course
website. ( http://140.115.156.251/vclab/html/course/DIP2012.html )
11
References• Lena 24-bit color image, 512*512http://www.indinf.pub.ro/catalinp/proiect/lena512.bmp
• About Bmp format websitehttp://en.wikipedia.org/wiki/BMP_file_format (wiki)http://crazycat1130.pixnet.net/blog/post/1345538-%E9%BB%9E%E9%99%A3%E5%9C%96%EF%BC%88bitmap%EF%BC%89%E6%AA%94%E6%A1%88%E6%A0%BC%E5%BC%8F