In [1]:
using RODClf, Images
In [2]:
#test image data
imgobj = img_load("test.jpg");
test_image = separate(Image(imgobj.image, imgobj.properties));
In [3]:
filter_shape = FilterGeometry(8, 8, 4, 5, 3, 2, 1, 1);
In [4]:
dx_resolution = filter_shape.dx_resolution
dy_resolution = filter_shape.dy_resolution;
In [5]:
dx_units = filter_shape.dx_units
dy_units = filter_shape.dy_units;
In [6]:
x_units = filter_shape.x_units
y_units = filter_shape.y_units;
In [7]:
dx = signed(imgobj.ndims[1]/dx_resolution-0.5)
dy = signed(imgobj.ndims[2]/dy_resolution-0.5);
In [80]:
x_offset = 0
y_offset = 0;
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
In [65]:
tot = 0
for pt in x[1]
tot += pt
end
print(tot)
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]:
In [66]:
dy
Out[66]:
In [77]:
Out[77]:
In [ ]: