Last active
April 28, 2024 02:34
-
-
Save romicofre/1d6e1e47d316e103943a4fdb1b56c5aa to your computer and use it in GitHub Desktop.
load image with c++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Compilar: g++ $(pkg-config --cflags --libs opencv) loadImage.cpp -o loadImage | |
| */ | |
| #include <opencv2/opencv.hpp> //incluye todas las librerias OpenCV | |
| using namespace cv; | |
| int main( int argc, char** argv ) { | |
| //imread puede leer “BMP, DIB, JPEG, JPE, PNG, PBM, PGM, PPM, SR, RAS, and TIFF” | |
| Mat img = imread(argv[1],-1); | |
| if( img.empty() ) | |
| return -1; | |
| namedWindow( "Example1", cv::WINDOW_AUTOSIZE ); | |
| imshow( "Example1", img ); | |
| waitKey( 0 ); | |
| destroyWindow( "Example1" ); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Compilar g++ opencvTest_OSX.c -o opencvTest_OSX | |
| #include <stdio.h> | |
| //#include "opencv2/core.hpp" //Tambien sirve | |
| #include "opencv2/core/core.hpp" | |
| int main(){ | |
| printf("OpenCV version: %d.%d\n", CV_MAJOR_VERSION, CV_MINOR_VERSION); | |
| return 1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment