-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperform_kstest.m
More file actions
52 lines (34 loc) · 1.59 KB
/
perform_kstest.m
File metadata and controls
52 lines (34 loc) · 1.59 KB
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
function [ ksResults ] = perform_kstest( img, deltaRow, deltaCol )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%deltaCol = 8;
%deltaRow = 8;
index = 1; jindex = 1;
rowIndex = 1;
[ rowSize, colSize, colorSize ] = size(img);
ksResults = zeros( rowSize/deltaRow, colSize/deltaCol, colorSize );
% Iterating across the rows... we'll fix on one set of rows
while (rowIndex + deltaRow) <= rowSize
colIndex = 1;
jindex = 1;
% Iterating across one row, we'll iterate over a set of columns
while colIndex <= colSize
block1 = getBlock( img, rowIndex, deltaRow, colIndex, deltaCol);
block2 = getBlock( img, rowIndex+deltaRow, deltaRow, colIndex, deltaCol );
% We have 2 blocks of rows and cols, iterate over their
% sub matrices..
for colorIndex = 1:3
[ count1, ~ ] = imhist( block1( :, :, colorIndex ) );
[ count2, ~ ] = imhist( block2( :, :, colorIndex ) );
cdf1 = cumsum( count1 ) / sum( count1 );
cdf2 = cumsum( count2 ) / sum( count2 );
ksResults( index, jindex, colorIndex ) = ...
kstest2( cdf1, cdf2, 'Alpha', 0.05 );
end
colIndex = colIndex + deltaCol;
jindex = jindex + 1;
end
rowIndex = rowIndex + deltaRow;
index = index + 1;
end
end