~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/samples/android/hello-android/main.cpp

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <opencv2/core.hpp>
 
2
#include <opencv2/imgproc.hpp>
 
3
#include <opencv2/imgcodecs.hpp>
 
4
#include <opencv2/highgui.hpp>
 
5
 
 
6
using namespace cv;
 
7
const char* message = "Hello Android!";
 
8
 
 
9
int main(int argc, char* argv[])
 
10
{
 
11
  (void)argc; (void)argv;
 
12
  // print message to console
 
13
  printf("%s\n", message);
 
14
 
 
15
  // put message to simple image
 
16
  Size textsize = getTextSize(message, FONT_HERSHEY_COMPLEX, 3, 5, 0);
 
17
  Mat img(textsize.height + 20, textsize.width + 20, CV_32FC1, Scalar(230,230,230));
 
18
  putText(img, message, Point(10, img.rows - 10), FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);
 
19
 
 
20
  // save\show resulting image
 
21
#if ANDROID
 
22
  imwrite("/mnt/sdcard/HelloAndroid.png", img);
 
23
#else
 
24
  imshow("test", img);
 
25
  waitKey();
 
26
#endif
 
27
  return 0;
 
28
}