In [1]:
using RODClf, Images

Load test image data


In [2]:
#test image data
imgobj = img_load("test.jpg");
test_image = separate(Image(imgobj.image, imgobj.properties));

Define filter geometry


In [3]:
filter_shape  = FilterGeometry(8, 8, 4, 5, 3, 2, 1, 1);

Define how many segments the 'x' and 'y' axis should be split into


In [4]:
dx_resolution = filter_shape.dx_resolution
dy_resolution = filter_shape.dy_resolution;

Define how many segments are required for both 'x' and 'y' axis


In [5]:
dx_units = filter_shape.dx_units
dy_units = filter_shape.dy_units;

Define number of visible panels on 'x' and 'y' axis; corresponds to lateral and vertical split


In [6]:
x_units = filter_shape.x_units
y_units = filter_shape.y_units;

Create 'dx' and 'dy' values for 'x' and 'y' axis, measured in pixels


In [7]:
dx = signed(imgobj.ndims[1]/dx_resolution-0.5)
dy = signed(imgobj.ndims[2]/dy_resolution-0.5);

Define filter-offset


In [80]:
x_offset = 0
y_offset = 0;

Generate filter-coefficients (with offset)

Initialise empty array, 'x', iterate over 'panels' in filter, generating the filter-coefficients for each dimension

In [53]:
x = Array[]
for j in [1:y_units]
    for i in [1:x_units]
        #push!(x, test_image.data[dy*j:dy*dy_units, dx*i:dx*dx_units, :])
        if j == 1
            if i == 1
                push!(x, test_image.data[1*(y_offset+1):((dy*j)-1)*(y_offset+1), 1*(x_offset+1):(dx*i)*(x_offset+1), :])
            else
                push!(x, test_image.data[1*(y_offset+1):((dy*j)-1)*(y_offset+1), (dx*i)*(x_offset+1):((dx*(i+1))-1)*(x_offset+1), :])
                
            end
        else
            if i == 1
                push!(x, test_image.data[(dy*j)*(y_offset+1):(dy*(j+1)-1)*(y_offset+1), 1*(x_offset+1):(dx*i)*(x_offset+1), :])
            else
                push!(x, test_image.data[(dy*j)*(y_offset+1):(dy*(j+1)-1)*(y_offset+1), (dx*i)*(x_offset+1):((dx*(i+1))-1)*(x_offset+1), :])
            end
        end
    end
end

Calculate image integral


In [65]:
tot = 0
for pt in x[1]
    tot += pt
end
print(tot)


12805.176470587205

In [68]:
Image(x[1], test_image.properties)


Out[68]:

In [81]:
[   (1 * (y_offset+1) * dy) - dy  :     ((dy*1)-1) * (y_offset+1)     ]


Out[81]:
81-element Array{Int64,1}:
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
  ⋮
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80

In [66]:
dy


Out[66]:
81

In [77]:



Out[77]:
81

In [ ]: