mirror of
https://gitcode.com/gh_mirrors/es/esp32-opencv.git
synced 2025-08-14 18:50:49 +08:00
initial commit
This commit is contained in:
@ -0,0 +1,51 @@
|
||||
//! [includes]
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgcodecs.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
|
||||
#include <iostream>
|
||||
//! [includes]
|
||||
|
||||
//! [namespace]
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
//! [namespace]
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
//! [load]
|
||||
String imageName( "HappyFish.jpg" ); // by default
|
||||
if( argc > 1)
|
||||
{
|
||||
imageName = argv[1];
|
||||
}
|
||||
//! [load]
|
||||
|
||||
//! [mat]
|
||||
Mat image;
|
||||
//! [mat]
|
||||
|
||||
//! [imread]
|
||||
image = imread( samples::findFile( imageName ), IMREAD_COLOR ); // Read the file
|
||||
//! [imread]
|
||||
|
||||
if( image.empty() ) // Check for invalid input
|
||||
{
|
||||
cout << "Could not open or find the image" << std::endl ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! [window]
|
||||
namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
|
||||
//! [window]
|
||||
|
||||
//! [imshow]
|
||||
imshow( "Display window", image ); // Show our image inside it.
|
||||
//! [imshow]
|
||||
|
||||
//! [wait]
|
||||
waitKey(0); // Wait for a keystroke in the window
|
||||
//! [wait]
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* @function main
|
||||
* @brief Main function
|
||||
*/
|
||||
int main( void )
|
||||
{
|
||||
//! [hello_world]
|
||||
std::cout << "Hello World!";
|
||||
//! [hello_world]
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgcodecs.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if( argc != 2)
|
||||
{
|
||||
cout <<" Usage: " << argv[0] << " ImageToLoadAndDisplay" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Mat image;
|
||||
image = imread(argv[1], IMREAD_COLOR); // Read the file
|
||||
|
||||
if( image.empty() ) // Check for invalid input
|
||||
{
|
||||
cout << "Could not open or find the image" << std::endl ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
namedWindow( "Display window", 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;
|
||||
}
|
Reference in New Issue
Block a user