DIP-summary ch1,2,3&4
DIP-summary ch1,2,3&4
Chapter 1 | Introduction
What is a digital image?
1| P a g e Year 4
Semester 8
Artistic Effects: To create visually appealing or composite images.
Medical Imaging: MRI scans for tissue differentiation.
Geographic Information Systems (GIS): Satellite imagery analysis for meteorology
and terrain classification.
Industrial Inspection: PCB inspection to detect missing components.
Law Enforcement: Number plate and fingerprint recognition.
Human-Computer Interaction (HCI): face and gesture recognition.
The PDE has a simple text editor for writing code, a message area, a text console,
tabs for managing files, a toolbar for common actions, and various menus.
The default mode is Java, but it can change depending on the environment.
In Processing, a computer program is called a sketch, and sketches are stored in a
folder named Sketchbook on your computer.
2| P a g e Year 4
Semester 8
Basic Code Examples
Line Drawing:
void setup() {
size(500, 400);
void draw() {
Triangle Drawing:
void draw() {
triangle(60, 10, 25, 60, 75, 65);
line(60, 30, 25, 80);
line(25, 80, 75, 85);
line(75, 85, 60, 30);
}
void draw() {
ellipse(40, 40, 60, 60); // Circle
rect(50, 50, 30, 40); // Rectangle
}
3| P a g e Year 4
Semester 8
Quad Literal(Drawing Quadrilateral)
Void draw(){
quad(20, 20, 20, 70, 86, 90, 60, 40);
quad(20, 20, 30, -76, 110, 0, 60, 40);
}
PImage img;
img = loadImage("your_image.jpg");
image(img, x, y);
img.resize(width, height);
PImage
PImagehog1;void
hog1;voidsetup(){
setup(){
size(700, 500);
size(700, 500);
hog1 = loadImage("hog.jpg");
hog1
}void = loadImage("hog.jpg");
draw(){
image(hog1,
}void draw(){0, 0);
fill(0, 255, 0); 0, 0);
image(hog1,
ellipse(300, 200, 10, 10);
fill(0, 255, 0);
}
ellipse(300, 200, 10, 10);
}
4| P a g e Year 4
Semester 8
Loads an image and draws a green circle over it.
void setup() {
size(200, 200);
}void draw() {
background(255);
rectMode(CENTER);
rect(mouseX, mouseY, 50, 50);
}
Scales the image based on mouse position (width = mouseX, height = mouseY)
5| P a g e Year 4
Semester 8
PImage images;void setup(){
size(240,240);
images = loadImage("images.jpeg");
}
void draw(){
tint(255, 0, 0); // Apply red tint
image(images, 0, 0, mouseX,
mouseY);
}
void draw() {
background(255);
ellipseMode(CENTER);
rectMode(CENTER);
rect(100, 100, 20, 100); // Body
ellipse(100, 70, 60, 60); // Head
ellipse(81, 70, 16, 32); // Left eye
ellipse(119, 70, 16, 32); // Right eye
line(90, 150, 80, 160); // Left leg
line(110, 150, 120, 160); // Right leg
}
import javax.swing.JOptionPane;
6| P a g e Year 4
Semester 8
Chapter 4 |Introduction to MATLAB and image processing
Introduction
Image Types
Binary Images: Only black and white (0 or 1).
Grayscale Images: Shades of gray (0–255 for 8-bit images).
Color Images: Composed of three 2D arrays (RGB).
MATLAB supports multiple formats: JPEG, PNG, BMP, TIFF, etc.
I = imread('image.jpg');
imshow(I);
Writing Images
7| P a g e Year 4
Semester 8
Can specify format and filename.
Syntax example:
imwrite(I, 'output.png');
Image Conversion
C = A + B;
C = A & B;
Image Histogram
A histogram shows pixel intensity distribution.
imhist() displays the histogram.
Histogram equalization using histeq() improves contrast.
Image Filtering
8| P a g e Year 4
Semester 8
Filtering enhances or suppresses image features.
Types:
Edge Detection
BW = edge(I, 'canny');
Morphological Operations
Image Segmentation
9| P a g e Year 4
Semester 8