hi3516 himix200 opencv2
三 生成可调试版本的程序
1 使用CMAKE编译确实很方便。但CMAKE默认编译出来的程序不带有符号文件,用GDB无法调试。
2 要编译时产生符号文件供调试,调用CMAKE时,带上 -DCMAKE_BUILD_TYPE=Debug
例如:在build文件中输入:
cmake .. -DCMAKE_BUILD_TYPE=Debug
这样产生的makefile文件make生成的可执行文件就带有调试信息,供gdb和gdbserver使用了。
****另外有另一种更好的方法是在工程主CMakeLists.txt中的PROJECT语句后加入一句
SET(CMAKE_BUILD_TYPE Debug)
CMake 中有一个变量 CMAKE_BUILD_TYPE ,可以的取值是 Debug Release RelWithDebInfo 和 MinSizeRel。当这个变量值为 Debug 的时候,CMake 会使用变量 CMAKE_CXX_FLAGS_DEBUG 和 CMAKE_C_FLAGS_DEBUG 中的字符串作为编译选项生成 Makefile ,当这个变量值为 Release 的时候,工程会使用变量 CMAKE_CXX_FLAGS_RELEASE 和 CMAKE_C_FLAGS_RELEASE 选项生成 Makefile。
CMake 需要重点记住的命令和量
一 MESSAGE 命令
MESSAGE(STATUS "THIS IS A BINARY DIR" ${HELLO_BINARY_DIR})
STATUS 表示将要输出前缀为“--”的信息,可以替换为
FATAL_ERROR:立即终止CMake过程
SEND_ERROR:产生错误,生成过程被跳过
错误处理
/usr/include/glib-2.0/glib/gtypes.h:423:3: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^
然后去掉arm没有的东西
例如with_tiff、with_CUDA、with_GTK、with_libv4l
-DWITH_LIBV4L=OFF -DWITH_GTK=OFF
错误2
/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory 解决方式: 启用stdc++ 1.确保ubuntu能上网 2.安装cmake 3.下载opencv2.4.9 Linux版源码,不要用最新的3.0.0 /home/ubuntu/cpp/3rdpart cmake -DCMAKE_BUILD_TYPE=RELEASE cmake -DCMAKE_BUILD_TYPE=RELEASE toolchains/himix200.toolchain.cmake cmake -DCMAKE_BUILD_TYPE=RELEASE 7.进入build目录执行make 提示出错: 修改CMakeCache.txt大约200行处 make[2]: *** [modules/ocl/opencl_kernels.cpp] Error 1 删除/home/xlab/zhouhua/opencv/opencv-2.4.9/cmake/cl2cpp.cmake的第50行的内容即可。 8.得到了include和lib目录就可以编写程序了,来试试最常用的人脸检测吧 为了方便,直接将库和头文件拷贝到编译器的目录下去 然后编译:(由于版本比较高,用了opencv2的头文件,因此需要额外增加一个-I参数指定头文件目录) 会提示一些warning,不用管。 再找个图片过来,我这里就用lena.jpg了。 然后到face所在的nfs目录去执行即可: use time: 31532724us 9.速度优化 smallImg w=128 h=128 再修改检测参数 smallImg w=128 h=128 一般的应用应该够了,注意,此测试是在nfs下,如果拷贝到板子,速度会更快,当然,修改参数后的漏检率还需要测试。 下面贴出最后的代码(ps:之前的代码没有释放内存) 编译Android平台的opencv cmake -G "Unix Makefiles" 参考文章 opencv3.2+opencv_contrib+cmake (源码编译,编出来的是window的) arm-himix200-linux-g++ -o draw_image draw_image.cpp -I ./include/ -L./lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc
# include
CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}"
代码: 全选
sudo apt-get install cmake-gui
http://opencv.org/downloads.html
-DCMAKE_C_COMPILER=arm-himix200-linux-gcc
-DCMAKE_CXX_COMPILER=arm-himix200-linux-g++
-DCMAKE_INSTALL_PREFIX=~/cpp/3rdpart/libopencv2/lib
-DCMAKE_INSTALL_INCLUDEDIR=~/cpp/3rdpart/libopencv2/include
-DCMAKE_EXE_LINKER_FLAGS=-lpthread -ldl
-DBUILD_SHARED_LIBS=ON
-DCMAKE_CXX_FLAGS="-std=c++11 -fPIC"
-DCMAKE_C_FLAGS="-std=c++11 -fPIC"
-DENABLE_PIC=ON
-DWITH_1394=OFF
-DWITH_GTK=OFF -DWITH_LIBV4L=OFF -DWITH_OPENGL=OFF ..精简
-DCMAKE_INSTALL_PREFIX=../output
-DCMAKE_C_COMPILER=arm-himix200-linux-gcc
-DCMAKE_CXX_COMPILER=arm-himix200-linux-g++
-DCMAKE_EXE_LINKER_FLAGS=-lrt -lpthread
-DBUILD_SHARED_LIBS=OFF
-DWITH_CUDA=OFF
-DWITH_CUFFT=OFF
-DWITH_EIGEN=OFF
-DWITH_FFMPEG=OFF
-DWITH_OPENCL=OFF
-DWITH_OPENCLAMDBLAS=OFF
-DWITH_OPENCLAMDFFT=OFF
-DWITH_OPENCL_SVM=OFF
-DWITH_TIFF=OFF
-DWITH_1394=OFF
-DWITH_GSTREAMER=OFF
-DWITH_JASPER=OFF
-DWITH_LAPACK=OFF
-DWITH_MATLAB=OFF
-DWITH_WEBP=OFF
-DWITH_IPP=OFF
-DWITH_PNG=ON
-DWITH_JASPER=ON
-DWITH_JPEG=ON
-DHISI3559A=1
-DWITH_PNG=ON
-DBUILD_TESTS=OFF
-DBUILD_opencv_core=ON
-DBUILD_opencv_imgcodecs=ON
-DBUILD_opencv_imgproc=ON
-DWITH_V4L=OFF -DWITH_LIBV4L=OFF
-DWITH_GTK=OFF
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
-DBUILD_opencv_apps=off
-DBUILD_opencv_calib3d=off
-DBUILD_opencv_contrib=off
-DBUILD_opencv_features2d=off
-DBUILD_opencv_flann=off
-DBUILD_opencv_gpu=off
-DBUILD_opencv_java=off
-DBUILD_opencv_legacy=off
-DBUILD_opencv_ml=off
-DBUILD_opencv_nonfree=off
-DBUILD_opencv_objdetect=off
-DBUILD_opencv_ocl=off
-DBUILD_opencv_photo=off
-DBUILD_opencv_python=off
-DBUILD_opencv_stitching=off
-DBUILD_opencv_superres=off
-DBUILD_opencv_ts=off
-DBUILD_opencv_video=off
-DBUILD_opencv_videostab=off
-DBUILD_opencv_world=off
-DBUILD_opencv_lengcy=off
-DBUILD_opencv_lengcy=off
-DWITH_1394=off
-DWITH_EIGEN=off
-DWITH_FFMPEG=off
-DWITH_GIGEAPI=off
-DWITH_GSTREAMER=off
-DWITH_GTK=off
-DWITH_PVAPI=off
-DWITH_V4L=off
-DWITH_LIBV4L=off
-DWITH_CUDA=off
-DWITH_CUFFT=off
-DWITH_OPENCL=off
-DWITH_OPENCLAMDBLAS=off
-DWITH_OPENCLAMDFFT=off ..
..
-D BUILD_ZLIB=ON -D ZLIB_INCLUDE_DIR=../3rdparty/zlib
-DZLIB_INCLUDE_DIR=/home/sdc/yuwy/opencv/opencv-3.2.0/3rdparty/zlib
..# set cross-compiled system type, it's better not use the type which cmake cannot recognized.
SET ( CMAKE_SYSTEM_NAME Linux )
SET ( CMAKE_SYSTEM_PROCESSOR arm )
# when hislicon SDK was installed, toolchain was installed in the path as below:
SET ( CMAKE_C_COMPILER /opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc )
SET ( CMAKE_CXX_COMPILER /opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ )
# set searching rules for cross-compiler
SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
# set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process
SET ( CROSS_COMPILATION_ARM himix200 )
SET ( CROSS_COMPILATION_ARCHITECTURE armv7-a )
# set g++ param
SET ( CMAKE_CXX_FLAGS "-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp ${CMAKE_CXX_FLAGS}" )
add_definitions(-D__ARM_NEON)
add_definitions(-D__ANDROID__)
-DCMAKE_C_COMPILER=arm-himix200-linux-gcc
-DCMAKE_CXX_COMPILER=arm-himix200-linux-g++
-DBUILD_SHARED_LIBS=ON
-DCMAKE_CXX_FLAGS="-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp -fPIC"
-DCMAKE_C_FLAGS="-std=c++11 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -fopenmp -fPIC"
-DCMAKE_EXE_LINKER_FLAGS=-lpthread -ldl
-DENABLE_PIC=ON
-DWITH_1394=OFF
-DWITH_ARAVIS=OFF
-DWITH_ARITH_DEC=ON
-DWITH_ARITH_ENC=ON
-DWITH_CLP=OFF
-DWITH_CUBLAS=OFF
-DWITH_LIBV4L=OFF -DWITH_GTK=OFF
-DWITH_CUDA=OFF
-DWITH_CUFFT=OFF
-DWITH_FFMPEG=OFF
-DWITH_GSTREAMER=OFF
-DWITH_GSTREAMER_0_10=OFF
-DWITH_HALIDE=OFF
-DWITH_HPX=OFF
-DWITH_IMGCODEC_HDR=ON
-DWITH_IMGCODEC_PXM=ON
-DWITH_IMGCODEC_SUNRASTER=ON
-DWITH_INF_ENGINE=OFF
-DWITH_IPP=OFF
-DWITH_ITT=OFF
-DWITH_JASPER=ON
-DWITH_JPEG=ON
-DWITH_LAPACK=ON
-DWITH_LIBREALSENSE=OFF
-DWITH_NVCUVID=OFF
-DWITH_OPENCL=OFF
-DWITH_OPENCLAMDBLAS=OFF
-DWITH_OPENCLAMDFFT=OFF
-DWITH_OPENCL_SVM=OFF
-DWITH_OPENEXR=OFF
-DWITH_OPENGL=OFF
-DWITH_OPENMP=OFF
-DWITH_OPENNNI=OFF
-DWITH_OPENNNI2=OFF
-DWITH_OPENVX=OFF
-DWITH_PNG=OFF
-DWITH_PROTOBUF=OFF
-DWITH_PTHREADS_PF=ON
-DWITH_PVAPI=OFF
-DWITH_QT=OFF
-DWITH_QUIRC=OFF
-DWITH_TBB=OFF
-DWITH_TIFF=ON
-DWITH_VULKAN=OFF
-DWITH_WEBP=ON
-DWITH_XIMEA=OFF
..
代码: 全选
xlab@xlab-dev:~/zhouhua/opencv/build$ make
代码: 全选
../../lib/libopencv_core.so: undefined reference to pthread_once'
../../lib/libopencv_core.so: undefined reference to
pthread_spin_lock'
../../lib/libopencv_core.so: undefined reference to pthread_spin_unlock'
../../lib/libopencv_core.so: undefined reference to
pthread_spin_init'
../../lib/libopencv_core.so: undefined reference to pthread_spin_trylock'
../../lib/libopencv_core.so: undefined reference to
pthread_spin_destroy'
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING= -lpthread -lrt
继续make
可能出现如下错误
代码: 全选
CMake Error at /home/xlab/zhouhua/opencv/opencv-2.4.9/cmake/cl2cpp.cmake:50 (string):
string does not recognize sub-command MD5
make[1]: *** [modules/ocl/CMakeFiles/opencv_ocl.dir/all] Error 2
make: *** [all] Error 2
继续make
完成后执行make install
代码: 全选
xlab@xlab-dev:~/zhouhua/opencv/output$ ls
LICENSE bin include lib share
编写如下代码
代码: 全选/***********Author:9crk 2014-12-24*****************************/
#include "cv.h"
#include "highgui.h"
#include "stdio.h"
/******************for time mesurement*************************/
#include <sys/time.h>
struct timeval tpstart,tpend;
unsigned long timeuses;
void timeRec()
{gettimeofday(&tpstart,0);
}
int timeRep()
{gettimeofday(&tpend,0);timeuses=(tpend.tv_sec-tpstart.tv_sec)*1000000+tpend.tv_usec-tpstart.tv_usec;printf("use time: %uus\n",timeuses);return timeuses;
}
/********************end**************************************/
int main(int argc, char* argv[])
{
IplImage* img = NULL;
IplImage* cutImg = NULL;
CvMemStorage* storage = cvCreateMemStorage(0);
CvHaarClassifierCascade* cascade = (CvHaarClassifierCascade*)cvLoad("./haarcascade_frontalface_alt2.xml", 0, 0, 0);
CvSeq* faces; img = cvLoadImage(argv[1], 0);
timeRec();faces = cvHaarDetectObjects(img, cascade, storage, 1.2, 2, 0, cvSize(25,25) );timeRep();if (faces->total == 0){ printf("no face!\n");}cvSetImageROI(img, *((CvRect*)cvGetSeqElem( faces, 0)));cvSaveImage("face.bmp", img); cvResetImageROI(img);printf("face detected! in face.bmp!\n");
}
代码: 全选
xlab@xlab-dev:~/zhouhua/opencv/mytest$ sudo cp ../output/lib/* /opt/hisi-linux-nptl/arm-hisiv100-linux/arm-hisiv100-linux-uclibcgnueabi/lib/
xlab@xlab-dev:~/zhouhua/opencv/mytest$sudo cp ../output/include/* /opt/hisi-linux-nptl/arm-hisiv100-linux/arm-hisiv100-linux-uclibcgnueabi/include/ -r
代码: 全选
arm-hisiv100nptl-linux-g++ face.cpp -I/home/xlab/zhouhua/opencv/output/include/opencv -lopencv_highgui -lopencv_core -lopencv_imgproc -lpthread -lrt -lopencv_objdetect -o face
编译成功,然后拷贝人脸分类器文件过来。
代码: 全选
xlab@xlab-dev:~/zhouhua/opencv/mytest$ cp ../output/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml ./
然后nfs挂到开发板
到开发板端做软连接库到/lib目录下
代码: 全选
ln -s /mnt/nfs/zhouhua/opencv/output/lib/libopencv_imgproc.so /lib/libopencv_imgproc.so
ln -s /mnt/nfs/zhouhua/opencv/output/lib/libopencv_objdetect.so /lib/libopencv_objdetect.so
ln -s /mnt/nfs/zhouhua/opencv/output/lib/libopencv_highgui.so /lib/libopencv_highgui.so
ln -s /mnt/nfs/zhouhua/opencv/output/lib/libopencv_core.so /lib/libopencv_core.so./face lena.jpg
face detected! in face.bmp!
由于参数没有优化,用了31秒才找到lena的脸。。
先修改一下图片长、宽为之前的1/4试试./face lena.jpg
use time: 1179871us
face detected! in face.bmp!
这次用了1.1秒
faces = cvHaarDetectObjects(smallImg, cascade, storage, 1.5, 4, 0, cvSize(25,25) );./face lena.jpg
use time: 578169us
face detected! in face.bmp!
这次用了578ms,检测出来的人脸大小是44x44的。/***********Author:9crk 2014-12-24*****************************/
#include "cv.h"
#include "highgui.h"
#include "stdio.h"
/******************for time mesurement*************************/
#include <sys/time.h>
struct timeval tpstart,tpend;
unsigned long timeuses;
void timeRec()
{gettimeofday(&tpstart,0);
}
int timeRep()
{gettimeofday(&tpend,0);timeuses=(tpend.tv_sec-tpstart.tv_sec)*1000000+tpend.tv_usec-tpstart.tv_usec;printf("use time: %uus\n",timeuses);return timeuses;
}
/********************end**************************************/
int main(int argc, char* argv[])
{
IplImage* img = NULL;
IplImage* cutImg = NULL;
CvMemStorage* storage = cvCreateMemStorage(0);
CvHaarClassifierCascade* cascade = (CvHaarClassifierCascade*)cvLoad("./haarcascade_frontalface_alt2.xml", 0, 0, 0);
CvSeq* faces;//加载图像img = cvLoadImage(argv[1], 0);//缩放到1/4大小IplImage *smallImg = cvCreateImage(cvSize(img->width/4, img->height/4), 8, img->nChannels);printf("smallImg w=%d h=%d\n", smallImg->width, smallImg->height);cvResize(img, smallImg);//检测并计时timeRec();faces = cvHaarDetectObjects(smallImg, cascade, storage, 1.5, 4, 0, cvSize(25,25) );timeRep();
if (faces->total == 0){ printf("no face!\n");}//切取出头像cvSetImageROI(smallImg, *((CvRect*)cvGetSeqElem( faces, 0)));cvSaveImage("face.bmp", smallImg); cvResetImageROI(smallImg);//释放内存cvReleaseImage(&img);cvReleaseImage(&smallImg);printf("face detected! in face.bmp!\n");
}
opencv 精简
1.在window上用cmake编译opencv for Android
这里贴一下他的编译指令
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=....\android\android.toolchain.cmake ......
-DANDROID_NDK="D:\Android\sdk\ndk-bundle"
-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9
-DCMAKE_MAKE_PROGRAM="D:\Android\sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe"
-DCMAKE_BUILD_TYPE=Release
-DANDROID_ABI="armeabi"
-DANDROID_NATIVE_API_LEVEL=14
-DANDROID_FORCE_ARM_BUILD=ON
-DWITH_CAROTENE=OFF
-DWITH_CLP=OFF
-DWITH_CUBLAS=OFF
-DWITH_CUDA=OFF
-DWITH_CUFFT=OFF
-DWITH_EIGEN=OFF
-DWITH_GDCM=OFF
-DWITH_GSTREAMER_0_10=OFF
-DWITH_JASPER=OFF
-DWITH_JPEG=OFF
-DWITH_NVCUVID=OFF
-DWITH_OPENCL=OFF
-DWITH_OPENCL_SVM=OFF
-DWITH_OPENEXR=OFF
-DWITH_OPENMP=OFF
-DWITH_OPENVX=OFF
-DWITH_PNG=ON
-DWITH_PTHREADS_PF=OFF
-DWITH_TBB=OFF
-DWITH_TIFF=OFF
-DWITH_WEBP=OFF
-DBUILD_ANDROID_EXAMPLES=OFF
-DBUILD_ANDROID_SERVICE=OFF
-DBUILD_CUDA_STUBS=OFF
-DBUILD_DOCS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_FAT_JAVA_LIB=OFF
-DBUILD_JASPER=OFF
-DBUILD_JPEG=OFF
-DBUILD_OPENEXR=OFF
-DBUILD_PACKAGE=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_PNG=ON
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TBB=OFF
-DBUILD_TESTS=OFF
-DBUILD_TIFF=OFF
-DBUILD_WITH_DEBUG_INFO=OFF
-DBUILD_WITH_DYNAMIC_IPP=OFF
-DBUILD_opencv_apps=OFF
-DBUILD_opencv_calib3d=ON
-DBUILD_ZLIB=ON
-DBUILD_opencv_core=ON
-DBUILD_opencv_features2d=ON
-DBUILD_opencv_flann=ON
-DBUILD_opencv_highgui=ON
-DBUILD_opencv_imgcodecs=ON
-DBUILD_opencv_imgproc=ON
-DBUILD_opencv_java=OFF
-DBUILD_opencv_ml=ON
-DBUILD_opencv_objdetect=OFF
-DBUILD_opencv_photo=OFF
-DBUILD_opencv_shape=OFF
-DBUILD_opencv_stitching=OFF
-DBUILD_opencv_stereo=OFF
-DBUILD_opencv_superres=OFF
-DBUILD_opencv_ts=OFF
-DBUILD_opencv_video=OFF
-DBUILD_opencv_videoio=OFF
-DBUILD_opencv_line_descriptor=OFF
-DBUILD_opencv_reg=OFF
-DBUILD_opencv_saliency=OFF
-DBUILD_opencv_videostab=OFF
-DBUILD_opencv_world=OFF
-DCMAKE_CXX_FLAGS="-ffunction-sections
-fdata-sections -fvisibility=hidden -O3 -std=c++11 -mfloat-abi=softfp -mfpu=neon -march=armv7-a -mtune=cortex-a8"
-DCMAKE_C_FLAGS="-ffunction-sections -fdata-sections -fvisibility=hidden -O3 -mfloat-abi=softfp -mfpu=neon -march=armv7-a -mtune=cortex-a8"
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--gc-sections"
-DBUILD_opencv_xfeatures2d=OFF
-DBUILD_opencv_face=OFF
-DBUILD_opencv_bgsegm=OFF
-DBUILD_opencv_datasets=OFF
-DBUILD_opencv_dpm=OFF
-DBUILD_opencv_tracking=OFF
-DBUILD_opencv_xobjdetect=OFF
-DBUILD_opencv_optflow=OFF
-DBUILD_opencv_tracking=OFF
-DENABLE_NEON=ON
-DOPENCV_EXTRA_MODULES_PATH="E:/opencv_contrib-3.2.0/modules"
-DBUILD_opencv_ximgproc=ON
-DBUILD_opencv_dnn=OFF
-DBUILD_opencv_structured_light=OFF
-DBUILD_opencv_surface_matching=OFF
-DBUILD_opencv_text=OFF
-DBUILD_opencv_xphoto=OFF
-DBUILD_opencv_fuzzy=OFF
-DBUILD_opencv_bioinspired=OFF
-DBUILD_opencv_phase_unwrapping=OFF
-DBUILD_opencv_plot=OFF
-DBUILD_opencv_rgbd=OFF
-DBUILD_opencv_aruco=OFF2.编译出静态库供基本的使用
opencv2.4.9:为caffe编译精简的opencv_core,opencv_imgproc,opencv_highgui全静态库3.opencv的core库的裁剪
4.一些可能会用到的文章
Android Studio Cmake & OpenCV3.2环境(基本集成,无源码编译)
使用Android Studio 2.2和Cmake (CMakeLists)让OpenCV 飞起来(基本集成,无源码编译)
ORB_SLAM2在Android上的移植过程 (Android Studio 2.2+OpenCV 3.2+Cmake)(如何集成其他的项目)#include <opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( "test.jpeg", 1 );
if( !image.data )
{
printf( "No image data \n" );
return -1;
}
cv::Point lu = cv::Point(180, 60);
cv::Point rd = cv::Point(400, 260);
cv::rectangle(image, lu, rd, cv::Scalar( 255, 20, 0 ), 1, CV_AA );
imwrite("test_draw.jpeg", image);
return 0;
}