pb-lite implementation
The hypothesis of the project: having a bank of filters and masks, we can produce a texton map of an image and
after computing a gradients for it and for original we can combine them to get magnitude of feature distribution.
After pixel-wise comparison with baseline method we eliminate the unnecessary boundaries, producing a closer to
human perception result.
Boundary detection is a well studied tusk. Older algorithms like canny and sobel produce reasonable results,
looking for discontinuities in the image. This approach was recently outperformed by gPb which takes a probabilistic
approach to finding boundaries. Our algorithm is based on the same idea with some simplification of the original.
First we produce a filter bank which contains derivatives of a Gaussian filter rotated to different angles and computed
with different sigma values. After that we make a bank of masks that we later convolve with image and textons. Texton
is an image containing clustered representation of original image, identifying color(texture) distribution. In order
to produce a texton in the project, we use derivatives of Gaussian filters on the image. Later all the results are
clustered using kmeans into a texton map. In order to get final result we also compute texture and brightness gradients,
by going through masks and previously clustered buckets and collecting Chi-square distance for every mask. We do that
both for the texton map and for the image. After that we take the mean of both outcomes and do pixel-wise multiplication
with canny. This results in preserving canny lines, but removing some of them where the texton/image filter responses
were low. This saves mostly the boundaries that are not separating similar textures. The final result is higher than canny is 59%
of human perception.
The algorithm of the program:
original images are loaded, folders are created if needed
sobel responses are computed and saved
canny responses are computed and saved
possible orientations for filters and masks are set, sigmas for Gaussian set
filter bank:
calculate matrix of Gaussian filter
for every orientation and sigma create a filter (see image 1)
save in a cell
masks:
for every orientation and radius
create a disk filter (see image 2)
take half of it, rotate, crop
save to cell
pb-lite:
set number of clusters
or N images do:
convert image to grayscale
calculate texton image
get texton gradient
get image gradient
take the mean of gradients
pixel-wise combination with canny
results are shown (see below)
if needed croped and rescaled
Image 1. Filter bank (different orientations and scales ) Image 2. Half-disc Masks
Results
|