-
Notifications
You must be signed in to change notification settings - Fork 0
/
maptiles.h
55 lines (50 loc) · 1.57 KB
/
maptiles.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* @file maptiles.h
*
* mapTiles() function.
* Developed for CS225 PhotoMosaic MP
*
* @author Jack Toole
* @date Fall 2011
*/
#ifndef MAPTILES_H
#define MAPTILES_H
#include <map>
#include <vector>
#include "cs225/PNG.h"
#include "kdtree.h"
#include "mosaiccanvas.h"
#include "sourceimage.h"
#include "tileimage.h"
using namespace std;
using namespace cs225;
/**
* Map the image tiles into a mosaic canvas which closely
* matches the input image.
*
* @todo This function is required for MP 5.2.
* @param theSource The input image to construct a photomosaic of
* @param theTiles The tiles image to use in the mosaic
*/
MosaicCanvas* mapTiles(SourceImage const& theSource,
vector<TileImage> & theTiles);
/**
* 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
*
* @param tree The KDTree to search in
* @param tile_avg_map Maps points to indices in the TileImage vector
* @param theTiles Tiles to be used in the Photomosaic
* @param theSource The image to make a Photomosaic of
* @param row The row of the source image
* @param col The column of the source image
*
* @returns the "nearest neighbor" tile
*/
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);
#endif // MAPTILES_H