SlideShare una empresa de Scribd logo
1 de 13
Bitmap Image. Embedded System Engineering
Bitmap Image : Bitmap Structure File Header BITMAPFILEHEADER Info Header BITMAPINFOHEADER Opt. Palette RGBQUAD[n] Image Data RGBTRIPLE[m]
Bitmap Image : File Header File Header 14 Info Header 40 Opt. Palette 4n Image Data 3m BM RESERVED
Bitmap Image : Info Header File Header Info Header 40 Opt. Palette Height Image Data Width
Bitmap Image : Image Data
Bitmap : Bitmap - Reading #include <windows.h> FILE*fp; BITMAPFILEHEADERbh; BITMAPINFOHEADERih; RGBTRIPLE		pixel; inti= 0; if(!(fp = fopen("lena.bmp", "rb"))) return 0; fread(&bh, sizeof(BITMAPFILEHEADER), 1, fp); fread(&ih, sizeof(BITMAPINFOHEADER), 1, fp); while(fread(&pixel, sizeof(RGBTRIPLE), 1, fp)) { printf("pixel #%5d: %02x %02x %02x", i++, pixel.rgbtBlue, pixel.rgbtGreen, pixel.rgbtRed); } printf("%d pixels read.", i); File Header Info Header Image Data Starting point!
Bitmap : Bitmap – Writing FILE		*fp; BITMAPFILEHEADERbh; BITMAPINFOHEADERih; char		pixel[60*30*3]; inti; for( i = 0 ; i < 60 * 30 * 3 ; i+=3 ) { // blue 	pixel[i] = 0xff; 	// green pixel[i+1] = 0x00; // red pixel[i+2] = 0x00; } ih.biSize= sizeof(BITMAPINFOHEADER); ih.biWidth= 60; ih.biHeight = 30; ih.biPlanes= 1; ih.biBitCount= 24; ih.biCompression= 0; ih.biSizeImage= sizeof(pixel); ih.biXPelsPerMeter= ih.biYPelsPerMeter = 0; ih.biClrImportant= ih.biClrUsed = 0; bh.bfType= 0x4d42; bh.bfSize= sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(pixel); bh.bfOffBits= sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); if(!(fp = fopen("blue.bmp", "wb"))) return 0; fwrite(&bh, sizeof(BITMAPFILEHEADER), 1, fp); fwrite(&ih, sizeof(BITMAPINFOHEADER), 1, fp); fwrite(&pixel, sizeof(pixel), 1, fp); File Header Info Header Image Data 30 60
Bitmap : Practice #1 Inverting Hint :: Each pixel data(R,G,B) ^ 0xff
Bitmap : Practice #2 Sepia effect Hint :: Red * 0.299, Green * 0.587, Blue * 0.114
Bitmap : Practice #3 Draw the flag of NETHERLAND Size : 600 x 300
Bitmap : Practice #4 Draw the flag of FRANCE Size : 600 x 300
Bitmap : Practice #5 In this square, there are some black pixels, how many pixels are there? And, where is location of pixels?
Bitmap : Practice #6 Rotation

Más contenido relacionado

Destacado (11)

Lecture5 graphics
Lecture5   graphicsLecture5   graphics
Lecture5 graphics
 
Webcam Presentation
Webcam PresentationWebcam Presentation
Webcam Presentation
 
Scanning powerpoint
Scanning powerpointScanning powerpoint
Scanning powerpoint
 
Scanner
ScannerScanner
Scanner
 
File formats and its types
File formats and its typesFile formats and its types
File formats and its types
 
multimedia technologies Introduction
multimedia technologies Introductionmultimedia technologies Introduction
multimedia technologies Introduction
 
Image Processing Basics
Image Processing BasicsImage Processing Basics
Image Processing Basics
 
File formats
File formatsFile formats
File formats
 
Image file formats
Image file formatsImage file formats
Image file formats
 
The Ultimate Guide To Converting JPG to DWG
The Ultimate Guide To Converting JPG to DWGThe Ultimate Guide To Converting JPG to DWG
The Ultimate Guide To Converting JPG to DWG
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 

Similar a Lecture bmp of C language

PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
Patrick Allaert
 
Target updated track f
Target updated   track fTarget updated   track f
Target updated track f
Alona Gradman
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
bolovv
 

Similar a Lecture bmp of C language (20)

PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
 
Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009Scientific Computing with Python Webinar --- May 22, 2009
Scientific Computing with Python Webinar --- May 22, 2009
 
Bitmap management like a boss
Bitmap management like a bossBitmap management like a boss
Bitmap management like a boss
 
Computer hw1
Computer hw1Computer hw1
Computer hw1
 
eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
 
Proyecto de microcontroladores
Proyecto de microcontroladoresProyecto de microcontroladores
Proyecto de microcontroladores
 
ITK Tutorial Presentation Slides-948
ITK Tutorial Presentation Slides-948ITK Tutorial Presentation Slides-948
ITK Tutorial Presentation Slides-948
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging Infrastructure
 
Construindo Aplicações Deep Learning com TensorFlow e Amazon SageMaker - MCL...
Construindo Aplicações Deep Learning com TensorFlow e Amazon SageMaker -  MCL...Construindo Aplicações Deep Learning com TensorFlow e Amazon SageMaker -  MCL...
Construindo Aplicações Deep Learning com TensorFlow e Amazon SageMaker - MCL...
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmap
 
COSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer ToolsCOSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer Tools
 
Work With Images
Work With ImagesWork With Images
Work With Images
 
Target updated track f
Target updated   track fTarget updated   track f
Target updated track f
 
Chip Ex2010 Gert Goossens
Chip Ex2010 Gert GoossensChip Ex2010 Gert Goossens
Chip Ex2010 Gert Goossens
 
07.bootstrapping
07.bootstrapping07.bootstrapping
07.bootstrapping
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Rpg Pointers And User Space
Rpg Pointers And User SpaceRpg Pointers And User Space
Rpg Pointers And User Space
 
Boost.Python: C++ and Python Integration
Boost.Python: C++ and Python IntegrationBoost.Python: C++ and Python Integration
Boost.Python: C++ and Python Integration
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Lecture bmp of C language

  • 1. Bitmap Image. Embedded System Engineering
  • 2. Bitmap Image : Bitmap Structure File Header BITMAPFILEHEADER Info Header BITMAPINFOHEADER Opt. Palette RGBQUAD[n] Image Data RGBTRIPLE[m]
  • 3. Bitmap Image : File Header File Header 14 Info Header 40 Opt. Palette 4n Image Data 3m BM RESERVED
  • 4. Bitmap Image : Info Header File Header Info Header 40 Opt. Palette Height Image Data Width
  • 5. Bitmap Image : Image Data
  • 6. Bitmap : Bitmap - Reading #include <windows.h> FILE*fp; BITMAPFILEHEADERbh; BITMAPINFOHEADERih; RGBTRIPLE pixel; inti= 0; if(!(fp = fopen("lena.bmp", "rb"))) return 0; fread(&bh, sizeof(BITMAPFILEHEADER), 1, fp); fread(&ih, sizeof(BITMAPINFOHEADER), 1, fp); while(fread(&pixel, sizeof(RGBTRIPLE), 1, fp)) { printf("pixel #%5d: %02x %02x %02x", i++, pixel.rgbtBlue, pixel.rgbtGreen, pixel.rgbtRed); } printf("%d pixels read.", i); File Header Info Header Image Data Starting point!
  • 7. Bitmap : Bitmap – Writing FILE *fp; BITMAPFILEHEADERbh; BITMAPINFOHEADERih; char pixel[60*30*3]; inti; for( i = 0 ; i < 60 * 30 * 3 ; i+=3 ) { // blue pixel[i] = 0xff; // green pixel[i+1] = 0x00; // red pixel[i+2] = 0x00; } ih.biSize= sizeof(BITMAPINFOHEADER); ih.biWidth= 60; ih.biHeight = 30; ih.biPlanes= 1; ih.biBitCount= 24; ih.biCompression= 0; ih.biSizeImage= sizeof(pixel); ih.biXPelsPerMeter= ih.biYPelsPerMeter = 0; ih.biClrImportant= ih.biClrUsed = 0; bh.bfType= 0x4d42; bh.bfSize= sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(pixel); bh.bfOffBits= sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); if(!(fp = fopen("blue.bmp", "wb"))) return 0; fwrite(&bh, sizeof(BITMAPFILEHEADER), 1, fp); fwrite(&ih, sizeof(BITMAPINFOHEADER), 1, fp); fwrite(&pixel, sizeof(pixel), 1, fp); File Header Info Header Image Data 30 60
  • 8. Bitmap : Practice #1 Inverting Hint :: Each pixel data(R,G,B) ^ 0xff
  • 9. Bitmap : Practice #2 Sepia effect Hint :: Red * 0.299, Green * 0.587, Blue * 0.114
  • 10. Bitmap : Practice #3 Draw the flag of NETHERLAND Size : 600 x 300
  • 11. Bitmap : Practice #4 Draw the flag of FRANCE Size : 600 x 300
  • 12. Bitmap : Practice #5 In this square, there are some black pixels, how many pixels are there? And, where is location of pixels?
  • 13. Bitmap : Practice #6 Rotation