Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to use java language using openCV

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?

how to use java language using openCV

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>

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

using namespace cv;
using namespace std;

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?