:: Chaitanya Sai Gaddam ::
CONFIGR: Algorithm and MATLAB Code Links
Links to the MATLAB implementation of CONFIGR (below) are placed in the context of Section 4 of the article:
Carpenter, G. A., Gaddam, C. S., & Mingolla, E. (2007). CONFIGR: A vision-based system for long-range figure completion. Neural Networks, 20(2007) 1109-1131. Technical Report CAS/CNS TR-2007-016, Boston, MA: Boston University.
http://cns.bu.edu/~gail/CONFIGR_TR-2007-016_.pdf
CONFIGR can be run from the command line in MATLAB by calling the function
runCONFIGR.m
To change input image and pixel size, follow directives included in the pseudocode below.
Usage:
I_output = runCONFIGR(I,PixRes)
This runs CONFIGR with the following defaults:
PixRes: pixel resolution default=1: CONFIGR pixel resolution is the same as that of the input image
Advanced Options:
I_output = runCONFIGR(I,PixRes,NumIter,ShrinkFact)
I: input image
PixRes: pixel resolution 1: fine 2: medium 3: coarse
The following options provide computational flexibility but are not model parameters.
NumIter: number of iterations CONFIGR simulation can be forced to stop early by setting a low number of iterations.
ShrinkFact: ratio of desired image size to actual size Sparse images can be resized for faster runtimes.
Raw CONFIGR output (ground and figure-filled rectangles, and interpolating diagonals)
can be obtained using [I_output, I_output_raw, Idiagonals]=runCONFIGR(I)
CONFIGR algorithm step 1: Preparing the image
Simple cell and complex cell activations are computed in
CONFIGR_6_FindBound.m
Image: Select a rectangular image.
Choose the spatial scale: Specify the size and location of one pixel in the designated image.
Storage matrices: Create matrices to store locations and variable values for pixels, subpixels,
grid subpixels, simple and complex cells, and lobe corners.
Figure and ground: Label each pixel as image-figure (1) or image-ground (0).
Simple cell activation: At each subpixel and for each orientation (N, S, E, W), compute the
simple cell activation (1 = active, 0 = inactive).
Complex cell activation: At each subpixel with an active simple cell, compute the vertical or
horizontal complex cell activation (1 = active, 0 = inactive).
CONFIGR algorithm step 2: Lobe initialization
Lobe iteration number: Set the lobe iteration number to 0.
Lobe activation: At each subpixel and for each orientation (N, S, E, W), compute the initial
lobe activation (1 = active, 0 = inactive).
Lobe corners: Specify each lobe corner type (NE, NW, SE, SW) and the location of its grid
subpixel.
Corner labels: Label each lobe corner as a filled corner or an empty ground corner.
Empty rectangles: Mark each empty rectangle.
Filling-in as ground: Relabel as filled-ground the pixels of each empty rectangle.
Update corner labels: Relabel the four lobe corners spanning each filled rectangle as filled
corners.
CONFIGR algorithm step 3:Lobe iterations
Lobe propagation is computed in:
CONFIGR_6_LobePropagate.m
Empty Rectangles are computed in:
EmptyRectangleTypeOne_Ground_6.m,
EmptyRectangleTypeTwo_Ground_6.m
LOBE STOPPING RULE:
Stop lobe propagation where two lobes form an empty corner.
Start lobe iterations {
Lobe iteration number: Increase the lobe iteration number by 1.
Lobe activation: At each subpixel and for each orientation (N, S, E, W), compute the lobe
activation (1 = active, 0 = inactive). Repeat for a total of five subpixel steps.
New corners: For each new lobe corner, specify each lobe corner type (NE, NW, SE, SW) and
the location of its grid subpixel.
Empty corner labels: Label each new lobe corner as empty figure, empty ground, or wall.
Relabel as wall each existing empty figure corner that is back-to-back with a new wall corner.
Empty rectangles: List all NW empty corners that are not walls.
For each listed corner, search for SE empty corners that span empty rectangles with this lobe
corner. When a NW-SE pair of empty corners spans an empty rectangle, mark it for potential
filling-in on this iteration.
Repeat the search, marking each NE-SW pair of empty corners that span an empty rectangle.
Sort the marked rectangles from smallest to largest.
GROUND FILLING RULE:
Relevant File:
FillingGROUND.m
An empty rectangle is eligible for filling-in as ground if it
contains an empty ground corner or if it shares an edge with one or more filled-ground pixels.
Loop from smallest to largest empty rectangle (filling-in as ground) {
Relabel as filled-ground the pixels of each empty rectangle that is the size of the loop's index
and that is eligible for filling-in as ground. Relabel as filled each corner whose defining lobes are
on the border or in the interior of the filled rectangle.
Update corners and rectangles
Relabel wall corners that have become empty figure or empty ground. For each such
corner, add newly created empty rectangles to the marked list.
Relabel as filled-ground the pixels of each newly created empty rectangle of size equal to
or smaller than the current loop size, if the rectangle is eligible for filling-in as ground.
Relabel newly filled corners.
Remove from the list of marked rectangles all that are no longer empty, because they
intersect newly filled rectangles.
Iterate corner and rectangle updates until no more changes occur.
} End empty rectangle loop (filling-in as ground)
FIGURE FILLING RULE: Remaining empty rectangles are eligible for filling-in as figure.
Relevant File:
FillingFIGURE.m
Loop from smallest to largest empty rectangle (filling-in as figure) {
Relabel as filled-figure the pixels of each empty rectangle that is the size of the loop's index.
Relabel as filled each corner whose defining lobes are on the border or in the interior of the filled
rectangle.
Update corners and rectangles
After all rectangles of the loop size have been filled as figure, relabel affected corners.
Some empty corners that had previously been wall may now be empty figure or empty
ground corners. For each such corner, add newly created empty rectangles to the marked
list. Fill as ground newly created marked rectangles, if the rectangle contains an empty
ground corner or is adjacent to one or more filled ground pixels.
Remove from the list of marked rectangles all that are no longer empty, because they
intersect newly filled rectangles.
Fill as figure each remaining newly created marked rectangle of size equal to or smaller
than the current loop size.
Remove from the list of marked rectangles all that are no longer empty, because they
intersect newly filled rectangles.
Iterate corner and rectangle updates until no more changes occur.
} End empty rectangle loop (filling-in as figure)
} End lobe iterations