-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_image_processing.m
More file actions
30 lines (30 loc) · 931 Bytes
/
basic_image_processing.m
File metadata and controls
30 lines (30 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
image = imread('C:\Users\SOHAM SAHA\Downloads\Girl1.jpg')
% figure
% imshow(image)
image1 = rgb2gray(image)
% figure
% imshow(image1)
% imhist(image1)
image2 = histeq(image1)
figure
% imhist(image2)
imshow(image2)
t = dctmtx(8)
image3 = im2double(image2)
image3 = imresize(image3,[512 512])
dct = @(block_struct)t * block_struct.data * t'
b = blockproc(image3,[8 8],dct)
mask = [1 1 1 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0]
bnew = blockproc(b,[8 8],@(block_struct)mask.*block_struct.data)
inversedct = @(block_struct)t' * block_struct.data * t
image4 = blockproc(bnew,[8 8],inversedct)
figure
imshow(image4)
imwrite(image4,'compressedgirl.jpg')