1 / 30

Video

Video. We will consider how electronic pictures are made up. Consider some important characteristics of electronic images. See how image are represented in a computer. Appreciate compromises and limitations.

Renfred
Download Presentation

Video

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. Video • We will consider how electronic pictures are made up. • Consider some important characteristics of electronic images. • See how image are represented in a computer. • Appreciate compromises and limitations. • Finally you will be able to edit individual picture elements and change the brightness, contrast and colour of an image, as say Photoshop may do.

  2. The television picture • Consider monochrome first. • The image that we see on our monitors is composed of a series of horizontal lines. • In the television signal the brightness of the line varies continually along the line. • However, the picture is sampled in the vertical direction. • Subject to aliasing. Limits vertical spatial resolution.

  3. Spatial resolution. • Is the amount of detail in the vertical and horizontal direction we can resolve (see). • Our eyes can only resolve a minimum angle. • Therefore viewing monitor size and viewing distance determine how much spatial resolution we require from our television pictures.

  4. Spatial resolution. • We do not want to see the individual lines of a television picture. • If the television picture is to have good spatial resolution we must have a minimum number of lines. • The more lines (vertical samples) the higher the resolution.

  5. Aspect ratios • The maximum angle that our eyes can see (without moving them) is greater in the horizontal direction. • Therefore square televisions are out. • Television screens are larger horizontally than vertically. • The ratio of the wide to the height is called the aspect ratio. • Two common television aspect ratios are: • 4:3 • 16:9

  6. The digital picture and pixels. • In the computer we cannot represent television’s horizontal line. • So we represent it as a series of samples (of the television picture) along the line. • In digital video each sample is called a pixel (picture element). • Digital picture sampled in the horizontal or vertical directions.

  7. How many samples? • The higher the number of samples, the better is the spatial resolution. • There is no real reason to make the horizontal resolution much better (or worse) than the vertical resolution. (Although the eye’s response it not exactly equal).

  8. How many samples? • It may seem simple therefore to make the horizontal resolution equal to the vertical resolution. • Although there may be nominally 625 lines in the European television picture, not all of these lines are used to transmit the picture. They are used and reserved for other purposes. • In the American NTSC standard there are nominally 525 lines per frame, but only approximately 480 lines make up the actual picture.

  9. How many samples? • There are effectively therefore 480 samples in the vertical direction. • If we: • keep the spatial resolution in the horizontal and vertical directions equal. • Have square pixels. • Maintain a 4:3 (Width : Height) aspect ratio. • How many samples do we need in the horizontal direction?

  10. How many samples? • Answer: • 4/3 x 480 = 640 • The NTSC television based 640 x 480 resolution has become a standard for computers. • Other higher (we view computer monitors more closely than television) computer standard resolutions exist : • 800 x 600 • 1024 x 768 • All 4:3 aspect ratio.

  11. Total number of samples, physical significance • We can consider a block of 640 horizontal samples (in a 640 x 480 image) as a television line or a row of a 2 dimensional matrix. • The full picture is made up of 480 such lines stacked on top of each other. • Any given position in each horizontal block (line) forms a column (vertical line) with that same position in those blocks above and beneath any given line. • We can consider our digital picture as a horizontal matrix.

  12. Brightness and contrast • The value of each point in this two dimensional matrix represents the brightness of a pixel. • In other words brightness is the absolute value of a pixel. • Contrast is the difference between the brightest pixel and the darkest pixel in an image.

  13. Square or 4:3 pixels? • Instead of having different numbers of samples in the horizontal direction, some systems have equal numbers of pixels in both directions, but the pixels are not square and take on the aspect ratio of the image, nominally 4:3. • This therefore gives less horizontal resolution.

  14. Colour • The visible spectrum consists of a continuous range of colours ranging from red to violet. • Our eyes sense colour by having three “receptors”: • One more sensitive to red. • One more sensitive to green. • One more sensitive to blue. • This allows us to “fool” the eye into seeing most (not all) naturally occurring colours by mixing red, green and blue lights to different degrees.

  15. Colour • Television and computer monitors, have three types of light emitting phosphors: • One emits red light. • One emits green light. • One emits blue light. • So the colour television signal sends three sets of brightness information; for the red, green and blue.

  16. Colour • In the digital form this means that we may need to save three separate images to represent colour. One for each of red green and blue. • The uncompressed colour picture is therefore three times larger than a black and white picture.

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

  18. The bitmap format .bmp • BITMAPFILEHEADER

  19. The bitmap format .bmp • BITMAPINFOHEADER

  20. The bitmap format .bmp • BITMAPINFOHEADER

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

  22. 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.

  23. Altering “biwidth” • fid=fopen('am8fix.bmp') • A=fread(fid); • A8=uint8(A); • A8(19:22) holds the width in little endian notation. • hex2dec('00000300') gives values in decimal. • Let’s halve it. • A8(19)=128; (is equal to 8016) • A8(20)=1; (01 8016 equals 38410) • fid=fopen('newpix.bmp','wb') • fwrite(fid, A8) • fclose(fid)

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

  25. Accessing rows and columns of pixels. • A single pixel • A(row, column, red:blue) • Eg A(3, 5, 1:3)=127 Changes the value of red, green and blue values of the pixel on row 3, column 4 to 127. • A set of rows • A(20:30, :, 1:3)=64 • A set of columns • -A(:, 20:30, 1:3)=64

  26. Removing lines and columns from the image • Lines • newimage= [image( 1:flr, : , :) ; image(llr:end ,: ,:)] • Columns • newimage= [image( :, 1:fcr, :, :) image(:, lcr:end, :)] Where flr, llr, fcr and lcr stand for: first line removed last line removed first column removed last column removed

  27. Piecing two images together. • Linewise • newimage= [image1( start:end, : , :) ; image2(start:end,:,:)] Images 1 and 2 must have same number of columns • Columnwise • newimage= [image1( : , start:end, :) image2(:, start:end, :)] Images 1 and 2 must have same number of lines.

  28. Altering the overall brightness and contrast of an image. • Brightness • An offset operation • Use + or – • Contrast • A scaling operation • Use * or / • You will have to cast uint8 to double before using +, -, *, or / (and then back again) • Exceeding 255 will cause ‘clipping’. • Numbers less than zero will cause ‘crushing’

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

  30. Matlab’s “colormap” • Translates numbers into colours.

More Related