Sampled Static Visual Content
An Introduction with Examples in Java
|
Prof. David Bernstein
James Madison University
|
|
Computer Science Department
|
bernstdh@jmu.edu
|
"Quick Start"
Reading Sampled Visual Content
javaexamples/visual/statik/sampled/ImageCanvasApp.java
(Fragment: part2)
"Quick Start" (cont.)
Rendering Sampled Visual Content
javaexamples/visual/statik/sampled/ImageCanvas.java
"Quick Start" (cont.)
The Complete App
javaexamples/visual/statik/sampled/ImageCanvasApp.java
Manipulating BufferedImage
Objects
javaexamples/visual/statik/sampled/IdentityOp.java
(Fragment: copy)
Constructing BufferedImage
Objects
javaexamples/visual/statik/sampled/ImageFactory.java
(Fragment: step)
Constructing BufferedImage
Objects (cont.)
From a File/Resource
javaexamples/visual/statik/sampled/ImageFactory.java
(Fragment: method2)
Operating on Sampled Content (cont.)
An IdentityOp
javaexamples/visual/statik/sampled/IdentityOp.java
(Fragment: 1)
javaexamples/visual/statik/sampled/IdentityOp.java
(Fragment: 2)
javaexamples/visual/statik/sampled/IdentityOp.java
(Fragment: 3)
Operating on Sampled Content (cont.)
A More Interesting Example: GrayExceptOp
javaexamples/visual/statik/sampled/GrayExceptOp.java
(Fragment: skeleton)
Operating on Sampled Content (cont.)
Metrics
javaexamples/math/Metric.java
javaexamples/math/RectilinearMetric.java
Operating on Sampled Content (cont.)
GrayExceptOp.areSimilar()
(cont.)
javaexamples/visual/statik/sampled/GrayExceptOp.java
(Fragment: areSimilar)
Operating on Sampled Content (cont.)
GrayExceptOp
(cont.)
javaexamples/visual/statik/sampled/GrayExceptOp.java
(Fragment: filter)
Convolutions (cont.)
The Kernel as a Grid/Matrix
Convolutions (cont.)
Applying the Convolution to One Pixel
\(
d_{i,j} = \sum_{r=-1}^{1} \sum_{c=-1}^{1} s_{i+r, j+c} k_{r,c}
\)
A System for Constructing Convolutions
Requirements
- Create different
BufferedImageOp
objects
- Conserve memory used for kernels
A System for Constructing Convolutions (cont.)
A Low-Level Design that Leads to a Repetitive Implementation
javaexamples/visual/statik/sampled/RepetitiveBufferedImageOpFactory.java
A System for Constructing Convolutions (cont.)
A Good Low-Level Design
javaexamples/visual/statik/sampled/BufferedImageOpFactory.java
(Fragment: createOp)
A System for Constructing Convolutions (cont.)
An Unmaintainable Imeplementation of the Enumeration
javaexamples/visual/statik/sampled/UnmaintainableConvolutions.java
A System for Constructing Convolutions (cont.)
A Good Imeplementation of the Enumeration
javaexamples/visual/statik/sampled/Convolutions.java
A System for Constructing Convolutions (cont.)
A Good Factory
javaexamples/visual/statik/sampled/BufferedImageOpFactory.java
Affine Transformations (cont.)
Scaling
javaexamples/visual/statik/sampled/BufferedImageOpFactory.java
(Fragment: AffineTransformOp)
Affine Transformations (cont.)
Rotation
javaexamples/visual/statik/sampled/RotationApp.java
(Fragment: rotate)
Look-Ups (cont.)
Creating a Photo Negative
javaexamples/visual/statik/sampled/BufferedImageOpFactory.java
(Fragment: LookupOp1)
Look-Ups (cont.)
"Night Vision"
javaexamples/visual/statik/sampled/BufferedImageOpFactory.java
(Fragment: LookupOp2)
Color Space Conversion
javaexamples/visual/statik/sampled/BufferedImageOpFactory.java
(Fragment: ColorConvertOp)
Cropping/Cutting (cont.)
An Example
javaexamples/visual/statik/sampled/SurveillanceApp.java
(Fragment: crop)
Implementing this Design
The Overall Structure
javaexamples/visual/statik/sampled/Content.java
(Fragment: skeleton)
Implementing this Design (cont.)
The "Setters"
javaexamples/visual/statik/sampled/Content.java
(Fragment: set)
Implementing this Design (cont.)
Transformations
javaexamples/visual/statik/sampled/Content.java
(Fragment: transform)
Implementing this Design (cont.)
Rendering
javaexamples/visual/statik/sampled/Content.java
(Fragment: render)
Implementing this Design (cont.)
A Factory
javaexamples/visual/statik/sampled/ContentFactory.java
There's Always More to Learn