Skip to content

Commit a80308f

Browse files
committed
Merge pull request #3 from Itseez/master
Update
2 parents 3011e80 + f9634fd commit a80308f

File tree

75 files changed

+41112
-682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+41112
-682
lines changed

modules/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_re
5151
21. **opencv_xobjdetect**: Integral Channel Features Detector Framework.
5252

5353
22. **opencv_xphoto**: Additional photo processing algorithms: Color balance / Denoising / Inpainting.
54+
55+
23. **opencv_stereo**: Stereo Correspondence done with different descriptors: Census / CS-Census / MCT / BRIEF / MV / RT.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*M///////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4+
//
5+
// By downloading, copying, installing or using the software you agree to this license.
6+
// If you do not agree to this license, do not download, install,
7+
// copy or use the software.
8+
//
9+
//
10+
// License Agreement
11+
// For Open Source Computer Vision Library
12+
//
13+
// Copyright (C) 2015, Itseez Inc, all rights reserved.
14+
// Third party copyrights are property of their respective owners.
15+
//
16+
// Redistribution and use in source and binary forms, with or without modification,
17+
// are permitted provided that the following conditions are met:
18+
//
19+
// * Redistribution's of source code must retain the above copyright notice,
20+
// this list of conditions and the following disclaimer.
21+
//
22+
// * Redistribution's in binary form must reproduce the above copyright notice,
23+
// this list of conditions and the following disclaimer in the documentation
24+
// and/or other materials provided with the distribution.
25+
//
26+
// * The name of the copyright holders may not be used to endorse or promote products
27+
// derived from this software without specific prior written permission.
28+
//
29+
// This software is provided by the copyright holders and contributors "as is" and
30+
// any express or implied warranties, including, but not limited to, the implied
31+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32+
// In no event shall the Itseez Inc or contributors be liable for any direct,
33+
// indirect, incidental, special, exemplary, or consequential damages
34+
// (including, but not limited to, procurement of substitute goods or services;
35+
// loss of use, data, or profits; or business interruption) however caused
36+
// and on any theory of liability, whether in contract, strict liability,
37+
// or tort (including negligence or otherwise) arising in any way out of
38+
// the use of this software, even if advised of the possibility of such damage.
39+
//
40+
//M*/
41+
42+
#ifndef OPENCV_DATASETS_VOC_PASCAL_HPP
43+
#define OPENCV_DATASETS_VOC_PASCAL_HPP
44+
45+
#include <string>
46+
#include <vector>
47+
48+
#include "opencv2/datasets/dataset.hpp"
49+
50+
#include <opencv2/core.hpp>
51+
52+
namespace cv
53+
{
54+
namespace datasets
55+
{
56+
57+
//! @addtogroup datasets_or
58+
//! @{
59+
struct PascalPart: public Object
60+
{
61+
std::string name;
62+
int xmin;
63+
int ymin;
64+
int xmax;
65+
int ymax;
66+
};
67+
68+
struct PascalObj: public PascalPart
69+
{
70+
std::string pose;
71+
bool truncated;
72+
bool difficult;
73+
bool occluded;
74+
75+
std::vector<PascalPart> parts;
76+
};
77+
78+
struct OR_pascalObj : public Object
79+
{
80+
std::string filename;
81+
82+
int width;
83+
int height;
84+
int depth;
85+
86+
std::vector<PascalObj> objects;
87+
};
88+
89+
class CV_EXPORTS OR_pascal : public Dataset
90+
{
91+
public:
92+
virtual void load(const std::string &path) = 0;
93+
94+
static Ptr<OR_pascal> create();
95+
};
96+
97+
//! @}
98+
99+
}// namespace dataset
100+
}// namespace cv
101+
102+
#endif
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*M///////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4+
//
5+
// By downloading, copying, installing or using the software you agree to this license.
6+
// If you do not agree to this license, do not download, install,
7+
// copy or use the software.
8+
//
9+
//
10+
// License Agreement
11+
// For Open Source Computer Vision Library
12+
//
13+
// Copyright (C) 2015, Itseez Inc, all rights reserved.
14+
// Third party copyrights are property of their respective owners.
15+
//
16+
// Redistribution and use in source and binary forms, with or without modification,
17+
// are permitted provided that the following conditions are met:
18+
//
19+
// * Redistribution's of source code must retain the above copyright notice,
20+
// this list of conditions and the following disclaimer.
21+
//
22+
// * Redistribution's in binary form must reproduce the above copyright notice,
23+
// this list of conditions and the following disclaimer in the documentation
24+
// and/or other materials provided with the distribution.
25+
//
26+
// * The name of the copyright holders may not be used to endorse or promote products
27+
// derived from this software without specific prior written permission.
28+
//
29+
// This software is provided by the copyright holders and contributors "as is" and
30+
// any express or implied warranties, including, but not limited to, the implied
31+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32+
// In no event shall the Itseez Inc or contributors be liable for any direct,
33+
// indirect, incidental, special, exemplary, or consequential damages
34+
// (including, but not limited to, procurement of substitute goods or services;
35+
// loss of use, data, or profits; or business interruption) however caused
36+
// and on any theory of liability, whether in contract, strict liability,
37+
// or tort (including negligence or otherwise) arising in any way out of
38+
// the use of this software, even if advised of the possibility of such damage.
39+
//
40+
//M*/
41+
42+
#ifndef OPENCV_DATASETS_PD_INRIA_HPP
43+
#define OPENCV_DATASETS_PD_INRIA_HPP
44+
45+
#include <string>
46+
#include <vector>
47+
48+
#include "opencv2/datasets/dataset.hpp"
49+
50+
#include <opencv2/core.hpp>
51+
52+
namespace cv
53+
{
54+
namespace datasets
55+
{
56+
57+
//! @addtogroup datasets_pd
58+
//! @{
59+
60+
enum sampleType
61+
{
62+
POS = 0,
63+
NEG = 1
64+
};
65+
66+
struct PD_inriaObj : public Object
67+
{
68+
// image file name
69+
std::string filename;
70+
71+
// positive or negative
72+
sampleType sType;
73+
74+
// image size
75+
int width;
76+
int height;
77+
int depth;
78+
79+
// bounding boxes
80+
std::vector< Rect > bndboxes;
81+
};
82+
83+
class CV_EXPORTS PD_inria : public Dataset
84+
{
85+
public:
86+
virtual void load(const std::string &path) = 0;
87+
88+
static Ptr<PD_inria> create();
89+
};
90+
91+
//! @}
92+
93+
}
94+
}
95+
96+
#endif
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*M///////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4+
//
5+
// By downloading, copying, installing or using the software you agree to this license.
6+
// If you do not agree to this license, do not download, install,
7+
// copy or use the software.
8+
//
9+
//
10+
// License Agreement
11+
// For Open Source Computer Vision Library
12+
//
13+
// Copyright (C) 2015, Itseez Inc, all rights reserved.
14+
// Third party copyrights are property of their respective owners.
15+
//
16+
// Redistribution and use in source and binary forms, with or without modification,
17+
// are permitted provided that the following conditions are met:
18+
//
19+
// * Redistribution's of source code must retain the above copyright notice,
20+
// this list of conditions and the following disclaimer.
21+
//
22+
// * Redistribution's in binary form must reproduce the above copyright notice,
23+
// this list of conditions and the following disclaimer in the documentation
24+
// and/or other materials provided with the distribution.
25+
//
26+
// * The name of the copyright holders may not be used to endorse or promote products
27+
// derived from this software without specific prior written permission.
28+
//
29+
// This software is provided by the copyright holders and contributors "as is" and
30+
// any express or implied warranties, including, but not limited to, the implied
31+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32+
// In no event shall the Itseez Inc or contributors be liable for any direct,
33+
// indirect, incidental, special, exemplary, or consequential damages
34+
// (including, but not limited to, procurement of substitute goods or services;
35+
// loss of use, data, or profits; or business interruption) however caused
36+
// and on any theory of liability, whether in contract, strict liability,
37+
// or tort (including negligence or otherwise) arising in any way out of
38+
// the use of this software, even if advised of the possibility of such damage.
39+
//
40+
//M*/
41+
42+
#include "opencv2/datasets/or_pascal.hpp"
43+
44+
#include <opencv2/core.hpp>
45+
46+
#include <cstdio>
47+
#include <cstdlib> // atoi
48+
49+
#include <string>
50+
#include <vector>
51+
#include <set>
52+
53+
using namespace std;
54+
using namespace cv;
55+
using namespace cv::datasets;
56+
57+
int main(int argc, char *argv[])
58+
{
59+
const char *keys =
60+
"{ help h usage ? | | show this message }"
61+
"{ path p |true| path to folder with dataset }";
62+
CommandLineParser parser(argc, argv, keys);
63+
string path(parser.get<string>("path"));
64+
if (parser.has("help") || path=="true")
65+
{
66+
parser.printMessage();
67+
return -1;
68+
}
69+
70+
Ptr<OR_pascal> dataset = OR_pascal::create();
71+
dataset->load(path);
72+
73+
// Print train/test/validation size and first example
74+
OR_pascalObj *example;
75+
vector< Ptr<Object> > &train = dataset->getTrain();
76+
printf("\ntrain:\nsize: %u", (unsigned int)train.size());
77+
example = static_cast<OR_pascalObj *>(train[0].get());
78+
printf("\nfirst image: \n%s", example->filename.c_str());
79+
80+
printf("\nsize:");
81+
printf("\n - width: %d", example->width);
82+
printf("\n - height: %d", example->height);
83+
printf("\n - depth: %d", example->depth);
84+
85+
for (unsigned int i = 0; i < example->objects.size(); i++)
86+
{
87+
printf("\nobject %d", i);
88+
printf("\nname: %s", example->objects[i].name.c_str());
89+
printf("\npose: %s", example->objects[i].pose.c_str());
90+
printf("\ntruncated: %d", example->objects[i].truncated);
91+
printf("\ndifficult: %d", example->objects[i].difficult);
92+
printf("\noccluded: %d", example->objects[i].occluded);
93+
94+
printf("\nbounding box:");
95+
printf("\n - xmin: %d", example->objects[i].xmin);
96+
printf("\n - ymin: %d", example->objects[i].ymin);
97+
printf("\n - xmax: %d", example->objects[i].xmax);
98+
printf("\n - ymax: %d", example->objects[i].ymax);
99+
}
100+
101+
vector< Ptr<Object> > &test = dataset->getTest();
102+
printf("\ntest:\nsize: %u", (unsigned int)test.size());
103+
example = static_cast<OR_pascalObj *>(test[0].get());
104+
printf("\nfirst image: \n%s", example->filename.c_str());
105+
106+
vector< Ptr<Object> > &validation = dataset->getValidation();
107+
printf("\nvalidation:\nsize: %u", (unsigned int)validation.size());
108+
example = static_cast<OR_pascalObj *>(validation[0].get());
109+
printf("\nfirst image: \n%s\n", example->filename.c_str());
110+
111+
return 0;
112+
}

0 commit comments

Comments
 (0)