Norm.cpp

I'm trying to create a cv::Mat, do some operation and save it to a text/xml file. - rahul kavi, 2012-04-10 06:11 pm

Download (466 Bytes)

 
1
#include <iostream>
2
#include <opencv2/core/core.hpp>
3
#include <opencv2/imgproc/imgproc.hpp>
4
#include <opencv2/highgui/highgui.hpp>
5
6
using namespace std;
7
using namespace cv;
8
int main(int argc, char** argv)
9
{
10
    Mat matrix(5,5,CV_32F,Scalar(0)),m;
11
    randn(matrix, 2.00, 1.00);
12
    cout<<"before sorting:\n"<<matrix<<endl;
13
    cv::sort(matrix, m, CV_SORT_EVERY_ROW + CV_SORT_ASCENDING);
14
    cout<<"after sorting:\n"<<m<<endl;
15
    imwrite("m.xml",m);
16
    return 0;
17
}