Multimedia Programming 2005 - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

Multimedia Programming 2005

Description:

Remember to hand in your assignment before 17:00 TODAY! ... Monochrome, grayscale, 256 colors, true colors. Contents. Introduction ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 30
Provided by: lia9
Category:

less

Transcript and Presenter's Notes

Title: Multimedia Programming 2005


1
Multimedia Programming2005
  • Class 2
  • Computer Images

2
Course Notes
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Remember to hand in your assignment before 1700
    TODAY!
  • Assignments will be graded in the next week
  • Results will be send over email
  • I saw a Visual C CDROM lying around this place.

3
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
4
Contents
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Introduction
  • Human eye
  • Computer representation
  • Image types
  • Computer challenges
  • Image programming
  • Assignment

5
Introduction
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Computer images are everywhere
  • Holiday pictures
  • Internet pages
  • Computer documents
  • Icons, buttons, windows, etc.
  • Different types
  • GIF, PNG, BMP, JPEG, TIFF, etc..
  • What are computer images?

6
Human Eye
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
7
Human eye vs. CCD
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • CCD charge coupled device
  • Eye 150.000 elts/mm2
  • CCD 4 Megapixel ?
  • 4.000.000 elts/5mm2
  • 160.000 elts/mm2
  • Well within the realm of eye ability
  • Intelligence in vision

8
About color
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Humans discern thousands of colors
  • The color spectrum contains roughly 6 colors
    (violet, blue green, yellow, orange, red)
  • Cones are divided in categories
  • Red (65), Green (33), blue (2)

9
About color
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • All the colors of light are described in
    combinations of RGB
  • Primary colors of light
  • Secondary colors of light
  • Colors of colorants or pigments

10
Computer representation
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Divide picture in grid
  • Take average color per cell
  • Cells are called pixels

11
Computer representation
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • RGB color space
  • Give every pixel a RGB code (or index number)
  • This color in RGB 255,128, 64
  • This color in binary
  • 00000000 010000000 10000000 11111111
  • This color in hexadecimal
  • 0x00 40 80 FF

12
Computer representation
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • type .
  • .
  • Width.
  • pixel1,pixel2,pixel3,pixel4, etc

13
Computer terminology
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Dimensions of image in pixels
  • WRONG resolution
  • RIGHT size
  • Determine resolution on output-time
  • Color depth
  • Number of colors available per pixel
  • Monochrome, grayscale, 256 colors, true colors

14
Image types
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • BMP (Bitmap)
  • Varies from 2 to 16 million colors
  • Uncompressed
  • 4 bytes per pixel. (so large file)
  • GIF (Compuserve GIF)
  • 256 colors (of choice)
  • Compressed (LZW, patented)
  • 1 byte per pixel (colors in header)

15
Image Types
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • JPEG (Joint Photographic Experts Group)
  • Transformed color space (brightness, color).
  • Encoding () in high frequency region (human eye
    can see badly)
  • Downsampling per 8x8 pixels.
  • Vector images

16
Challenges object recognition
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
17
Challenges object recognition
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Not that different
  • Main color red
  • Surrounding color mostly green

18
Challenges Human recognition
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
19
Challenges Human recognition
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Not that different
  • Face
  • Long black hair on both sides

20
Challenges texture recognition
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
21
Challenges texture recognition
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Not that different
  • Main color white(ish)
  • Texture shaded parts

22
Visual programming
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Message loop
  • while (!quit)
  • readmessage()
  • execute task(message)
  • (Re)Paint the window is also a message!

23
Image programming
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Simple image programming (no directX yet)
  • Buffering is important!
  • Disk is slow, memory is fast.
  • On initialization load all images in memory to
    prevent shocks
  • Display when needed.

24
Image programming
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • All images are being displayed as uncompressed
    pixels (bitmap).
  • Basic program flow
  • Get window handle
  • Create device handle
  • Connect device handle to window handle
  • Load image in device

25
Image programming
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Start painting
  • Draw bitmap
  • End painting
  • Invalidate window
  • No worries skeleton code will be provided!

26
Image programming example
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • //buffering
  • hDC GetDC( hWnd )
  • hdcImage CreateCompatibleDC(hDC )
  • Bmp (HBITMAP)LoadImage(
  • NULL,
  • "..\\Images\\image01.bmp",
  • IMAGE_BITMAP, NULL, NULL, LR_LOADFROMFILE )
  • SelectObject( hdcImage, bmp )
  • //displaying
  • hDC BeginPaint( hWnd, ps )
  • BitBlt( hDC, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
  • hdcImage, 0, 0, SRCCOPY )
  • EndPaint( hWnd, ps )
  • InvalidateRect( hWnd, NULL, FALSE )

27
Image programming example 2
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • // one time
  • TransparentBlt(hdc, xStart, yStart, ptSize.x,
    ptSize.y,hdcTemp, 0, 0, ptSize.x,
  • ptSize.y, cTransparentColor)
  • //draw transparent picture
  • myDrawTransparentBitmap(hdcSave,bmp_transparent
    ,250, 0, 0x0000ff00)

28
Assignment
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • Ex. Windows message loop and images.
  • Click a button to change image
  • Move and place partially transparent images
  • Automatically cycle through images to create
    (simulate video).

29
Last assignment
Contents Introduction Human eye and image
physics Computer representation Image
Types Computer Challenges Image
Programming Assignment
  • No correction yet.
  • No chocolate bar award either.
  • Any questions?
Write a Comment
User Comments (0)
About PowerShow.com