OpenCV C/C++ Examples (Showing Image)

There are also python implementation for showing image and camera capture.
Also you have to check up the implementation with Qt Framework.
#include <iostream>
#include <opencv2\opencv.hpp>

using namespace std;
using namespace cv;


int main( int argc, const char** argv )
{
    Mat image;
    String inputName;

    for( int i = 1; i < argc; i++ )
    {
            inputName.assign( argv[i] );
    }

    if( inputName.empty() || (isdigit(inputName.c_str()[0]) && inputName.c_str()[1] == '\0') )
    {
       if( inputName.size() )
    {
        image = imread( inputName, 1 );
    }
    else
    {
        if(image.empty()) cout << "Couldn't read image" << endl;
    }
    imshow("Test",image);
    }
}

No comments:

Post a Comment