Week03 1 S
Week03 1 S
VUW
School of Engineering and Computer Science
Mengjie Zhang
[email protected]
COMP422 IP and Vision: 2
Outline
Announcements
• netpbm/pbmplus package:
/vol/courses/comp422/src/netpbm/
• jpeg/jpg package:
/vol/courses/comp422/src/jpeg-6b/
Questions
• In what kinds of situation computers are used to process/analyse
images/pictures? Give some examples.
• What are the differences between computer vision and image
processing? Are the images examined/acted on by people or
automatically by computers?
• How do you acquire/obtain an image? Give some examples of
image acquisition device.
• How can we display an image? Give some examples of image
display device.
• Have you used digital cameras and scanners before?
• What types can images be represented?
• What image formats have you seen before?
• What image packages have you used before?
• How do we use current packages to process images?
COMP422 IP and Vision: 5
Goals
Computer Imaging
Computer Image
Vision Processing
COMP422 IP and Vision: 8
Note: The boundaries separating these two are not very clear, or
fuzzy.
Computer Vision
• Computer vision deals with the processing of image data for use
by a computer.
• In other words, the images are examined and acted upon by a
computer and the application does not involve a human being
in the visual loop.
• Note: People can participate the development of a vision sys-
tem, however, a computer can directly apply the patterns/rules
(knowledge) extracted by the system (to the unseen data).
COMP422 IP and Vision: 10
• Edge Detection
• Segmentation
• Transformation
• Feature extraction
• Pattern (object) classification
Vision Applications
Image Processing
Image Restoration
Image Enhancement
Image Compression
IP Applications
Scanners
Cameras
Digitization (Continued)
Digitization (Continued)
Voltage
x x
x x
x x x x x x
x x x
x
One line of information
Time
One line
One pixel
COMP422 IP and Vision: 27
Transformation Spectrum
Segmentation Segments
Neighborhood/
Preprocessing
Subimage
Low Level
Image Representation
Binary Images
Sample Images
COMP422 IP and Vision: 31
Color Images
Multispectral Images
• Miltispectral images typically contain information outside the
human perceptual range. They contain more (30) bands.
• These images are not directly visible to human, however, they
can be reduced into three bands RGB images, which human
being can see.
• These images might include infrared, ultraviolet data.
• Satellite images, underwater sonar images, radar images, in-
frared images, medical X-ray images are examples.
... ... ... ...
P2
# feep.pgm
24 7
15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0
0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0
0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
COMP422 IP and Vision: 38
• Loading a image
• Creating an image
• Processing an image
• Outputting/saving an image
• Destroying an image
COMP422 IP and Vision: 41
#include <stdio.h>
#include <stdlib.h>
/*
* CreatePGM() -- Creates a PGM image structure in memory
*/
pgm->greylevel = greylevel;
pgm->xsize = xsize;
pgm->ysize = ysize;
fclose(fp);
return OK;
}
An example: process.c
#include "pgm_mengjie.h"
typedef UCHAR byte;
if (argc != 3)
{
fprintf(stderr, "\nUsage: %s [source-image] [target-image]\n", argv[0]);
exit(0);
}
if ((source = LoadPGM(argv[1])) == NULL)
{
fprintf(stderr, "Error on reading %s\n", argv[1]);
exit(0);
}
xsize = source->xsize;
ysize = source->ysize;
greylevel = source->greylevel;
COMP422 IP and Vision: 47
DestroyPGM(source);
DestroyPGM(target);
return 0;
}
COMP422 IP and Vision: 50
Image Programs/Packages/Tools
• xv
• ImgStar
• pbmplus/netpbm
• jpeg-6b(jpegtran)
• man pnm, pgm, ppm, ...
COMP422 IP and Vision: 51
NAME
pnm - portable anymap file format
DESCRIPTION
The pnm programs operate on portable bitmaps, graymaps,
and pixmaps, produced by the pbm, pgm, and ppm segments.
There is no file format associated with pnm itself.
SEE ALSO
anytopnm(1), rasttopnm(1), tifftopnm(1), xwdtopnm(1), pnm-
tops(1), pnmtorast(1), pnmtotiff(1), pnmtoxwd(1),
pnmarith(1), pnmcat(1), pnmconvol(1), pnmcrop(1), pnm-
cut(1), pnmdepth(1), pnmenlarge(1), pnmfile(1), pnm-
flip(1), pnmgamma(1), pnmindex(1), pnminvert(1), pnmmar-
gin(1), pnmnoraw(1), pnmpaste(1), pnmrotate(1), pnm-
scale(1), pnmshear(1), pnmsmooth(1), pnmtile(1), ppm(5),
pgm(5), pbm(5)
COMP422 IP and Vision: 52
Summary
• Computer imaging = CV + IP
• CV vs IP
• CV main tasks and applications
• IP main topics and applications
• Commonly used image acquisition and display device/systems
• Image digitization
• Image representation/types: binary, gray scale/level, color, mul-
tispectral ...
• Image formats: .pnm, .jpg/jpeg, .gif, .bmp, ...
• PNM: P2/P5—gray level
• Processing implementation: Defining, loading, creating, pro-
cessing, saving, destroying, ...
• Tools: xv, pbmplus/netpbm, ImgStar, jpeg-6b, CVIP, ...
COMP422 IP and Vision: 53
Exercises