Ask Your Question
0

how to use java language using openCV

asked 2013-02-18 05:03:47 -0500

dinesh gravatar image

updated 2013-02-18 10:45:15 -0500

i have created a new android project in the 'new' in eclipse IDE.Now i have to load an image and display it using OpenCV library functions.How can i write the code in java and can i write the code in C/C++ in android project.I have the following code in opencv tutorials.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv )
{
    if( argc != 2)
    {
     cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
     return -1;
    }

    Mat image;
    image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file

    if(! image.data )                              // Check for invalid input
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }

    namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
    imshow( "Display window", image );                   // Show our image inside it.

    waitKey(0);                                          // Wait for a keystroke in the window
    return 0;
}

how can i write this code in java in android project?Can i directly implement this in android project which i have created in the beginning?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-02-18 08:51:40 -0500

rics gravatar image

There are lots of things to do. Here and here are two tutorials on solving your problem.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-18 05:03:47 -0500

Seen: 769 times

Last updated: Feb 18 '13