An exploration of undergraduates’ vocabulary size and academic achievement
Digital image processing using Matlab -...
Transcript of Digital image processing using Matlab -...
Digital image processingusing Matlab
Seung Ho Kim
051-510-3921
010-2107-9925
기계관 3301호
Digital image processing
• 디지털 화상처리 또는 디지털 영상 처리는 컴퓨터 알고리즘을 사용하여
디지털 이미지에 대한 화상처리를 수행하는 것이다. 디지털 신호처리의 하
위분야로, 디지털 영상처리는 아날로그 영상처리에 비해 많은 장점이 있다.
입력자료에 더욱 광범위한 알고리즘을 적용 가능하게 되고, 처리 도중 발
생하는 잡음과 신호 왜곡과 같은 문제들을 방지할 수 있다.
• 디지털 영상 처리는 영상 처리를 위한 훨씬 더 복잡한 알고리즘 사용을 가
능하게 하므로, 단순작업에 더욱 정교한 성능과 아날로그 수단으로는 불가
능한 방법의 실행, 양쪽을 가능하게 한다.
Matlab
• For : for-end is a repetition statement providing a loop for automatic iteration over a range of numbers or objects.
• Ex 1) 𝑖=110 𝑖
sum = 0;for i = 1:1:10
sum = sum + i;end
Matlab - function
Function Definition Input variable
Imread Read a image filename, format
Imwrite Write a image as a file image, filename
Imshow Display image image, display range
imagesc Display image object image
Matlab – image I/O
• Use ‘imread’ (‘dicomread’)
• Img = imread(‘TestImg.jpg’);
• ImgBw = sum(double(Img),3)/3;
• imwrite(ImgBw , ’TestImgBw.jpg’);
Matlab – image filter
• img = imread('peppers.png');
• h = fspecial('gaussian', 30, 5);
• imgFilt = imfilter(img , h , 'replicate');
• figure, imshow(imgFilt, [])
Matlab – image filter
• High-pass filtering
-1 0 1
-2 0 2
-1 0 1
1 2 1
0 0 0
-1 -2 -1
-1 -1 -1
-1 8 -1
-1 -1 -1
-1 0 1
-1 0 1
-1 0 1
Sobel Laplacian Prewitt
h = [-1 0 1; -2 0 2; -1 0 1];
Frequency domain filter
• img = imread('lena.jpg');
• img2 = sum(double(img),3);
•F = fftshift(fft2(img2));
• [M N] = size(img);
• sig = 10;
•H = fspecial('gaussian', M, sig);
•G = H.×F;
•g = ifft2(fftshift(G));
Gamma transform
0.5
1
1.5
𝛾=𝛾=1.5 𝛾=1 𝛾=0.5
• img = double(dicomread(‘Chest.dcm'));• f = img/max(img(:));• g = (f.^1.5)
Histogram = zeros(max(max(Img)),1);
for i=1:size(Img,1)
for j=1:size(Img,2)
Histogram(Img(i,j)) = Histogram(Img(i,j))+1;
end
end
for i=1:numel(Histogram);
CumSum(i) = sum(Histogram(1:i));
end
ni = CumSum/size(Img,1)/size(Img,2)*max(max(Img));
Img2 = zeros(size(Img));
for i=1:size(Img,1)
for j=1:size(Img,2)
Img2(i,j) = round(ni(Img(i,j)))+1;
end
end