18 #ifndef PIC_UTIL_TILE_LIST_HPP 19 #define PIC_UTIL_TILE_LIST_HPP 25 #include "../base.hpp" 26 #include "../util/tile.hpp" 38 #ifndef PIC_DISABLE_THREAD 107 bool read(std::string name,
bool flag);
114 bool write(std::string name);
147 int i = index %
tiles.size();
156 #ifndef PIC_DISABLE_THREAD 157 std::lock_guard<std::mutex> lock(
mutex);
173 #ifndef PIC_DISABLE_THREAD 174 std::lock_guard<std::mutex> lock(
mutex);
186 (this->height ==
height)) {
202 bool bWidth =
mod_w != 0;
203 for(
int i = 0; i <
h_tile; i++) {
205 tile.width = tileSize;
206 tile.height = tileSize;
207 tile.startY = i * tileSize;
209 for(
int j = 0; j <
w_tile; j++) {
210 tile.startX = j * tileSize;
211 tiles.push_back(tile);
216 tile.startX =
w_tile * tileSize;
218 tiles.push_back(tile);
227 tile.startY = i * tileSize;
228 tile.width = tileSize;
230 for(
int j = 0; j <
w_tile; j++) {
231 tile.startX = j * tileSize;
233 tiles.push_back(tile);
237 tile.startX =
w_tile * tileSize;
240 tiles.push_back(tile);
251 if(!output->isValid()) {
256 if(
tiles[i].tile != NULL) {
261 printf(
"Tile x: %d y: %d\n",
tiles[i].startX,
tiles[i].startY);
268 FILE *file = fopen(name.c_str(),
"r");
280 fscanf(file,
"%s", tmp);
281 fscanf(file,
"%d", &n);
284 fscanf(file,
"%s", tmp);
285 fscanf(file,
"%s", txt);
290 for(
int i = 0; i < n; i++) {
291 fscanf(file,
"%s", tmp);
292 fscanf(file,
"%s", tmp_name);
294 fscanf(file,
"%s", tmp);
295 fscanf(file,
"%d", &tmpTile.startX);
297 fscanf(file,
"%s", tmp);
298 fscanf(file,
"%d", &tmpTile.startY);
300 fscanf(file,
"%s", tmp);
301 fscanf(file,
"%d", &tmpTile.width);
303 fscanf(file,
"%s", tmp);
304 fscanf(file,
"%d", &tmpTile.height);
306 tmpTile.name = tmp_name;
309 tmpTile.tile =
new Image(tmpTile.name);
311 tmpTile.tile =
new Image(1, tmpTile.width, tmpTile.height, 3);
314 tiles.push_back(tmpTile);
323 FILE *file = fopen(name.c_str(),
"w");
330 int n = int(
tiles.size());
331 fprintf(file,
"NUMBER_OF_TILES: %d\n", n);
334 fprintf(file,
"FLAG: NONE\n");
336 for(
int i = 0; i < n; i++) {
338 bool bName = !
tiles[i].name.empty();
340 fprintf(file,
"Tile_name: %s\n",
tiles[i].name.c_str());
342 fprintf(file,
"Tile_name: none\n");
345 fprintf(file,
"StartX: %d\n",
tiles[i].startX);
346 fprintf(file,
"StartY: %d\n",
tiles[i].startY);
351 if(bName &&
tiles[i].tile != NULL) {
void resetCounter()
resetCounter sets the counter to zero.
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
unsigned int uint
Definition: base.hpp:23
void writeIntoMemory(Image *output)
writeIntoMemory copies tiles inside an output image.
TileList()
TileList basic constructor.
int mod_h
Definition: tile_list.hpp:45
BBox getBBox(int index)
genBBox
int h_tile
Definition: tile_list.hpp:44
int width
Definition: tile_list.hpp:43
std::mutex mutex
Definition: tile_list.hpp:39
The TileList class.
Definition: tile_list.hpp:33
uint counter
Definition: tile_list.hpp:36
uint getNext()
getNext returns the index of the next tile to process.
bool write(std::string name)
write saves a TileList into a file.
#define PIC_INLINE
Definition: base.hpp:33
The Image class stores an image as buffer of float.
Definition: image.hpp:60
int height
Definition: tile_list.hpp:43
int w_tile
Definition: tile_list.hpp:44
void create(int tileSize, int width, int height)
Create creates a list of tiles.
int mod_w
Definition: tile_list.hpp:45
Definition: bilateral_separation.hpp:25
bool read(std::string name, bool flag)
read loads a TileList from a file.
std::vector< Tile > tiles
tiles a list of tiles
Definition: tile_list.hpp:50