src/quadtree.h
: A C++
implementation of region quadtrees for performing various operations on binary images
Operations supported:
set(int x1, int y1, int x2, int y2, int b)
: Set all pixels in the sub-matrix/sub-image with rowsx1
tox2
and columnsy1
toy2
(inclusive) to the valueb
get(int x1, int y1)
: Return the value of the pixel at(x1, y1)
overlap(quad_tree const &Q)
: Pixel-wise booleanOR
/ Image unionintersect(quad_tree &Q)
: Pixel-wise booleanAND
/ Image intersectioncomplement()
: Complement all the entries in the binary imageresize(int m)
: Resizes the image to2^m * 2^m
extract(int x1, int y1, int m)
: Extracts the2^m * 2^m
submatrix with rows fromx1
tox1+2^m-1
and columnsy1
toy1+2^m-1
/ Image cropping
(This was done as a course assignment for CS 213: Data Structures and Algorithms, IIT Bombay)