Created
October 23, 2012 18:37
-
-
Save EyalAr/3940636 to your computer and use it in GitHub Desktop.
Hello World in OpenCV
This file contains 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
#include "opencv2/opencv.hpp" | |
#include "opencv2/highgui/highgui.hpp" | |
using namespace cv; | |
int main(int argc, char** argv) { | |
//create a gui window: | |
namedWindow("Output",1); | |
//initialize a 120X350 matrix of black pixels: | |
Mat output = Mat::zeros( 120, 350, CV_8UC3 ); | |
//write text on the matrix: | |
putText(output, | |
"Hello World :)", | |
cvPoint(15,70), | |
FONT_HERSHEY_PLAIN, | |
3, | |
cvScalar(0,255,0), | |
4); | |
//display the image: | |
imshow("Output", output); | |
//wait for the user to press any key: | |
waitKey(0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another option without having to include
#include <opencv2/core/types_c.h>
is to modifycvPoint
forcv::Point
or justPoint
as follows: