test of matrix average and RBG average
This commit is contained in:
parent
01f898b61b
commit
9d757d88f5
20
test_file.m
20
test_file.m
|
|
@ -4,9 +4,6 @@ clc
|
||||||
|
|
||||||
threshold = 1e-6;
|
threshold = 1e-6;
|
||||||
|
|
||||||
RGB_data = frames_RGBs ()';
|
|
||||||
length(RGB_data)
|
|
||||||
|
|
||||||
%TEST 1
|
%TEST 1
|
||||||
%Average of all the items inside of a matrix
|
%Average of all the items inside of a matrix
|
||||||
A = [1, 2; 3, 4];
|
A = [1, 2; 3, 4];
|
||||||
|
|
@ -15,4 +12,21 @@ if matrix_avg (A) - avg < threshold
|
||||||
disp('Test 1 passed gg')
|
disp('Test 1 passed gg')
|
||||||
else
|
else
|
||||||
disp('Test 1 failed, f')
|
disp('Test 1 failed, f')
|
||||||
|
endif
|
||||||
|
|
||||||
|
%TEST 2
|
||||||
|
%RGB average matrix of a red square
|
||||||
|
red = 'Red_square.jpg';
|
||||||
|
M = [2 0 254];
|
||||||
|
count = 0;
|
||||||
|
for i = 1:3
|
||||||
|
if abs(RGB_traces(red)(i) - M(i)) < threshold
|
||||||
|
count = count + 1;
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if count == 3
|
||||||
|
disp('Test 2 passed gg')
|
||||||
|
else
|
||||||
|
disp('Test 2 failed, f')
|
||||||
endif
|
endif
|
||||||
Loading…
Reference in New Issue