Skip to content

kalleknast/BOLAR

Repository files navigation

BOLAR

An algorithm to measure image differences based on the primate visual system. BOLAR was developed by Zelinsky (2003).

What it is

BOLAR -- Bank Of Local Analyzer Responses -- is a model for measuring image difference. This is useful in visual Psychology/Neuroscience experiments when some measure of image differences is needed.

It works by filtering images through banks of oriented filters at different spatial scales. In this way, it is similar to the HMAx model by Riesenhuber & Poggio (1999), which is a computational model of neural responses in visual cortex. However, BOLAR is not developed as a model of cortical responses, but as a simple and flexible model that can account for some experimental effects in Psychology on vison.

How it works

The images are filtered with Gaussian derivative filters up to the 3rd order, at 4 spatial scales. Each order provides order + 1 filters, reulting in 9 (2 + 3 + 4) filters at each of the 4 scales.

filters, n_filt = get_filters(image.shape)

These 36 filters are applied 3 times in order to capture chromatic information. First, achromatic, the average of the RGB channels, second, the red green difference, and third the difference between yellow (average or red and green) and blue. This is done over all pixes in of an image, resulting in a 108 valued BOLAR vector of filter responses for each pixel.

The normalized Euclidean distance between BOLAR vectors from a pair of images provides a map of image differences.

e = compare_image_pair(image1, image2)

Finally, this difference map can be summed, providing a single value quantifying image differences. To do this over a list of images call:

E = compare_images(images, verbose=False)

This square distance matrix can be used to further analyse image similarity with, for example, a dendrogram:

from scipy.cluster import hierarchy

Z = hierarchy.linkage(E)
dd = hierarchy.dendrogram(Z)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages