1.前提编译好opencv库
#include <cv.h>
#include <highgui.h>
#include "core.hpp"
#include "highgui.hpp"
#include "opencv.hpp"
using namespace cv;
int main()
{
cv::Mat srcImage;
srcImage = cv::imread("1.jpg",1);
if (srcImage.empty())
printf("null--\n");
cv::rectangle(srcImage,cvPoint(20,200),cvPoint(200,300),Scalar(255,0,0),1,1,0);
cv::imwrite("save.jpg", srcImage);
return 0;
}
交叉编译代码
aarch64-himix100-linux-g++ -o test test.cpp -I/home/jaya/Downloads/opencv-3.3.1/output_3559a/include/opencv -I/home/jaya/Downloads/opencv-3.3.1/output_3559a/include/ -L/home/jaya/houjunjie/3rdParty/lib/opencv -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs
传到设备执行
./test