1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Move cv::Mat out of core.hpp

This commit is contained in:
Andrey Kamaev
2013-03-28 21:01:12 +04:00
parent 135c0b6cb5
commit 715fa3303e
46 changed files with 1854 additions and 1731 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/utility.hpp"
#include <cctype>
#include <iostream>
@@ -124,7 +125,7 @@ int main( int argc, const char** argv )
for(;;)
{
IplImage* iplImg = cvQueryFrame( capture );
frame = iplImg;
frame = cv::cvarrToMat(iplImg);
if( frame.empty() )
break;
if( iplImg->origin == IPL_ORIGIN_TL )
+2 -1
View File
@@ -1,6 +1,7 @@
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/utility.hpp"
#include <cctype>
#include <iostream>
@@ -120,7 +121,7 @@ int main( int argc, const char** argv )
for(;;)
{
IplImage* iplImg = cvQueryFrame( capture );
frame = iplImg;
frame = cv::cvarrToMat(iplImg);
if( frame.empty() )
break;
if( iplImg->origin == IPL_ORIGIN_TL )
+3 -2
View File
@@ -1,5 +1,6 @@
#include "opencv2/ml/ml.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/core/utility.hpp"
#include <stdio.h>
#include <map>
@@ -21,7 +22,7 @@ static void help()
static int count_classes(CvMLData& data)
{
cv::Mat r(data.get_responses());
cv::Mat r = cv::cvarrToMat(data.get_responses());
std::map<int, int> rmap;
int i, n = (int)r.total();
for( i = 0; i < n; i++ )
@@ -42,7 +43,7 @@ static void print_result(float train_err, float test_err, const CvMat* _var_imp)
if (_var_imp)
{
cv::Mat var_imp(_var_imp), sorted_idx;
cv::Mat var_imp = cv::cvarrToMat(_var_imp), sorted_idx;
cv::sortIdx(var_imp, sorted_idx, CV_SORT_EVERY_ROW + CV_SORT_DESCENDING);
printf( "variable importance:\n" );
+2 -2
View File
@@ -118,7 +118,7 @@ static void foundCorners(vector<CvPoint2D32f> *srcImagePoints,IplImage* source,
cvNormalize(grayImage, grayImage, 0, 255, CV_MINMAX);
cvThreshold( grayImage, grayImage, 26, 255, CV_THRESH_BINARY_INV);//25
Mat MgrayImage = grayImage;
Mat MgrayImage = cv::cvarrToMat(grayImage);
//For debug
//MgrayImage = MgrayImage.clone();//deep copy
vector<vector<Point> > contours;
@@ -184,7 +184,7 @@ static void foundCorners(vector<CvPoint2D32f> *srcImagePoints,IplImage* source,
}
srcImagePoints->at(3) = srcImagePoints_temp.at(index);
Mat Msource = source;
Mat Msource = cv::cvarrToMat(source);
stringstream ss;
for(size_t i = 0 ; i<srcImagePoints_temp.size(); i++ )
{
+2 -1
View File
@@ -3,6 +3,7 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/flann/miniflann.hpp"
#include "opencv2/core/utility.hpp"
using namespace cv; // all the new API is put into "cv" namespace. Export its content
using namespace std;
@@ -32,7 +33,7 @@ int main( int argc, char** argv )
fprintf(stderr, "Can not load image %s\n", imagename);
return -1;
}
Mat img(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert
Mat img = cv::cvarrToMat(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert
// between the old and the new data structures (by default, only the header
// is converted, while the data is shared)
#else
@@ -4,6 +4,7 @@
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/utility.hpp>"
using namespace cv; // The new C++ interface API is inside this namespace. Import it.
using namespace std;
@@ -33,7 +34,7 @@ int main( int argc, char** argv )
cerr << "Can not load image " << imagename << endl;
return -1;
}
Mat I(IplI); // Convert to the new style container. Only header created. Image not copied.
Mat I = cv::cvarrToMat(IplI); // Convert to the new style container. Only header created. Image not copied.
#else
Mat I = imread(imagename); // the newer cvLoadImage alternative, MATLAB-style function
if( I.empty() ) // same as if( !I.data )
@@ -6,6 +6,7 @@
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/utility.hpp"
#include <iostream>
#include <stdio.h>
@@ -43,7 +44,7 @@ int main( void )
{
for(;;)
{
frame = cvQueryFrame( capture );
frame = cv::cvarrToMat(cvQueryFrame( capture ));
//-- 3. Apply the classifier to the frame
if( !frame.empty() )
@@ -6,6 +6,7 @@
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/utility.hpp"
#include <iostream>
#include <stdio.h>
@@ -43,7 +44,7 @@ int main( void )
{
for(;;)
{
frame = cvQueryFrame( capture );
frame = cv::cvarrToMat(cvQueryFrame( capture ));
//-- 3. Apply the classifier to the frame
if( !frame.empty() )