In [23]:
using RODClf, Images
In [24]:
#test image data
imgobj = img_load("test.jpg");
test_image = separate(Image(imgobj.image, imgobj.properties));
In [25]:
filter_shape = FilterGeometry(8, 8, 4, 5, 3, 2, 0, 0);
In [26]:
dx_resolution = filter_shape.dx_resolution
dy_resolution = filter_shape.dy_resolution;
In [27]:
dx_units = filter_shape.dx_units
dy_units = filter_shape.dy_units;
In [28]:
x_units = filter_shape.x_units
y_units = filter_shape.y_units;
In [29]:
dx = signed(imgobj.ndims[1]/dx_resolution-0.5)
dy = signed(imgobj.ndims[2]/dy_resolution-0.5);
In [30]:
x_offset = filter_shape.x_offset;
y_offset = filter_shape.y_offset;
In [31]:
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
In [39]:
function integral_sum2(x)
tot = 0
for pt in x
tot += pt
end
print(tot)
end
@time integral_sum2(x[2])
In [43]:
@time integral_sum(x[1])
Out[43]:
In [16]:
Image(x[1], test_image.properties)
Out[16]:
In [44]:
x_offset = 1
y_offset = 1;
[ (1 * (y_offset+1) * dy) - dy : ((dy*1)-1) * (y_offset+1) ]
Out[44]:
In [14]:
test_image.properties
Out[14]: