Build tutorial codes together with other samples

These codes should be included into regular builds.
This commit is contained in:
Andrey Kamaev
2012-11-07 18:21:20 +04:00
parent 6484732509
commit b131dfeecd
58 changed files with 420 additions and 354 deletions

View File

@@ -20,7 +20,7 @@ void MyLine( Mat img, Point start, Point end );
* @function main
* @brief Main function
*/
int main( int argc, char **argv ){
int main( void ){
/// Windows names
char atom_window[] = "Drawing 1: Atom";
@@ -40,7 +40,7 @@ int main( int argc, char **argv ){
MyEllipse( atom_image, -45 );
/// 1.b. Creating circles
MyFilledCircle( atom_image, Point( w/2.0, w/2.0) );
MyFilledCircle( atom_image, Point( w/2, w/2) );
/// 2. Draw a rook
/// ------------------
@@ -50,7 +50,7 @@ int main( int argc, char **argv ){
/// 2.b. Creating rectangles
rectangle( rook_image,
Point( 0, 7*w/8.0 ),
Point( 0, 7*w/8 ),
Point( w, w),
Scalar( 0, 255, 255 ),
-1,
@@ -84,8 +84,8 @@ void MyEllipse( Mat img, double angle )
int lineType = 8;
ellipse( img,
Point( w/2.0, w/2.0 ),
Size( w/4.0, w/16.0 ),
Point( w/2, w/2 ),
Size( w/4, w/16 ),
angle,
0,
360,
@@ -105,7 +105,7 @@ void MyFilledCircle( Mat img, Point center )
circle( img,
center,
w/32.0,
w/32,
Scalar( 0, 0, 255 ),
thickness,
lineType );
@@ -121,26 +121,26 @@ void MyPolygon( Mat img )
/** Create some points */
Point rook_points[1][20];
rook_points[0][0] = Point( w/4.0, 7*w/8.0 );
rook_points[0][1] = Point( 3*w/4.0, 7*w/8.0 );
rook_points[0][2] = Point( 3*w/4.0, 13*w/16.0 );
rook_points[0][3] = Point( 11*w/16.0, 13*w/16.0 );
rook_points[0][4] = Point( 19*w/32.0, 3*w/8.0 );
rook_points[0][5] = Point( 3*w/4.0, 3*w/8.0 );
rook_points[0][6] = Point( 3*w/4.0, w/8.0 );
rook_points[0][7] = Point( 26*w/40.0, w/8.0 );
rook_points[0][8] = Point( 26*w/40.0, w/4.0 );
rook_points[0][9] = Point( 22*w/40.0, w/4.0 );
rook_points[0][10] = Point( 22*w/40.0, w/8.0 );
rook_points[0][11] = Point( 18*w/40.0, w/8.0 );
rook_points[0][12] = Point( 18*w/40.0, w/4.0 );
rook_points[0][13] = Point( 14*w/40.0, w/4.0 );
rook_points[0][14] = Point( 14*w/40.0, w/8.0 );
rook_points[0][15] = Point( w/4.0, w/8.0 );
rook_points[0][16] = Point( w/4.0, 3*w/8.0 );
rook_points[0][17] = Point( 13*w/32.0, 3*w/8.0 );
rook_points[0][18] = Point( 5*w/16.0, 13*w/16.0 );
rook_points[0][19] = Point( w/4.0, 13*w/16.0) ;
rook_points[0][0] = Point( w/4, 7*w/8 );
rook_points[0][1] = Point( 3*w/4, 7*w/8 );
rook_points[0][2] = Point( 3*w/4, 13*w/16 );
rook_points[0][3] = Point( 11*w/16, 13*w/16 );
rook_points[0][4] = Point( 19*w/32, 3*w/8 );
rook_points[0][5] = Point( 3*w/4, 3*w/8 );
rook_points[0][6] = Point( 3*w/4, w/8 );
rook_points[0][7] = Point( 26*w/40, w/8 );
rook_points[0][8] = Point( 26*w/40, w/4 );
rook_points[0][9] = Point( 22*w/40, w/4 );
rook_points[0][10] = Point( 22*w/40, w/8 );
rook_points[0][11] = Point( 18*w/40, w/8 );
rook_points[0][12] = Point( 18*w/40, w/4 );
rook_points[0][13] = Point( 14*w/40, w/4 );
rook_points[0][14] = Point( 14*w/40, w/8 );
rook_points[0][15] = Point( w/4, w/8 );
rook_points[0][16] = Point( w/4, 3*w/8 );
rook_points[0][17] = Point( 13*w/32, 3*w/8 );
rook_points[0][18] = Point( 5*w/16, 13*w/16 );
rook_points[0][19] = Point( w/4, 13*w/16 );
const Point* ppt[1] = { rook_points[0] };
int npt[] = { 20 };

View File

@@ -36,7 +36,7 @@ int Displaying_Big_End( Mat image, char* window_name, RNG rng );
/**
* @function main
*/
int main( int argc, char** argv )
int main( void )
{
int c;
@@ -106,7 +106,6 @@ static Scalar randomColor( RNG& rng )
*/
int Drawing_Random_Lines( Mat image, char* window_name, RNG rng )
{
int lineType = 8;
Point pt1, pt2;
for( int i = 0; i < NUMBER; i++ )
@@ -303,7 +302,7 @@ int Displaying_Random_Text( Mat image, char* window_name, RNG rng )
/**
* @function Displaying_Big_End
*/
int Displaying_Big_End( Mat image, char* window_name, RNG rng )
int Displaying_Big_End( Mat image, char* window_name, RNG )
{
Size textsize = getTextSize("OpenCV forever!", CV_FONT_HERSHEY_COMPLEX, 3, 5, 0);
Point org((window_width - textsize.width)/2, (window_height - textsize.height)/2);

View File

@@ -7,7 +7,7 @@
using namespace cv;
using namespace std;
void help(char* progName)
static void help(char* progName)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (DFT). " << endl

View File

@@ -5,7 +5,7 @@
using namespace cv;
using namespace std;
void help(char** av)
static void help(char** av)
{
cout << endl
<< av[0] << " shows the usage of the OpenCV serialization functionality." << endl
@@ -42,11 +42,11 @@ public: // Data Members
};
//These write and read functions must be defined for the serialization in FileStorage to work
void write(FileStorage& fs, const std::string&, const MyData& x)
static void write(FileStorage& fs, const std::string&, const MyData& x)
{
x.write(fs);
}
void read(const FileNode& node, MyData& x, const MyData& default_value = MyData()){
static void read(const FileNode& node, MyData& x, const MyData& default_value = MyData()){
if(node.empty())
x = default_value;
else
@@ -54,7 +54,7 @@ void read(const FileNode& node, MyData& x, const MyData& default_value = MyData(
}
// This function will print our custom class to the console
ostream& operator<<(ostream& out, const MyData& m)
static ostream& operator<<(ostream& out, const MyData& m)
{
out << "{ id = " << m.id << ", ";
out << "X = " << m.X << ", ";

View File

@@ -6,7 +6,7 @@
using namespace std;
using namespace cv;
void help()
static void help()
{
cout
<< "\n--------------------------------------------------------------------------" << endl
@@ -57,7 +57,7 @@ int main( int argc, char* argv[])
uchar table[256];
for (int i = 0; i < 256; ++i)
table[i] = divideWith* (i/divideWith);
table[i] = (uchar)(divideWith * (i/divideWith));
const int times = 100;
double t;

View File

@@ -8,7 +8,7 @@
using namespace cv; // The new C++ interface API is inside this namespace. Import it.
using namespace std;
void help( char* progName)
static void help( char* progName)
{
cout << endl << progName
<< " shows how to use cv::Mat and IplImages together (converting back and forth)." << endl

View File

@@ -6,7 +6,7 @@
using namespace std;
using namespace cv;
void help(char* progName)
static void help(char* progName)
{
cout << endl
<< "This program shows how to filter images with mask: the write it yourself and the"

View File

@@ -6,7 +6,7 @@
using namespace std;
using namespace cv;
void help()
static void help()
{
cout
<< "\n--------------------------------------------------------------------------" << endl
@@ -77,8 +77,8 @@ int main(int,char**)
cout << "Vector of floats via Mat = " << Mat(v) << endl << endl;
vector<Point2f> vPoints(20);
for (size_t E = 0; E < vPoints.size(); ++E)
vPoints[E] = Point2f((float)(E * 5), (float)(E % 7));
for (size_t i = 0; i < vPoints.size(); ++i)
vPoints[i] = Point2f((float)(i * 5), (float)(i % 7));
cout << "A vector of 2D Points = " << vPoints << endl << endl;
return 0;