MP5
Photomosaic
maptiles.cpp File Reference

Code for the maptiles function. More...

#include <iostream>
#include <map>
#include "maptiles.h"
+ Include dependency graph for maptiles.cpp:

Functions

MosaicCanvasmapTiles (SourceImage const &theSource, vector< TileImage > &theTiles)
 Map the image tiles into a mosaic canvas which closely matches the input image. More...
 
TileImageget_match_at_idx (const KDTree< 3 > &tree, map< Point< 3 >, int > tile_avg_map, vector< TileImage > &theTiles, const SourceImage &theSource, int row, int col)
 Find the closest TileImage for a particular row and column. More...
 

Detailed Description

Code for the maptiles function.

Function Documentation

MosaicCanvas* mapTiles ( SourceImage const &  theSource,
vector< TileImage > &  theTiles 
)

Map the image tiles into a mosaic canvas which closely matches the input image.

Todo:
This function is required for MP 5.2.
Parameters
theSourceThe input image to construct a photomosaic of
theTilesThe tiles image to use in the mosaic
Todo:
Implement this function!
TileImage* get_match_at_idx ( const KDTree< 3 > &  tree,
map< Point< 3 >, int >  tile_avg_map,
vector< TileImage > &  theTiles,
const SourceImage theSource,
int  row,
int  col 
)

Find the closest TileImage for a particular row and column.

This involves creating a representative TileImage to search for, and querying the KDTree for the nearest neighbor

Parameters
treeThe KDTree to search in
tile_avg_mapMaps points to indices in the TileImage vector
theTilesTiles to be used in the Photomosaic
theSourceThe image to make a Photomosaic of
rowThe row of the source image
colThe column of the source image
Returns
the "nearest neighbor" tile