forked from aclapes/segmenthreetion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModalityReader.h
93 lines (69 loc) · 3.58 KB
/
ModalityReader.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// ModalityReader.h
// segmenthreetion
//
// Created by Albert Clapés on 01/03/14.
//
//
#ifndef __segmenthreetion__ModalityReader__
#define __segmenthreetion__ModalityReader__
#include <iostream>
#include <vector>
#include <string>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "ModalityData.hpp"
#include "ModalityGridData.hpp"
#include "CvExtraTools.h"
class ModalityReader
{
public:
ModalityReader();
unsigned int getNumOfScenes();
string getScenePath(unsigned int sid);
void setMasksOffset(unsigned char offset);
void setSequences(std::vector<std::string> sequences);
cv::Mat getScenePartition(unsigned int sid);
vector<cv::Mat> getPartitions();
cv::Mat getAllScenesPartition();
void read(string modality, ModalityData& md);
// TODO:
// void read(string modality, string dataPath, vector<string> sceneDirs, const char* filetype, ModalityData& md);
// void read(string modality, vector<string> sceneDirs, const char* filetype, ModalityData& md);
// Read and grid all the data
void readAllScenesData(string modality, const char* filetype, int hp, int wp, ModalityGridData& mgd);
void readSceneData(std::string scenePath, string modality, const char* filetype, int hp, int wp, ModalityGridData& mgd);
// Read and grid all some data (omit frames and masks)
void readAllScenesMetadata(string modality, const char* filetype, int hp, int wp, ModalityGridData& mgd);
void readSceneMetadata(std::string scenePath, string modality, const char* filetype, int hp, int wp, ModalityGridData& mgd);
//Read only predicted and gt mask for computing overlap
void overlapreadScene(string predictionType, string modality, string scenePath, const char* filetype, ModalityData& md);
void overlapreadShotton(string scenePath, const char* filetype, ModalityData& md);
// void overlapreadScene(string predictionType, string modality, string dataPath, string scenePath, const char* filetype, ModalityData& md);
void agreement(vector<ModalityGridData*> mgds);
void loadDescription(string modality, ModalityGridData& mgd);
void getBoundingBoxesFromGroundtruthMasks(string modality, vector<string> scenePaths, vector<vector<cv::Rect> >& boxes);
void getBoundingBoxesFromGroundtruthMasks(string modality, string scenePath, vector<vector<cv::Rect> >& boxes);
private:
// string m_DataPath;
std::vector<std::string> m_ScenesPaths;
// std::vector<cv::Mat> m_SceneFramesPartitions;
unsigned char m_MasksOffset;
unsigned char m_MaxOffset;
double m_MinVal, m_MaxVal;
void loadFilenames(string dir, const char* fileExtension, vector<string>& filenames);
// Load frames of a modality within a directory
void loadDataToMats(string dir, const char* format, vector<cv::Mat> & frames);
// Load frames and frames' indices of a modality within a directory
void loadDataToMats(string dir, const char* format, vector<cv::Mat> & frames, vector<string>& indices);
// Load people bounding boxes (rects)
void loadBoundingRects(string file, vector<vector<cv::Rect> >& rects, vector< vector<int> >& tags);
// Load people bounding boxes (rects)
void loadBoundingRects(string file, vector<vector<cv::Rect> >& rects);
// Save calibVars files directories
void loadCalibVarsDir(string dir, vector<string>& calibVarsDirs);
void getBoundingBoxesInMask(cv::Mat mask, vector<cv::Rect>& boxes);
void addScenePartition(cv::Mat partition);
};
#endif /* defined(__segmenthreetion__ModalityReader__) */