use the new-style headers in the samples to improve OpenCV build time.

This commit is contained in:
Vadim Pisarevsky 2010-11-26 17:59:40 +00:00
parent 54ef4c08c2
commit 042271f5f7
55 changed files with 795 additions and 370 deletions

View File

@ -39,8 +39,8 @@
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cvaux.h>
#include <highgui.h>
#include <opencv2/contrib/contrib.hpp>
#include <opencv2/highgui/highgui.hpp>
class ASDFrameHolder
{

View File

@ -21,13 +21,14 @@
ISBN-10: 0596516134 or: ISBN-13: 978-0596516130
************************************************** */
#include "cvaux.h"
#include "cxmisc.h"
#include "highgui.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <opencv2/video/background_segm.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/highgui/highgui.hpp>
//VARIABLES for CODEBOOK METHOD:
CvBGCodeBookModel* model = 0;
const int NCHANNELS = 3;
@ -220,7 +221,7 @@ int main(int argc, char** argv)
if( ch[n] )
{
int v = ptr[n] + (c == 'i' || c == 'l' ? 1 : -1);
ptr[n] = CV_CAST_8U(v);
ptr[n] = cv::saturate_cast<uchar>(v);
}
printf("%d,", ptr[n]);
}

View File

@ -1,5 +1,6 @@
#include "cvaux.h"
#include "highgui.h"
#include <opencv2/video/background_segm.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>
//this is a sample for foreground detection functions

View File

@ -1,5 +1,8 @@
#include "cvaux.h"
#include "highgui.h"
#include <opencv2/video/background_segm.hpp>
#include <opencv2/legacy/blobtrack.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <stdio.h>
/* Select appropriate case insensitive string comparison function: */

View File

@ -3,8 +3,9 @@
#include <algorithm>
#include <iterator>
#include "cv.h"
#include "highgui.h"
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;

View File

@ -1,15 +1,8 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#include <opencv2/video/tracking.hpp>
#include <opencv2/highgui/highgui.hpp>
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <ctype.h>
#endif
IplImage *image = 0, *hsv = 0, *hue = 0, *mask = 0, *backproject = 0, *histimg = 0;
CvHistogram *hist = 0;

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <math.h>
#endif
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#define w 500
int levels = 3;

View File

@ -1,14 +1,8 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <ctype.h>
#include <stdio.h>
#endif
int main( int argc, char** argv )
{

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdlib.h>
#endif
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#define ARRAY 1

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#endif
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
/* the script demostrates iterative construction of
delaunay triangulation and voronoi tesselation */

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#endif
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
char file_name[] = "baboon.jpg";

View File

@ -1,8 +1,5 @@
#define CV_NO_BACKWARD_COMPATIBILITY
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
// Rearrange the quadrants of Fourier image so that the origin is at
// the image center

View File

@ -1,12 +1,5 @@
#define CV_NO_BACKWARD_COMPATIBILITY
#ifdef _CH_
#pragma package <opencv>
#endif
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
char wndname[] = "Distance transform";
char tbarname[] = "Threshold";

View File

@ -1,15 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdlib.h>
#include <stdio.h>
#endif
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#define NUMBER 100
#define DELAY 5

View File

@ -1,13 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#endif
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
char wndname[] = "Edge";
char tbarname[] = "Threshold";

View File

@ -1,14 +1,8 @@
#define CV_NO_BACKWARD_COMPATIBILITY
#include "cv.h"
#include "highgui.h"
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <cstdio>
#ifdef _EiC
#define WIN32
#endif
using namespace std;
using namespace cv;

View File

@ -1,7 +1,6 @@
#undef _GLIBCXX_DEBUG
#include "cv.h"
#include "highgui.h"
#include <opencv2/video/tracking.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;

View File

@ -1,7 +1,5 @@
#undef _GLIBCXX_DEBUG
#include "cv.h"
#include "highgui.h"
#include <opencv2/video/tracking.hpp>
#include <opencv2/highgui/highgui.hpp>
void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step,
double scale, CvScalar color)

View File

@ -1,15 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <stdlib.h>
#endif
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
IplImage* color_img0;
IplImage* mask;

View File

@ -4,12 +4,11 @@
* Author: Liu Liu
* liuliu.1987+opencv@gmail.com
*/
#include <cv.h>
#include <highgui.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <iostream>
#include <vector>

View File

@ -1,6 +1,7 @@
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include <algorithm>
#include <iostream>

View File

@ -14,16 +14,8 @@
*
*
********************************************************************************/
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#endif
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui.hpp"
int slider_pos = 70;

View File

@ -1,10 +1,5 @@
#define CV_NO_BACKWARD_COMPATIBILITY
/* This is a standalone program. Pass an image name as a first parameter of the program.
Switch between standard and probabilistic Hough transform by changing "#if 1" to "#if 0" and back */
#include <cv.h>
#include <highgui.h>
#include <math.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
int main(int argc, char** argv)
{

View File

@ -1,8 +1,28 @@
#include "cv.h" // include standard OpenCV headers, same as before
#include "highgui.h"
#include "ml.h"
#include <stdio.h>
#include <iostream>
#include <opencv2/flann/flann.hpp>
using namespace cv; // all the new API is put into "cv" namespace. Export its content
using namespace std;
using namespace cv::flann;
#define RAD2DEG 57.295779513082321
void print32FMat(const CvMat&mat)
{
float *data = mat.data.fl;
for (int r = 0; r < mat.rows; ++r)
{
for (int c = 0; c < mat.cols; ++c)
{
printf("%+1.9f\t", data[r*mat.cols+c]);
}
printf("\n");
}
}
#if 0
@ -114,26 +134,610 @@ int main( int argc, char** argv )
int main(int argc, char *argv[])
{
Mat im(160, 160, CV_32F);
randu(im, Scalar(0.0), Scalar(1.0));
Mat dd = Mat::zeros(17,1,CV_32F);
Mat lp = Mat::zeros(17,1,CV_32F);
dd.at<float>(0) = 0.5;
dd.at<float>(16) = -0.5;
lp.at<float>(0) = 0.5;
lp.at<float>(16) = 0.5;
int p = 16;
Mat H = dd*lp.t();
Mat imcrop(im, Rect(17, 17, im.cols-2*p, im.rows-2*p));
Mat out1, out2;
filter2D(imcrop, out1, CV_32F, H, Point(-1,-1));
sepFilter2D(imcrop, out2, CV_32F, lp, dd, Point(-1,-1));
Mat temp;
out1.convertTo(temp, CV_16U, 65535.0, 32768.0);
imshow("filtered1.png", temp);
out2.convertTo(temp, CV_16U, 65535.0, 32768.0);
imshow("filtered2.png", temp);
waitKey();
/*double a = 56004.409155979447;
double b = -15158.994132169822;
double c = 215540.83745481662;
{
double A[4];
double InvA[4];
CvMat matA, matInvA;
A[0] = a;
A[1] = A[2] = b;
A[3] = c;
cvInitMatHeader( &matA, 2, 2, CV_64F, A );
cvInitMatHeader( &matInvA, 2, 2, CV_64FC1, InvA );
cvInvert( &matA, &matInvA, CV_SVD );
printf("%g\t%g\n%g\t%g\n", InvA[0], InvA[1], InvA[2], InvA[3]);
}*/
//Mat img = imread("/Users/vp/work/ocv/opencv/samples/c/left04.jpg", 1);
//Vec<string, 4> v;
/*Mat img = Mat::zeros(20, 20, CV_8U);
img(Range(0,10),Range(0,10)) = Scalar(255);
img.at<uchar>(10,10)=255;
img(Range(11,20),Range(11,20)) = Scalar(255);
vector<Point2f> corner(1, Point2f(9.5,9.5));
cornerSubPix(img, corner, Size(5,5), Size(-1,-1), TermCriteria(3, 30, 0.001));
printf("Corner at (%g, %g)", corner[0].x, corner[0].y);*/
/*Mat large, large2, gray;
resize(img, large, img.size()*3, 0, 0, CV_INTER_LANCZOS4);
cvtColor(large, gray, CV_BGR2GRAY);
vector<Point2f> corners;
bool found = findChessboardCorners(gray, Size(9,6), corners);
cornerSubPix(gray, corners, Size(11,11), Size(-1,-1),
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01));
drawChessboardCorners(large, Size(9,6), Mat(corners), false);
//rectangle(img, Point(150,100), Point(250,200), Scalar(0,255,0), 1);
resize(large(Rect(150*3,100*3,100*3,100*3)), large2, Size(), 4, 4, CV_INTER_CUBIC);
imshow("test", large2);
waitKey(0);*/
/*int N=4;
CvEM em_model;
CvEMParams params;
int nsamples=500;
for (int D=2; D < 15; D++)
{
CvMat* samples = cvCreateMat( nsamples, D, CV_32FC1 );
for (int s=0; s < nsamples;s++)
for (int d=0; d <D;d++)
cvmSet(samples, s, d, (double)s+d);
// initialize model's parameters
params.covs = NULL;
params.means = NULL;
params.weights = NULL;
params.probs = NULL;
params.nclusters = N;
params.cov_mat_type = CvEM::COV_MAT_DIAGONAL;
params.start_step = CvEM::START_AUTO_STEP;
params.term_crit.max_iter = 100;
params.term_crit.epsilon = 0.01;
params.term_crit.type = CV_TERMCRIT_ITER|CV_TERMCRIT_EPS;
em_model.train( samples, 0, params);
const CvMat* w = em_model.get_weights();
double sum=0;
for (int i=0; i < N; i++)
sum+=cvmGet(w, 0, i);
printf("D = %d, sum = %f\n", D, sum);
cvReleaseMat( &samples );
}*/
/*Mat a(1, 0, CV_32F);
cout << " empty=" << a.empty() << " data=" << (size_t)a.data << endl;*/
//XOR input
/*double in[]={ 0 ,0,
1, 0,
0, 1,
1, 1};
double out[]={ 0,
1,
1,
0};
const int IVS = 2; // Input Vector Size
const int OVS = 1; // Output Vector Size
const int HN = 10; // Number of Hidden nodes
const int NV= 4; //Number of Training Vector
int layer[] = { IVS, HN, OVS};
CvMat *input =cvCreateMat( NV, IVS, CV_64FC1);
CvMat *output =cvCreateMat( NV, OVS, CV_64FC1);
CvMat *p_output =cvCreateMat( NV, OVS, CV_64FC1);
CvMat *layersize =cvCreateMat( 1 , 3 , CV_32SC1);
cvInitMatHeader(input, NV, IVS, CV_64FC1, in);
cvInitMatHeader(output, NV, OVS, CV_64FC1, out);
cvInitMatHeader(layersize, 1, 3, CV_32SC1, layer);
CvANN_MLP train_model(layersize, CvANN_MLP::SIGMOID_SYM,1,1);
std::cout<< " =========== =========== =========== =========== ==========="<<std::endl;
std::cout<< " * First Iteration with initialzation of weights"<<std::endl;
std::cout<< " =========== =========== =========== =========== ==========="<<std::endl;
int iter = train_model.train( input,
output,
NULL,
0,
CvANN_MLP_TrainParams( cvTermCriteria ( CV_TERMCRIT_ITER |
CV_TERMCRIT_EPS,
5000,0.000001),
CvANN_MLP_TrainParams::BACKPROP,
0.1,0.1),
0
//+ CvANN_MLP::NO_OUTPUT_SCALE
);
std::cout << " * iteration :"<<iter<<std::endl;
train_model.predict( input, p_output );
for(int i=0; i<NV;i++){
std::cout<< CV_MAT_ELEM(*input,double,i,0) << " ," << CV_MAT_ELEM(*input,double,i,1)
<< " : " << CV_MAT_ELEM(*p_output,double,i,0) <<std::endl;
}
train_model.save( "firstModel.xml");
std::cout<< " =========== =========== =========== =========== ==========="<<std::endl;
std::cout<< " * Second Iteration without initialzation of weights"<<std::endl;
std::cout<< " =========== =========== =========== =========== ==========="<<std::endl;
int iter2;
for(int i=0;i<5;i++)
{
iter2 = train_model.train( input,
output,
NULL,
0,
CvANN_MLP_TrainParams( cvTermCriteria ( CV_TERMCRIT_ITER |
CV_TERMCRIT_EPS,
5000,0.0000001),
CvANN_MLP_TrainParams::BACKPROP,
0.1,0.1),
0
+CvANN_MLP::UPDATE_WEIGHTS
//+ CvANN_MLP::NO_OUTPUT_SCALE
);
}
std::cout << " * iteration :"<<iter2<<std::endl;
train_model.save( "secondModel.xml");
train_model.predict( input, p_output );
for(int i=0; i<NV;i++){
std::cout<< CV_MAT_ELEM(*input,double,i,0) << " ," << CV_MAT_ELEM(*input,double,i,1)
<< " : " << CV_MAT_ELEM(*p_output,double,i,0) <<std::endl;
}*/
/*cv::Size imageSize;
int Nimg, Npts;
vector<vector<cv::Point3f> > objectPoints;
vector<vector<cv::Point2f> >imagePoints;
cv::FileStorage f("/Users/vp/Downloads/calib_debug.2.yml",cv::FileStorage::READ);
cv::FileNodeIterator it = f["img_sz"].begin(); it >> imageSize.width >> imageSize.height;
Nimg = (int) f ["NofImages"];
Npts = (int) f["NofPoints"];
for (int i=0; i<Nimg;i++) {
std::stringstream imagename; imagename << "image" << i;
cv::FileNode img = f[imagename.str()];
vector <cv::Point3f> ov;
vector <cv::Point2f> iv;
for (int j=0; j<Npts; j++) {
std::stringstream nodename; nodename << "node" << j;
cv::FileNode pnt = img[nodename.str()];
cv::Point3f op;
cv::Point2f ip;
cv::FileNodeIterator ot = pnt["objPnt"].begin(); ot >> op.x >> op.y >> op.z;
cv::FileNodeIterator it = pnt["imgPnt"].begin(); it >> ip.x >> ip.y;
iv.push_back(ip);
ov.push_back(op);
}
imagePoints.push_back(iv);
objectPoints.push_back(ov);
}
cv::Mat M,D;
vector<cv::Mat> R,T;
cv::calibrateCamera(objectPoints, imagePoints, imageSize, M, D,R,T,
CV_CALIB_FIX_ASPECT_RATIO + 1*CV_CALIB_FIX_K3 + 1*CV_CALIB_ZERO_TANGENT_DIST);
cv::FileStorage fo("calib_output.yml",cv::FileStorage::WRITE);
//fo << "M" << M;
cout << "M: " << M;*/
/*Mat img = imread("/Users/vp/Downloads/test5.tif", CV_LOAD_IMAGE_ANYDEPTH|CV_LOAD_IMAGE_COLOR), img16;
cout << "img.depth()=" << img.depth() << endl;
if(img.depth() == CV_16U)
img16 = img;
else
img.convertTo(img16, CV_16U, 256, 0);
imshow("test", img16);
imwrite("/Users/vp/tmp/test16_2.png", img16);
waitKey();*/
/*Mat img(600,800,CV_8UC3);
img = Scalar::all(0);
IplImage _img = img;
CvFont font = cvFont(2,1);
cvPutText(&_img, "Test", cvPoint(100, 100), &font, cvScalar(0,0,255));
imshow("test", img);
waitKey();*/
/*IplImage* img = cvCreateImage(cvSize(800,600), 8, 3);
cvZero(img);
CvFont font = cvFont(2,1);
cvPutText(img, "Test", cvPoint(100, 100), &font, cvScalar(0,0,255));
cvNamedWindow("test", 1);
cvShowImage("test", img);
cvWaitKey(0);*/
/*int sz[] = {1, 5, 5};
CvMatND* src = cvCreateMatND(3, sz, CV_64F);
CvMatND* dst = cvCreateMatND(3, sz, CV_64F);
CvRNG rng = cvRNG(-1);
cvRandArr(&rng, src, CV_RAND_UNI, cvScalarAll(-100), cvScalarAll(100));
cvAddS(src, cvScalar(100), dst, 0);
cvSave("_input.xml", src);
cvSave("_output.xml", dst);*/
/*
/// random data generation :
Mat data(100,10,CV_32FC1);
randn(data, 0.0, 1.0);
/// Creating the ANN engine
AutotunedIndexParams autoParams(0.9,0.5,0.2,1);
Index index(data,autoParams);
/// Creating a query
SearchParams searchParams(5);
vector<float> query, dist;
vector<int> foundIndice;
foundIndice.push_back(0);
dist.push_back(0);
for(int i = 0 ; i < 10 ; i++)
{
query.push_back(data.at<float>(2,i));
}
/// Do a reaserch : result must be equal to 2.
index.knnSearch(query, foundIndice, dist, 1, searchParams);
cout << "Found indice (must be 2) : " << foundIndice[0] << endl;
/// save params
index.save(string("test"));
*/
/*namedWindow("orig", CV_WINDOW_AUTOSIZE);
namedWindow("canny", CV_WINDOW_AUTOSIZE);
namedWindow("hough", CV_WINDOW_AUTOSIZE);
Mat orig = cv::imread("/Users/vp/Downloads/1.jpg", 0);
//equalizeHist(orig, orig);
Mat hough;
cvtColor(orig, hough, CV_GRAY2BGR);
Mat canny;
Canny(orig, canny, 100, 50); // reproduce Canny-Filtering as in Hough-Circles
int bestRad = 20;
int minRad = bestRad / 1.3;
int maxRad = bestRad * 1.3;
vector<Vec3f> circles; // detect circles
HoughCircles(orig, circles, CV_HOUGH_GRADIENT,
1, // accu-scaling
20, // minDist
100, // CannyParam
10, // minAccuCount
minRad,
maxRad);
// Draw Circles into image in gray
for( size_t i = 0; i < circles.size(); i++ )
{
Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
int radius = cvRound(circles[i][2]);
// draw the circle center
circle( hough, center, 3, Scalar(0,0,255), -1, 8, 0 );
// draw the circle outline
circle( hough, center, radius, Scalar(0,255,255), 1, 8, 0 );
}
// Draw reference circles
Point c(bestRad * 3, bestRad * 3);
circle(hough, c, bestRad, 255);
circle(hough, c, minRad, 255);
circle(hough, c, maxRad, 255);
cv::imshow("orig", orig);
cv::imshow("canny", canny);
cv::imshow("hough", hough);
cv::waitKey();*/
/*int npoints = 4;
CvMat *OP = cvCreateMat(1, npoints, CV_32FC3);
CvPoint3D32f *op = (CvPoint3D32f *)OP->data.fl;
CvMat *OP2 = cvCreateMat(1, npoints, CV_32FC3);
CvPoint3D32f *op2 = (CvPoint3D32f *)OP2->data.fl;
CvMat *IP = cvCreateMat(1, npoints, CV_32FC2);
CvPoint2D32f *ip = (CvPoint2D32f *)IP->data.fl;
CvMat *IP2 = cvCreateMat(1, npoints, CV_32FC2);
CvPoint2D32f *ip2 = (CvPoint2D32f *)IP2->data.fl;
CvMat *IP0 = cvCreateMat(1, npoints, CV_32FC2);
float rv[3], rv2[3];
float rotMat[9];
float t[3], t2[3];
float tRotMat[16];
double kMat[9];
CvMat K = cvMat(3, 3, CV_64F, kMat);
CvMat T = cvMat(3, 1, CV_32F, t);
CvMat RV = cvMat(3, 1, CV_32F, rv);
CvMat T2 = cvMat(3, 1, CV_32F, t2);
CvMat RV2 = cvMat(3, 1, CV_32F, rv2);
CvMat R = cvMat(3, 3, CV_32F, rotMat);
float r0, r1, r2;
kMat[0] = 659.88;
kMat[1] = 0.00;
kMat[2] = 320.40;
kMat[3] = 0.00;
kMat[4] = 657.53;
kMat[5] = 240.98;
kMat[6] = 0.00;
kMat[7] = 0.00;
kMat[8] = 1.00;
ip[0].x = 277.56; ip[0].y = 184.03;
ip[1].x = 329.00; ip[1].y = 199.04;
ip[2].x = 405.96; ip[2].y = 205.96;
ip[3].x = 364.00; ip[3].y = 187.97;
op[0].x = -189.00; op[0].y = 171.00;
op[1].x = -280.00; op[1].y = 265.00;
op[2].x = -436.00; op[2].y = 316.00;
op[3].x = -376.00; op[3].y = 209.00;
ip2[0].x = 277.56; ip2[0].y = 184.03;
ip2[1].x = 328.00; ip2[1].y = 199.11;
ip2[2].x = 405.89; ip2[2].y = 206.89;
ip2[3].x = 366.00; ip2[3].y = 187.93;
op2[0].x = -194.00; op2[0].y = 168.00;
op2[1].x = -281.00; op2[1].y = 267.00;
op2[2].x = -433.00; op2[2].y = 321.00;
op2[3].x = -372.00; op2[3].y = 208.00;
//ip[4].x = 405.89; ip[4].y = 206.89;
//op[4].x = -433.00; op[4].y = 321.00;
//ip2[4].x = 364.00; ip2[4].y = 187.97;
//op2[4].x = -376.00; op2[4].y = 209.00;
cvFindExtrinsicCameraParams2(OP, IP, &K,
NULL, //&D,
&RV, &T, 0);
cvRodrigues2(&RV, &R, 0);
printf("--first--\n");
print32FMat(R);
cvFindExtrinsicCameraParams2(OP2, IP2, &K,
NULL, //&D,
&RV2, &T2, 0);
cvRodrigues2(&RV2, &R, 0);
printf("---second---\n");
print32FMat(R);
double err;
cvProjectPoints2(OP, &RV, &T, &K, NULL, IP0);
err = cvNorm(IP, IP0, CV_L2);
printf("\n\nfirst avg reprojection error = %g\n", sqrt(err*err/npoints));
cvProjectPoints2(OP2, &RV2, &T2, &K, NULL, IP0);
err = cvNorm(IP2, IP0, CV_L2);
printf("second avg reprojection error = %g\n", sqrt(err*err/npoints));
cvProjectPoints2(OP, &RV2, &T2, &K, NULL, IP0);
err = cvNorm(IP, IP0, CV_L2);
printf("\n\nsecond->first cross reprojection error = %g\n", sqrt(err*err/npoints));
cvProjectPoints2(OP2, &RV, &T, &K, NULL, IP0);
err = cvNorm(IP2, IP0, CV_L2);
printf("first->second cross reprojection error = %g\n", sqrt(err*err/npoints));
*/
/*Mat img = imread("/Users/vp/work/ocv/opencv/samples/c/baboon.jpg", 1);
vector<Point2f> corners;
double t0 = 0, t;
for( size_t i = 0; i < 50; i++ )
{
corners.clear();
t = (double)getTickCount();
goodFeaturesToTrack(img, corners, 1000, 0.01, 10);
t = (double)getTickCount() - t;
if( i == 0 || t0 > t )
t0 = t;
}
printf("minimum running time = %gms\n", t0*1000./getTickFrequency());
Mat imgc;
cvtColor(img, imgc, CV_GRAY2BGR);
for( size_t i = 0; i < corners.size(); i++ )
{
circle(imgc, corners[i], 3, Scalar(0,255,0), -1);
}
imshow("corners", imgc);*/
/*Mat imgf, imgf2, img2;
img.convertTo(imgf, CV_64F, 1./255);
resize(imgf, imgf2, Size(), 0.7, 0.7, CV_INTER_LANCZOS4);
imgf2.convertTo(img2, CV_8U, 255);
imshow("test", img2);
waitKey();*/
/*Mat src = imread("/Users/vp/work/ocv/opencv/samples/c/fruits.jpg", 1);
//if( argc != 2 || !(src=imread(argv[1], 1)).data )
// return -1;
Mat hsv;
cvtColor(src, hsv, CV_BGR2HSV);
// let's quantize the hue to 30 levels
// and the saturation to 32 levels
int hbins = 30, sbins = 32;
int histSize[] = {hbins, sbins};
// hue varies from 0 to 179, see cvtColor
float hranges[] = { 0, 180 };
// saturation varies from 0 (black-gray-white) to
// 255 (pure spectrum color)
float sranges[] = { 0, 256 };
const float* ranges[] = { hranges, sranges };
MatND hist;
// we compute the histogram from the 0-th and 1-st channels
int channels[] = {0, 1};
calcHist( &hsv, 1, channels, Mat(), // do not use mask
hist, 2, histSize, ranges,
true, // the histogram is uniform
false );
double maxVal=0;
minMaxLoc(hist, 0, &maxVal, 0, 0);
int scale = 10;
Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3);
for( int h = 0; h < hbins; h++ )
for( int s = 0; s < sbins; s++ )
{
float binVal = hist.at<float>(h, s);
int intensity = cvRound(binVal*255/maxVal);
rectangle( histImg, Point(h*scale, s*scale),
Point( (h+1)*scale - 1, (s+1)*scale - 1),
Scalar::all(intensity),
CV_FILLED );
}
namedWindow( "Source", 1 );
imshow( "Source", src );
namedWindow( "H-S Histogram", 1 );
imshow( "H-S Histogram", histImg );
waitKey();*/
/*Mat_<double> a(3, 3);
a << 1, 0, 0, 0, 1, 0, 0, 0, 1;
Mat_<double> b(3, 1);
b << 1, 2, 3;
Mat c;
hconcat(a, b, c);
cout << c;*/
/*Mat img = imread("/Users/vp/work/ocv/opencv/samples/c/lena.jpg", 1), img2;
cv::imshow( "Original Image D", img );
if( img.channels()==3 )
{
Mat L,u,v;
Mat luv;
vector<Mat> splitted;
Mat img_float0, img_float;
img.convertTo( img_float0, CV_32F, 1./255, 0 );
cvtColor( img_float0, luv, CV_BGR2Luv);
cv::split( luv, splitted );
L = (Mat)splitted[0];
u = (Mat)splitted[1];
v = (Mat)splitted[2];
vector<Mat> res;
res.push_back( L );
res.push_back( u );
res.push_back( v );
cv::merge( res, luv );
cvtColor( luv, img_float, CV_Luv2BGR );
printf("diff = %g\n", cv::norm(img_float0, img_float, CV_C));
img_float.convertTo( img2, CV_8U, 255. );
}
cv::imshow( "After Darken", img2 );
cv::absdiff(img, img2, img2);
img2 *= 255;
cv::imshow("Magnified difference", img2);
waitKey();*/
/*const char* imgFilename = "/Users/vp/Downloads/tsukuba.png";
Mat bgr = imread( imgFilename );
Mat gray = imread( imgFilename, 0 ), gray_;
cvtColor( bgr, gray_, CV_BGR2GRAY );
int N = countNonZero( gray != gray_ );
printf( "Count non zero = %d / %d\n", N, gray.cols * gray.rows );
Mat diff = abs( gray-gray_ );
double maxVal = 0;
minMaxLoc( diff, 0, &maxVal, 0, 0);
printf( "Max abs diff = %f\n", maxVal);*/
/*Mat img = imread("/Users/vp/Downloads/r_forearm_cam_rect_crop.png", 1);
vector<Point2f> corners;
Mat big;
resize(img, big, Size(), 1, 1);
bool found = findChessboardCorners(big, Size(5,4), corners);
drawChessboardCorners(big, Size(5,4), Mat(corners), found);
imshow("test", big);
waitKey();*/
/*float x[] = {0, 1};
float y[] = {0, 1};
CvMat mx = cvMat(2, 1, CV_32F, x);
CvMat my = cvMat(2, 1, CV_32F, y);
CvNormalBayesClassifier b;
bool s = b.train(&mx, &my, 0, 0, false);*/
/*float responseData[] = {1, 1, 1, 0, 0, 0};
float intdata[] = { 1, 0, 0, 1,
1, 0, 1, 0,
1, 1, 0, 0,
0, 0, 0, 1,
0, 0, 1, 0,
0, 1, 0, 0};
CvMat data = cvMat(6, 4, CV_32FC1, intdata);
CvMat responses = cvMat(6, 1, CV_32FC1, responseData);
CvNormalBayesClassifier bc;
bool succ = bc.train(&data, &responses, 0, 0, false);
float testData[] = {1.0, 1, 0, 0};
float dummy[] = {0};
CvMat test = cvMat(1, 4, CV_32FC1, testData);
CvMat testResults = cvMat(1, 6, CV_32FC1, 0);
float whatsthis = bc.predict(&test, &testResults);*/
int sz[] = {10, 20, 30};
Mat m(3, sz, CV_32F);
randu(m, Scalar::all(-10), Scalar::all(10));
double maxVal0, maxVal = -FLT_MAX;
minMaxIdx(m, 0, &maxVal0, 0, 0);
MatConstIterator_<float> it = m.begin<float>(), it_end = m.end<float>();
for( ; it != it_end; ++it )
{
if( maxVal < *it )
maxVal = *it;
}
printf("maxval(minmaxloc) = %g, maxval(iterator) = %g\n", maxVal0, maxVal);
return 0;
}
#endif

View File

@ -1,11 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <stdlib.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
IplImage* inpaint_mask = 0;
IplImage* img0 = 0, *img = 0, *inpainted = 0;

View File

@ -11,17 +11,8 @@
Pressing ESC will stop the program.
*/
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <math.h>
#endif
#include "opencv2/video/tracking.hpp"
#include "opencv2/highgui/highgui.hpp"
int main(int argc, char** argv)
{

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#endif
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
int main( int argc, char** argv )
{

View File

@ -1,15 +1,8 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <ctype.h>
#include <stdio.h>
#endif
int sigma = 3;
int smoothType = CV_GAUSSIAN;

View File

@ -1,6 +1,5 @@
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
using namespace cv;
@ -43,14 +42,14 @@ int main(int argc, char* argv[])
IplImage* image = cvLoadImage(image_filename);
if (!image)
{
printf( "Unable to load the image\n"
printf( "Unable to load the image\n"
"Pass it as the first parameter: latentsvmdetect <path to cat.jpg> <path to cat.xml>\n" );
return -1;
}
CvLatentSvmDetector* detector = cvLoadLatentSvmDetector(model_filename);
if (!detector)
{
printf( "Unable to load the model\n"
printf( "Unable to load the model\n"
"Pass it as the second parameter: latentsvmdetect <path to cat.jpg> <path to cat.xml>\n" );
cvReleaseImage( &image );
return -1;

View File

@ -1,5 +1,5 @@
#include "ml.h"
#include <stdio.h>
#include "opencv2/core/core_c.h"
#include "opencv2/ml/ml.hpp"
/*
The sample demonstrates how to train Random Trees classifier

View File

@ -1,18 +1,8 @@
/* Demo of modified Lucas-Kanade optical flow algorithm.
See the printf below */
#include "opencv2/video/tracking.hpp"
#include "opencv2/highgui/highgui.hpp"
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <ctype.h>
#endif
#include <stdio.h>
IplImage *image = 0, *grey = 0, *prev_grey = 0, *pyramid = 0, *prev_pyramid = 0, *swap_temp;

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <stdlib.h>
#endif
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#define ARRAY 1

View File

@ -1,9 +1,5 @@
#define CV_NO_BACKWARD_COMPATIBILITY
#include <cv.h>
#include <highgui.h>
#include <stdlib.h>
#include <stdio.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
IplImage* src = 0;
IplImage* dst = 0;

View File

@ -1,18 +1,7 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
// motion templates sample code
#include "cv.h"
#include "highgui.h"
#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <time.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#endif
// various tracking parameters (in seconds)
const double MHI_DURATION = 1;

View File

@ -1,40 +1,38 @@
/* This sample code was originally provided by Liu Liu
* Copyright© 2009, Liu Liu All rights reserved.
* Copyright<EFBFBD> 2009, Liu Liu All rights reserved.
*/
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/imgproc/imgproc_c.h"
static CvScalar colors[] =
{
{{0,0,255}},
{{0,128,255}},
{{0,255,255}},
{{0,255,0}},
{{255,128,0}},
{{255,255,0}},
{{255,0,0}},
{{255,0,255}},
{{255,255,255}},
{{196,255,255}},
{{255,255,196}}
};
static uchar bcolors[][3] =
{
{0,0,255},
{0,128,255},
{0,255,255},
{0,255,0},
{255,128,0},
{255,255,0},
{255,0,0},
{255,0,255},
{255,255,255}
};
static CvScalar colors[] =
{
{{0,0,255}},
{{0,128,255}},
{{0,255,255}},
{{0,255,0}},
{{255,128,0}},
{{255,255,0}},
{{255,0,0}},
{{255,0,255}},
{{255,255,255}},
{{196,255,255}},
{{255,255,196}}
};
static uchar bcolors[][3] =
{
{0,0,255},
{0,128,255},
{0,255,255},
{0,255,0},
{255,128,0},
{255,255,0},
{255,0,0},
{255,0,255},
{255,255,255}
};
int main( int argc, char** argv )
{

View File

@ -1,4 +1,5 @@
#include "ml.h"
#include "opencv2/core/core_c.h"
#include "opencv2/ml/ml.hpp"
#include <stdio.h>
/*

View File

@ -7,9 +7,10 @@
*
*/
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <string>

View File

@ -1,5 +1,7 @@
#include "cvaux.h"
#include "highgui.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <string.h>
#include <ctype.h>

View File

@ -1,16 +1,8 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <ctype.h>
#include <stdio.h>
#endif
int main( int argc, char** argv )
{

View File

@ -1,14 +1,5 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include <math.h>
#endif
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
IplImage* image[2] = { 0, 0 }, *image0 = 0, *image1 = 0;
CvSize size;

View File

@ -3,14 +3,8 @@
// It loads several images subsequentally and tries to find squares in
// each image
//
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#include "cv.h"
#include "highgui.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <math.h>
#include <string.h>

View File

@ -25,11 +25,10 @@
http://pr.willowgarage.com/wiki/OpenCV
************************************************** */
#undef _GLIBCXX_DEBUG
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "cv.h"
#include "cxmisc.h"
#include "highgui.h"
#include <vector>
#include <string>
#include <algorithm>

View File

@ -7,8 +7,10 @@
*
*/
#include <cv.h>
#include <highgui.h>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
using namespace cv;

View File

@ -1,4 +1,4 @@
#include "ml.h"
#include "opencv2/ml/ml.hpp"
#include <stdio.h>
/*
The sample demonstrates how to use different decision trees.

View File

@ -1,13 +1,7 @@
#ifdef _CH_
#pragma package <opencv>
#endif
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <stdlib.h>
#endif
IplImage* marker_mask = 0;
IplImage* markers = 0;

View File

@ -2,7 +2,10 @@
* 3calibration.cpp -- Calibrate 3 cameras in a horizontal line together.
*/
#include "opencv2/opencv.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <string.h>
#include <time.h>

View File

@ -4,7 +4,10 @@
* Created on: Oct 17, 2010
* Author: ethan
*/
#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <vector>
#include <iostream>

View File

@ -1,8 +1,10 @@
#include "cv.h"
#include "highgui.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
Mat img;
int threshval = 100;

View File

@ -1,9 +1,10 @@
#include "cv.h"
#include "highgui.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <math.h>
#include <iostream>
using namespace cv;
using namespace std;
void help()
{

View File

@ -1,6 +1,7 @@
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <cstdio>

View File

@ -1,7 +1,7 @@
#define CV_NO_BACKWARD_COMPATIBILITY
#include <cv.h>
#include <highgui.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdlib.h>
#include <stdio.h>

View File

@ -1,5 +1,6 @@
#include "cvaux.h"
#include "highgui.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/background_segm.hpp>
#include <stdio.h>
#include <string>

View File

@ -8,7 +8,8 @@
* that was generated with imagelist_creator.cpp
* easy as CV_PI right?
*/
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <vector>
using namespace cv;

View File

@ -7,7 +7,8 @@
* A starter sample for using opencv, get a video stream and display the images
* easy as CV_PI right?
*/
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <vector>
using namespace cv;

View File

@ -5,7 +5,10 @@
* Author: erublee
*/
#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <iostream>
#include <list>
#include <vector>