-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run.m
80 lines (72 loc) · 2.82 KB
/
Run.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
% =========================================================================
% University of Constantine-1
% Automatic and Robotic Laboratory
% Copyright(c) 2017 MESSAI Oussama
% e-mail: [email protected]
% All Rights Reserved.
%
% -------------------------------------------------------------------------
%%
clc;
clear;
close all; warning off;
addpath ( genpath ( '.mat files' ) );
addpath ( genpath ( 'Test_Stereo-Images' ) );
addpath ( genpath ( 'AdaBoost net' ) );
addpath ( genpath ( 'Cyclopean Image' ) );
load('features.mat');
Data = [features];
% Select the Stereo image and max disp
L = 20; % number of WeakLearners
max_disp = 25;
Id = imread('0.bmp');
sizeTemp = size (Id);
Id1 = rgb2gray(Id);
imL = Id1(:,1:sizeTemp(2)/2,:);
imR = Id1(:,sizeTemp(2)/2+1:end,:);
%% Mesure the quality of the Stereo Image
tic
[Img, dmap] = Cyclopean(imL,imR,max_disp);
% Img = uint8(Img); % DISPLAY THE CYCLOPEAN IMAGE
% figure, imshow(Img, []);
% figure, imshow(dmap, []);
%% scale 1:
f_im(1:3) = feature_extract(Img);
%% scale 2:
im2=imresize(Img,0.5);
f_im(4:6) = feature_extract(im2);
f_im(7:9) = feature_extract(dmap);
%% Assess the Quality
toc
[Score,WL_R] = BP_Ada(Data(:, [1:9]), Data(:, 10), f_im, L);
toc
RunTime = datestr(seconds(toc),'HH:MM:SS');
disp(['RunTime : ' num2str(RunTime)]);
%Data = struct('features',f_im, 'Score', Score(i)); % STOCK THE FEATURES AND QUALITY SCORES
disp(Score);
[S] = Q_Opinion(Score)
%% Metric Evaluation
% qualityFactor = 1:5:50;
% for i = 1:5
%
% %Deg = imnoise(Id,'gaussian',qualityFactor(i)/100);
% %imwrite(Deg,'NoiseImage.bmp','bmp');
% imwrite(Id,'compressedImage.jpg','jpg','quality',qualityFactor(i));
% Id2 = imread('compressedImage.jpg'); %figure, imshow(Id2);
% %Id = imread('NoiseImage.bmp');
% [Score(i),CImg, dmap, WL_R] = Stereo_Q(Id2,25,Data,20);
% [S] = Q_Opinion(Score(i))
% CImg = uint8(CImg); % DISPLAY THE CYCLOPEAN IMAGE
% figure, imshow(CImg);
% figure, imshow(dmap,[]);
%
%
% end
% %%
% %Plot the results. Note how the image quality score improves as you increase the quality value specified with imwrite.
% figure,
% plot(qualityFactor(1:5),Score(1:5),'b-o');
%
% xlabel('Distortion Factor');
% ylabel('Metric Value');
% grid on