Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/apps/createsamples/utility.hpp
16337 views
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
// Intel License Agreement
11
// For Open Source Computer Vision Library
12
//
13
// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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 Intel Corporation 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 __CREATESAMPLES_UTILITY_HPP__
43
#define __CREATESAMPLES_UTILITY_HPP__
44
45
#define CV_VERBOSE 1
46
47
/*
48
* cvCreateTrainingSamples
49
*
50
* Create training samples applying random distortions to sample image and
51
* store them in .vec file
52
*
53
* filename - .vec file name
54
* imgfilename - sample image file name
55
* bgcolor - background color for sample image
56
* bgthreshold - background color threshold. Pixels those colors are in range
57
* [bgcolor-bgthreshold, bgcolor+bgthreshold] are considered as transparent
58
* bgfilename - background description file name. If not NULL samples
59
* will be put on arbitrary background
60
* count - desired number of samples
61
* invert - if not 0 sample foreground pixels will be inverted
62
* if invert == CV_RANDOM_INVERT then samples will be inverted randomly
63
* maxintensitydev - desired max intensity deviation of foreground samples pixels
64
* maxxangle - max rotation angles
65
* maxyangle
66
* maxzangle
67
* showsamples - if not 0 samples will be shown
68
* winwidth - desired samples width
69
* winheight - desired samples height
70
*/
71
#define CV_RANDOM_INVERT 0x7FFFFFFF
72
73
void cvCreateTrainingSamples( const char* filename,
74
const char* imgfilename, int bgcolor, int bgthreshold,
75
const char* bgfilename, int count,
76
int invert = 0, int maxintensitydev = 40,
77
double maxxangle = 1.1,
78
double maxyangle = 1.1,
79
double maxzangle = 0.5,
80
int showsamples = 0,
81
int winwidth = 24, int winheight = 24 );
82
83
void cvCreateTestSamples( const char* infoname,
84
const char* imgfilename, int bgcolor, int bgthreshold,
85
const char* bgfilename, int count,
86
int invert, int maxintensitydev,
87
double maxxangle, double maxyangle, double maxzangle,
88
int showsamples,
89
int winwidth, int winheight, double maxscale );
90
91
/*
92
* cvCreateTrainingSamplesFromInfo
93
*
94
* Create training samples from a set of marked up images and store them into .vec file
95
* infoname - file in which marked up image descriptions are stored
96
* num - desired number of samples
97
* showsamples - if not 0 samples will be shown
98
* winwidth - sample width
99
* winheight - sample height
100
*
101
* Return number of successfully created samples
102
*/
103
int cvCreateTrainingSamplesFromInfo( const char* infoname, const char* vecfilename,
104
int num,
105
int showsamples,
106
int winwidth, int winheight );
107
108
/*
109
* cvShowVecSamples
110
*
111
* Shows samples stored in .vec file
112
*
113
* filename
114
* .vec file name
115
* winwidth
116
* sample width
117
* winheight
118
* sample height
119
* scale
120
* the scale each sample is adjusted to
121
*/
122
void cvShowVecSamples( const char* filename, int winwidth, int winheight, double scale );
123
124
#endif //__CREATESAMPLES_UTILITY_HPP__
125
126