1 / 16

Bitmap files and manipulation using Matlab .

Bitmap files and manipulation using Matlab. The bitmap (.bmp) file. Loading and manipulation in Matlab The bmp header and file structure. Modifications to our structure for colour. 240. 63. Now we need three separate matrices, one for each colour. Each matrix holds

lucien
Télécharger la présentation

Bitmap files and manipulation using Matlab .

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Bitmap files and manipulation using Matlab. • The bitmap (.bmp) file. • Loading and manipulation in Matlab • The bmp header and file structure.

  2. Modifications to our structure for colour 240 63 Now we need three separate matrices, one for each colour. Each matrix holds values which represent the corresponding colour in the image 240 63 240 63 Our matrix is now Of size 640 x 480 x 3

  3. Loading, saving and showing bitmaps in Matlab • A=imread(‘filename1.bmp’) • B=imread(‘filename2.bmp’) • imwrite(Array,‘filename.bmp’) • image(A) • Change “edit -> axis properties” to “Set axis equal shape” • Note that A is class uint8.

  4. Manipulating the image Rows • Use : operator to select certain rows only, then look at it • Eg newim=[A( 101:200, : , :) ; image(newim) Columns • Use : operator to select certain columns only, then look at it. • Eg newim=[A( :, 251:300 , :) ; image(newim)

  5. Manipulating the image Crop • Use : operator to select certain rows and columns then look at it • Eg newim=[A( 101:200, 251 : 300, :) ; image(newim)

  6. Piecing two images together. • Linewise • newim= [A( start:end, : , :) ; B(start:end,:,:)] Images 1 and 2 must have same number of columns • Columnwise • newim= [A( : , start:end, :) B(:, start:end, :)] Images 1 and 2 must have same number of lines.

  7. Altering the overall brightness and contrast of an image. • If we want a neutral change we must make the same change to all three primaries. • Brightness • An offset operation • Use + or – • Contrast • A scaling operation • Use * or / • Exceeding 255 will cause ‘clipping’. • Numbers less than zero will cause ‘crushing’

  8. Changing Brightness • newim=A-127 image(newim) • We can increase it again newim= A+127 image(newim) • If we increase/decrease values below 0 or above 255 we lose information in the image, try it.

  9. Changing Contrast • Now use multiplication to increase the contrast. newim=A*2 image(newim)

  10. Changing the colour of an image. • Operate (+ - * /) on different colours • Example • Give picture a red lift newim=A; newim(:, :, 1)=newim(:, :, 1)+20; image(newim);

  11. The bitmap format .bmp • Contains the following data structures: • BITMAPFILEHEADER bmfh; BITMAPINFOHEADER bmih; RGBQUAD aColors[]; BYTE aBitmapBits[];

  12. The bitmap format .bmp • BITMAPFILEHEADER

  13. The bitmap format .bmp • BITMAPINFOHEADER

  14. The bitmap format .bmp • BITMAPINFOHEADER

  15. The bitmap format .bmp • RGBQUAD array for colour map (not used for 24 bit colour)

  16. The bitmap format Notes • “biwidth” important for rows and column structure, change it and see. • Bitmap data is “upside down”. • “Length” data is LSB first.

More Related