hi3516c opencv2.4

为了方便,直接将库和头文件拷贝到编译器的目录下去
cp Hi3518e/lib/* /opt/hisi-linux-nptl/arm-hisiv100-linux/arm-hisiv100-linux-uclibcgnueabi/lib/
cp Hi3518e/include/* /opt/hisi-linux-nptl/arm-hisiv100-linux/arm-hisiv100-linux-uclibcgnueabi/include/ -r


arm-hisiv100nptl-linux-g++ opencvtest.c -I/home/Hi3518e/include/opencv/ -lopencv_highgui -lopencv_core -lopencv_imgproc -lpthread -lrt -lopencv_objdetect -o test


在nfs路径下建立软连接
ln -s /home/Hi3518e/lib/libopencv_imgproc.so /lib/libopencv_imgproc.so
ln -s /home/Hi3518e/lib/libopencv_objdetect.so /lib/libopencv_objdetect.so
ln -s /home/Hi3518e/lib/libopencv_highgui.so /lib/libopencv_highgui.so
ln -s /home/Hi3518e/lib/libopencv_core.so /lib/libopencv_core.so
ln -s /home/Hi3518e/libstdc++.so.6 /lib/libstdc++.so.6


can't load library 'libstdc++.so.6'
把交叉编译工具的lib下的libstdc++.sox 库挎贝到板子系统lib中就可以了


例程
#include
#include
#include


int main()
{
double fScale = 0.314; //缩放倍数
CvSize czSize;
IplImage *src=cvLoadImage("./snap.jpg",1);
IplImage *pDstImage = NULL;


//计算目标图像大小
czSize.width = src->width * fScale;
czSize.height = src->height * fScale;


//创建图像并缩放
pDstImage = cvCreateImage(czSize, src->depth, src->nChannels);
cvResize(src, pDstImage, CV_INTER_AREA);
cvSaveImage("./snapdst.jpg", pDstImage, 0);
cvReleaseImage(&src);
return 0;

}


若编译时出现如下错误:

undefined reference to `std::basic_string

在编译选项中添加:-lstdc++。或者使用 g++来编译。

你可能感兴趣的:(hi3516c opencv2.4)