-
Notifications
You must be signed in to change notification settings - Fork 1
/
FinalAttempt.m
85 lines (85 loc) · 3.04 KB
/
FinalAttempt.m
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
clc
clear all;
close all;
pkg load image;
IReal = imread('real_1_changed.jpg');
IFake = imread('dupe_1_changed.jpg');
#imshow(IReal);
#title("Real");
#figure;
#imshow(IFake);
#title("Fake");
figure;
rgb_D = sum( abs(IReal(:)-IFake(:)) > eps ) / numel(IReal);
hsvIR = rgb2hsv(IReal);
hueIR = hsvIR(:,:,1);
satIR = hsvIR(:,:,2);
valIR = hsvIR(:,:,3);
hsvIF = rgb2hsv(IFake);
hueIF = hsvIF(:,:,1);
satIF = hsvIF(:,:,2);
valIF = hsvIF(:,:,3);
#imshow(hueIR);
#title("hue of real image");
#figure;
#imshow(hueIF);
#title("hue of fake image");
#figure;
#imshow(satIR);
#title("saturation of real image");
#figure;
#imshow(satIF);
#title("saturation of fake image");
#figure;
imshow(valIR);
title("value of real image");
#figure;
#imshow(valIF);
#title("value of fake image");
hue_D = sum( abs(hueIR(:)-hueIF(:)) > eps ) / numel(hueIR);
sat_D = sum( abs(satIR(:)-satIF(:)) > eps ) / numel(satIR);
val_D = sum( abs(valIR(:)-valIF(:)) > eps ) / numel(valIR);
BWReal = rgb2gray(IReal);
BWFake = rgb2gray(IFake);
#EdgeIR1 = edge (BWReal, "Canny");
#EdgeIF1 = edge (BWFake, "Canny");
#EdgeIR2 = edge (BWReal, "Kirsch");
#EdgeIF2 = edge (BWFake, "Kirsch");
EdgeIR3 = edge (BWReal, "Lindeberg");
EdgeIF3 = edge (BWFake, "Lindeberg");
#imshow(EdgeIR3);
#title("Egde of real image")
#figure;
#imshow(EdgeIF3);
#title("Edge of fake image")
#EdgeIR4 = edge (BWReal, "LoG");
#EdgeIF4 = edge (BWFake, "LoG");
#EdgeIR5 = edge (BWReal, "Prewitt");
#EdgeIF5 = edge (BWFake, "Prewitt");
#EdgeIR6 = edge (BWReal, "Roberts");
#EdgeIF6 = edge (BWFake, "Roberts");
#EdgeIR7 = edge (BWReal, "Sobel");
#EdgeIF7 = edge (BWFake, "Sobel");
#ed1_D = sum( abs(EdgeIR1(:)-EdgeIF1(:)) > eps ) / numel(EdgeIR1);
#ed2_D = sum( abs(EdgeIR2(:)-EdgeIF2(:)) > eps ) / numel(EdgeIR2);
ed3_D = sum( abs(EdgeIR3(:)-EdgeIF3(:)) > eps ) / numel(EdgeIR3);
#ed4_D = sum( abs(EdgeIR4(:)-EdgeIF4(:)) > eps ) / numel(EdgeIR4);
#ed5_D = sum( abs(EdgeIR5(:)-EdgeIF5(:)) > eps ) / numel(EdgeIR5);
#ed6_D = sum( abs(EdgeIR6(:)-EdgeIF6(:)) > eps ) / numel(EdgeIR6);
#ed7_D = sum( abs(EdgeIR7(:)-EdgeIF7(:)) > eps ) / numel(EdgeIR7);
disp(['The ratio of rgb difference between the images is ' num2str(rgb_D)]);
disp(['The ratio of difference in the hue of the images is ' num2str(hue_D)]);
disp(['The ratio of difference in the saturation of the images is ' num2str(sat_D)]);
disp(['The ratio of difference in the value of the images is ' num2str(val_D)]);
#disp(['The ratio of difference in the Canny Edge of the images is ' num2str(ed1_D)]);
#disp(['The ratio of difference in the Kirsch Edge of the images is ' num2str(ed2_D)]);
disp(['The ratio of difference in the Lindeberg Edge of the images is ' num2str(ed3_D)]);
#disp(['The ratio of difference in the Laplacian of Gaussian Edge of the images is ' num2str(ed4_D)]);
#disp(['The ratio of difference in the Prewitt Edge of the images is ' num2str(ed5_D)]);
#disp(['The ratio of difference in the Roberts Edge of the images is ' num2str(ed6_D)]);
#disp(['The ratio of difference in the Sobel Edge of the images is ' num2str(ed7_D)]);
#imshow(EdgeIR1);
#title("Real");
#figure;
#imshow(EdgeIF1);
#title("Fake");