0% found this document useful (0 votes)
27 views3 pages

Tugaspcd

The document discusses completing a task involving image processing techniques in MATLAB. It involves loading an input image, and applying sharpening and embossing filters to the image. The sharpening filter enhances edges in the image, while the embossing filter adds shading to make the image appear three-dimensional. Code examples and resulting images are provided for applying each filter to an input image.

Uploaded by

Ari Kurnianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

Tugaspcd

The document discusses completing a task involving image processing techniques in MATLAB. It involves loading an input image, and applying sharpening and embossing filters to the image. The sharpening filter enhances edges in the image, while the embossing filter adds shading to make the image appear three-dimensional. Code examples and resulting images are provided for applying each filter to an input image.

Uploaded by

Ari Kurnianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Tugas PCD:

1. Menampilkan matrik citra input.


2. Buatlah program untuk penggunaan sharpening dan emboss.
Penyelesaian:
1. Matrik Citra Input
Source Code:
>>imread A(ari.jpg’)

Hasil Tampilan:

2. Sharpening
Source Code:
>> A = (ari.jpg)
>> imshow(A);
> in images.internal.initsSize (line 71)
In imshow.(line 305)
>> title (‘Original Image’);
>>B= imsharpen(A);
>>figure, imshow(B)
>in images.internal.initSize (line 71)
In imshow (line 305)
>>title(‘Filter sharpening image’);
Hasil Tampilan:

3. Emboss
Source Code:
>> img = imread('ari.jpg');
>> img = rgb2gray(img);
>> subplot(2,1,1);
>> imshow(img);
>> mask = [-1 0 0 ; 0 0 0 ; 0 0 1];
>> [rSize, cSize] = size(mask;

>> [rSize, cSize] = size(mask);


>> [nrow, ncol] = sie (img);

>> [nrow, ncol] = size (img);


>> img = cast(img, 'doble');
>> [nrow, ncol] = size (img);
>> img = cast(img, 'double');
>> newImage = zeros(nrow,ncol);
>> subMask = mask (2:3,2:3);
>> i = 1;
>> j = 1;
>> subMat = img (i:i+1,j:j+1);
>> newImg(i,j) = sum (sum (subMask.*subMat)) + 128;
>> subMask = mask(2:3,1:3);
i = 1;
for(j = 2:ncol-1)
subMat = img(i:i+1,j-1:j+1);
newImg(i,j) = sum(sum(subMask.*subMat)) + 128;
end
>> subMask = mask(1:2,1:3);
i = nrow;
for(j = 2:ncol-1)
subMat = img(i-1:i,j-1:j+1);
newImg(i,j) = sum(sum(subMask.*subMat)) + 128;
end
>> subMask = mask(1:3,2:3);
j = 1;
for(i = 2:nrow-1)
subMat = img(i-1:i+1,j:j+1);
newImg(i,j) = sum(sum(subMask.*subMat)) + 128;
end
>> subMask = mask(1:3,1:2);
j = ncol;
for(i = 2:nrow-1)
subMat = img(i-1:i+1,j-1:j);
newImg(i,j) = sum(sum(subMask.*subMat)) + 128;
end
>> for(i = 0.5*(rSize+1) : nrow - 0.5*(rSize+1))
for(j = 0.5*(cSize+1) : ncol - 0.5*(cSize+1))
subMat = img(i-1:i+1,j-1:j+1);
newImg(i,j) = sum(sum(subMat.*mask)) + 128;
end
end

subplot(2,1,2);
newImg = cast(newImg, 'uint8');
imshow(newImg);

end
end
imshow(newImg);

Hasil Tampilan:

You might also like