SlideShare uma empresa 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

Mais conteúdo relacionado

Destaque (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
 

Semelhante 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
 

Semelhante 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

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.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
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
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...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
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.
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

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