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

Viewers also liked (19)

Impulse: Das müssen Unternehmer bei der SEPA-Umstellung beachten
Impulse: Das müssen Unternehmer bei der SEPA-Umstellung beachtenImpulse: Das müssen Unternehmer bei der SEPA-Umstellung beachten
Impulse: Das müssen Unternehmer bei der SEPA-Umstellung beachten
 
Presentac.. (2)
Presentac.. (2)Presentac.. (2)
Presentac.. (2)
 
2 2012 Novys Choice
2 2012 Novys Choice2 2012 Novys Choice
2 2012 Novys Choice
 
Inductivo
InductivoInductivo
Inductivo
 
91 -apague_o_cigarro_antes_de_jogar_no_lixo[1]
91  -apague_o_cigarro_antes_de_jogar_no_lixo[1]91  -apague_o_cigarro_antes_de_jogar_no_lixo[1]
91 -apague_o_cigarro_antes_de_jogar_no_lixo[1]
 
I pod übertragung software
I pod übertragung softwareI pod übertragung software
I pod übertragung software
 
Tc 20 hugger
Tc 20 huggerTc 20 hugger
Tc 20 hugger
 
Adelgazar rostro
Adelgazar rostroAdelgazar rostro
Adelgazar rostro
 
Dominó mágico
Dominó mágicoDominó mágico
Dominó mágico
 
Cuál es el desafío mn
Cuál es el desafío mnCuál es el desafío mn
Cuál es el desafío mn
 
El sistema solar y la tierra
El sistema solar y la tierraEl sistema solar y la tierra
El sistema solar y la tierra
 
Teste
TesteTeste
Teste
 
Ambiente
AmbienteAmbiente
Ambiente
 
LOAN MODIFICATION TESTIMONIALS-2
LOAN MODIFICATION TESTIMONIALS-2LOAN MODIFICATION TESTIMONIALS-2
LOAN MODIFICATION TESTIMONIALS-2
 
ΕΣΤΙΑ
ΕΣΤΙΑΕΣΤΙΑ
ΕΣΤΙΑ
 
Dietas de adelgazamiento
Dietas de adelgazamientoDietas de adelgazamiento
Dietas de adelgazamiento
 
Curso 3dmax avanzado
Curso 3dmax avanzadoCurso 3dmax avanzado
Curso 3dmax avanzado
 
Presentación2
Presentación2Presentación2
Presentación2
 
Aparatos para adelgazar
Aparatos para adelgazarAparatos para adelgazar
Aparatos para adelgazar
 

More from Kinni MEW (18)

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
 
Test
TestTest
Test
 
Test
TestTest
Test
 
Lec1
Lec1Lec1
Lec1
 

Test

  • 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