-
Notifications
You must be signed in to change notification settings - Fork 0
/
tc_forest.h
executable file
·59 lines (47 loc) · 1.59 KB
/
tc_forest.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
56
57
58
59
/**
* \file tc_texture_forest.h
* \brief Simple tc_pixel forests.
* \author David Ray Thompson
*
* Copyright 2012, by the California Institute of Technology. ALL RIGHTS
* RESERVED. United States Government Sponsorship acknowledged. Any
* commercial use must be negotiated with the Office of Technology
* Transfer at the California Institute of Technology.
*/
#include <stdlib.h>
#include <stdio.h>
#include "tc_image.h"
#include "tc_colormap.h"
#include "tc_filter.h"
#include "tc_node.h"
#include "tc_tree.h"
#ifndef tc_forest_H
#define tc_forest_H
/**
* \brief A list of classifier trees.
*/
typedef struct tc_forest_type
{
tc_tree *trees;
int ntrees;
int nclasses;
int filterset;
int winsize;
pixel_t **colormap;
} tc_forest;
int tc_init_forest(tc_forest **forest, const int ntrees,
int filterset, int nclasses, int winsize);
int tc_free_forest(tc_forest *forest);
/* Write to IO stream */
int tc_write_forest(tc_forest *forest, FILE *file, tc_colormap *colormap);
/* Read from IO stream */
int tc_read_forest(tc_forest **forest, tc_colormap **map, void *tc_io);
/* Read from a file at the given path, and initialize */
int tc_load_forest(tc_forest **forest, tc_colormap **map, char *filename);
/* Write to a file at the given path */
int tc_save_forest(tc_forest *forest, char *filename, tc_colormap *colormap);
/* Feturn the class probability distribution and MAP class */
int tc_forest_classify(tc_forest *forest, tc_image *image,
const int r, const int c, class_t *pixel_class,
float *class_probs);
#endif