SlideShare a Scribd company logo
1 of 1
Download to read offline
Tutorial 1

Question 1
Assume that humans have the ability to tell the gender and approximate age by looking at
the picture of an unknown person? If a computer can be made to have the same ability,
what kinds of information the computer must possess?

Question 2
Write a program to reduce the size of an image by half.

Question 3
Write a program to count the number of bright pixels (pixel value >= 200) in an image.

                                  Tutorial 1 Solution

Question 2
function halfim
%   reduce the image size by half

image = imread('baboon64g.bmp');
imshow(image)
[height, width] = size(image);
y = 1;
for i = 1:2:height
    x = 1;
    for j = 1:2:width
        halfimage(y, x) = image(i, j);
        x = x + 1;
    end
    y = y + 1;
end
figure
imshow(halfimage)
end

Question 3
function [count] = countbrightpixels
%   count the number of pixels >= 200

image = imread('lenna_gray.bmp');
[height, width] = size(image);
count = 0;
for i = 1:height
    for j = 1:width
        if image(i, j) >= 200
            count = count + 1;
        end
    end
end
end

More Related Content

What's hot

Visual cryptography scheme for color images
Visual cryptography scheme for color imagesVisual cryptography scheme for color images
Visual cryptography scheme for color imagesiaemedu
 
Assignment 3 part 2
Assignment 3 part 2Assignment 3 part 2
Assignment 3 part 2kwebb2
 
Digital graphics technology
Digital graphics technologyDigital graphics technology
Digital graphics technologyhaverstockmedia
 
Naveen 9911103606 major ppt
Naveen 9911103606 major pptNaveen 9911103606 major ppt
Naveen 9911103606 major pptNaveen Rajgariya
 
An improved hdr image processing using fast global tone mapping
An improved hdr image processing using fast global tone mappingAn improved hdr image processing using fast global tone mapping
An improved hdr image processing using fast global tone mappingeSAT Journals
 
An improved hdr image processing using fast global
An improved hdr image processing using fast globalAn improved hdr image processing using fast global
An improved hdr image processing using fast globaleSAT Publishing House
 
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHMA MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHMcsandit
 
IRJET- Contrast Enhancement of Grey Level and Color Image using DWT and SVD
IRJET-  	  Contrast Enhancement of Grey Level and Color Image using DWT and SVDIRJET-  	  Contrast Enhancement of Grey Level and Color Image using DWT and SVD
IRJET- Contrast Enhancement of Grey Level and Color Image using DWT and SVDIRJET Journal
 
Digital image processing
Digital image processingDigital image processing
Digital image processingtushar05
 

What's hot (13)

Visual cryptography scheme for color images
Visual cryptography scheme for color imagesVisual cryptography scheme for color images
Visual cryptography scheme for color images
 
Graphic concept
Graphic conceptGraphic concept
Graphic concept
 
Assignment 3 part 2
Assignment 3 part 2Assignment 3 part 2
Assignment 3 part 2
 
Digital graphics technology
Digital graphics technologyDigital graphics technology
Digital graphics technology
 
Ijetr011958
Ijetr011958Ijetr011958
Ijetr011958
 
Naveen 9911103606 major ppt
Naveen 9911103606 major pptNaveen 9911103606 major ppt
Naveen 9911103606 major ppt
 
of Pixels and Bits
of Pixels and Bitsof Pixels and Bits
of Pixels and Bits
 
Image processing ppt
Image processing pptImage processing ppt
Image processing ppt
 
An improved hdr image processing using fast global tone mapping
An improved hdr image processing using fast global tone mappingAn improved hdr image processing using fast global tone mapping
An improved hdr image processing using fast global tone mapping
 
An improved hdr image processing using fast global
An improved hdr image processing using fast globalAn improved hdr image processing using fast global
An improved hdr image processing using fast global
 
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHMA MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
A MODIFIED HISTOGRAM BASED FAST ENHANCEMENT ALGORITHM
 
IRJET- Contrast Enhancement of Grey Level and Color Image using DWT and SVD
IRJET-  	  Contrast Enhancement of Grey Level and Color Image using DWT and SVDIRJET-  	  Contrast Enhancement of Grey Level and Color Image using DWT and SVD
IRJET- Contrast Enhancement of Grey Level and Color Image using DWT and SVD
 
Digital image processing
Digital image processingDigital image processing
Digital image processing
 

Viewers also liked

Feature detection - Image Processing
Feature detection - Image ProcessingFeature detection - Image Processing
Feature detection - Image ProcessingRitesh Kanjee
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesDiwaker Pant
 
Digital Image Processing Fundamental
Digital Image Processing FundamentalDigital Image Processing Fundamental
Digital Image Processing FundamentalThuong Nguyen Canh
 

Viewers also liked (7)

Test
TestTest
Test
 
Computer vision
Computer visionComputer vision
Computer vision
 
Lec1
Lec1Lec1
Lec1
 
Test
TestTest
Test
 
Feature detection - Image Processing
Feature detection - Image ProcessingFeature detection - Image Processing
Feature detection - Image Processing
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement Techniques
 
Digital Image Processing Fundamental
Digital Image Processing FundamentalDigital Image Processing Fundamental
Digital Image Processing Fundamental
 

More from Kinni MEW (15)

Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Test
TestTest
Test
 

Tutorial 1: Image Processing Techniques

  • 1. Tutorial 1 Question 1 Assume that humans have the ability to tell the gender and approximate age by looking at the picture of an unknown person? If a computer can be made to have the same ability, what kinds of information the computer must possess? Question 2 Write a program to reduce the size of an image by half. Question 3 Write a program to count the number of bright pixels (pixel value >= 200) in an image. Tutorial 1 Solution Question 2 function halfim % reduce the image size by half image = imread('baboon64g.bmp'); imshow(image) [height, width] = size(image); y = 1; for i = 1:2:height x = 1; for j = 1:2:width halfimage(y, x) = image(i, j); x = x + 1; end y = y + 1; end figure imshow(halfimage) end Question 3 function [count] = countbrightpixels % count the number of pixels >= 200 image = imread('lenna_gray.bmp'); [height, width] = size(image); count = 0; for i = 1:height for j = 1:width if image(i, j) >= 200 count = count + 1; end end end end