Image Data Format
Image Data Format
RolandoV.Raqueo
Wednesday,August26,2015
RolandoV.Raqueo
Wednesday,August26,2015
Quiz #2 Topics
mkdir
chmod
cd
grep
ci and co
RolandoV.Raqueo
Wednesday,August26,2015
RolandoV.Raqueo
Wednesday,August26,2015
RolandoV.Raqueo
Wednesday,August26,2015
Two PBMPLUS
Representations
All PBMPLUS data formats have the
following representations
ASCII Format
RAW Format
RolandoV.Raqueo
Wednesday,August26,2015
Displaying Images
Use xv utility for display and documentation purposes.
Note that xv is an X client
To invoke xv
% xv &
% xv filename.pgm &
RolandoV.Raqueo
Wednesday,August26,2015
RolandoV.Raqueo
Wednesday,August26,2015
Let us digress
The vi Problem
vi practice and creation of a bilevel image.
7x10 graph paper divided into 10 squares per inch.
Cell not covered by ink
value of zero (0).
RolandoV.Raqueo
Wednesday,August26,2015
Problem #1 Solution
vi - Brute Force Solution
RolandoV.Raqueo
10
Wednesday,August26,2015
Problem #1 Solution
vi Smart Solution
RolandoV.Raqueo
11
Wednesday,August26,2015
Problem #1 Solution
vi Smart Solution
RolandoV.Raqueo
12
Wednesday,August26,2015
Problem #1 Solution
vi Smart Solution
13
Wednesday,August26,2015
RolandoV.Raqueo
14
Wednesday,August26,2015
RolandoV.Raqueo
nomodelines
noshowmode
nonumber
noslowopen
nonovice
tabstop=8
nooptimize
taglength=0
paragraphs=IPLPPPQPP LIpplpipnpbtags=tags /usr/lib/tags
prompt
tagstack
noreadonly
term=vt220
redraw
noterse
remap
timeout
report=5
ttytype=vt220
scroll=11
warn
sections=NHSHH HUuhsh+c
window=23
shell=/bin/csh
wrapscan
shiftwidth=8
wrapmargin=0
noshowmatch
nowriteany
15
Wednesday,August26,2015
Saving vi Preferences
Preferences such as :set number
can be saved in the file .exrc in your
home directory (~)
RolandoV.Raqueo
16
Wednesday,August26,2015
A vi Command to Always
Remember
To replace all occurrences or a string in
a file with new string.
:%s/string1/string2/g
OR
:%s/string1/string2/gc
(Willaskyouforconfirmation)
RolandoV.Raqueo
17
Wednesday,August26,2015
RolandoV.Raqueo
18
Wednesday,August26,2015
RolandoV.Raqueo
19
Wednesday,August26,2015
P1
# This is a 16 column x 3 row
# PBM ASCII image
# Created by using vi
16 3
001010100011010000111110
010010000101001001011100
RolandoV.Raqueo
20
Wednesday,August26,2015
RolandoV.Raqueo
21
Wednesday,August26,2015
RolandoV.Raqueo
22
Wednesday,August26,2015
RolandoV.Raqueo
23
Wednesday,August26,2015
RolandoV.Raqueo
24
Wednesday,August26,2015
RolandoV.Raqueo
25
Wednesday,August26,2015
26
Wednesday,August26,2015
RolandoV.Raqueo
27
Wednesday,August26,2015
RolandoV.Raqueo
28
Wednesday,August26,2015
P2
# This is a 3 column x 2 row PGM ASCII image
# With a possible maximum grey value of 255
3 2
255
42 52 62
72 82 92
RolandoV.Raqueo
29
Wednesday,August26,2015
RolandoV.Raqueo
30
Wednesday,August26,2015
31
Wednesday,August26,2015
RolandoV.Raqueo
32
Wednesday,August26,2015
P3
width, height
maximum grey level possible of the image
RolandoV.Raqueo
33
Wednesday,August26,2015
RolandoV.Raqueo
0
255 0
0
128 0
128 128 128
34
0
0
255
0
0
128
255 255 255
Wednesday,August26,2015
PPM QUESTION
So what does the data
*4>HR\
look like as a
Raw PPM Image?
RolandoV.Raqueo
35
Wednesday,August26,2015
RolandoV.Raqueo
36
Wednesday,August26,2015
RolandoV.Raqueo
37
Wednesday,August26,2015
RolandoV.Raqueo
38
Wednesday,August26,2015
RolandoV.Raqueo
PNM
FILE
2X
Scale
39
PNM
FILE
RAST
FILE
Wednesday,August26,2015
40
Wednesday,August26,2015
RolandoV.Raqueo
41
maxval 255
Wednesday,August26,2015
Color histogram
ppmhist
RolandoV.Raqueo
42
Wednesday,August26,2015
% pnmcrop
usage: pnmcrop [-white|-black]
[-left] [-right] [-top] [bottom] [pnmfile]
RolandoV.Raqueo
43
Wednesday,August26,2015
% pnmpaste
pnmpaste [-replace|-or|-and |xor]
frompnmfile x y [intopnmfile]
RolandoV.Raqueo
44
Wednesday,August26,2015
RolandoV.Raqueo
45
Wednesday,August26,2015
Color Bands
Combination and Extraction
% rgb3ppm
rgb3toppm redpgmfile greenpgmfile
bluepgmfile
% ppmtorgb3
ppmtorgb3 [ppmfile]
results in .red .grn .blu
RolandoV.Raqueo
46
Wednesday,August26,2015
Spatial Operations
pnmconvol
pnmscale
pnmrotate
pnmflip
pnmshear
RolandoV.Raqueo
47
Wednesday,August26,2015
Greyscale/Color Operations
ppmquant
pnmdepth
ppmdither
RolandoV.Raqueo
48
Wednesday,August26,2015
RolandoV.Raqueo
49
Wednesday,August26,2015
RolandoV.Raqueo
50
Wednesday,August26,2015
RolandoV.Raqueo
51
Wednesday,August26,2015
set_plot,ps
device, Filename=new_plot.ps
plot, my_data,Title=Imaging Lab 1
device, /close
$lpr -Pdip new_plot.ps
RolandoV.Raqueo
52
Wednesday,August26,2015
RolandoV.Raqueo
53
Wednesday,August26,2015
Note Well
Always make sure that the printer to which
you will be sending your job is capable of
talking Postscript. If it does not, you will be
killing many trees.
To find out the status of your job
% lpq -P(printer name)
54
Wednesday,August26,2015
Getting Encapsulated
Postscript File (EPS)
To get a postscript file of your plot that you
can include into another document
IDL>
IDL>
IDL>
IDL>
IDL>
set_plot,ps
device, /encapsulated, /preview
device, Filename=new_plot.eps
plot, my_data,Title=Imaging Lab 1
device, /close
55
Wednesday,August26,2015
RolandoV.Raqueo
56
Wednesday,August26,2015