2 Gyakorlat

You might also like

You are on page 1of 8

1.

feladat
• RGB kép beolvasása és megjelenítése.

I = imread('ngc6543a.jpg');

R=I(:,:,1);
G=I(:,:,2);
B=I(:,:,3);

subplot(2,2,1)
imshow(I)
subplot(2,2,2)
imshow(R)
subplot(2,2,3)
imshow(G)
subplot(2,2,4)
imshow(B)
2. feladat
• Indexelt kép beolvasása és konvertálása RGB-be

[X,map] = imread('corn.tif');
Im = ind2rgb(X,map);
whos Im

subplot(2,1,1)
imshow(X)
subplot(2,1,2)
imshow(Im)
3. feladat
• Szürkeárnyalatos kép beolvasása és világosítása

clear
close all
I = imread('pout.tif');
imshow(I)

I2=I;
for i=1:size(I,1)
for j=1:size(I,2)
tmp=I(i,j)+20;
if tmp>255
I2(i,j) = 255;
else
I2(i,j) = tmp;
end
end
end

subplot(2,1,1)
imshow(I)
subplot(2,1,2)
imshow(I2)
4. feladat
• Kép mentése fájlba

• imwrite(A,filename)

• imwrite(I2,'pout22.tif')
Egyéb beépített képek
• football.jpg
• trees.tif
• mri.tif
• cameraman.tif
• board.tif
• tissue.png
• tire.tif
• shadow.tif
• rice.png
• westconcordaerial.png
• onion.png
• peppers.png
• stb.
5. feladat
• Alakítsunk át egy RGB képet YUV színrendszerbe
Konverziók
• gray2ind - Convert grayscale or binary image to indexed image
• ind2gray - Convert indexed image to grayscale image
• rgb2gray - onvert RGB image or colormap to grayscale
• ind2rgb - Convert indexed image to RGB image

• im2bw - Convert image to binary image, based on threshold


• grayslice - Convert grayscale image to indexed image using multilevel
thresholding
6. feladat
I = imread('cameraman.tif');
[X, map] = gray2ind(I, 16);
imshow(X, map);

You might also like