zhuifengsn
易百纳技术社区
易百纳技术社区
0 访问量
0 原创专栏
0 资料
0 粉丝
个性签名:此E友还没有留下个性签名哦~
加入易百纳时间:2014-12-13

个人成就

易百纳技术社区 共获得 0 个点赞
易百纳技术社区 共获得 2 个收藏
易百纳技术社区 共获得 38 次评论/回复

个人勋章

暂无勋章
分类专栏

Ta擅长的领域

暂无
  • 本帖最后由 zhuifengsn 于 2015-5-16 15:04 编辑 我的开发板是HI3520D,我通过getframe函数获取一帧,然后从网上找了YUV转RGB的公式进行转换成RGB24,通过opencv的函数将图片保存下来。发现保存的图片仍然为黑白色。我尝试过修改YUV2RGB转换的公式系数,但始终没有获得彩色图片。想问下有没有朋友有过类似的经历,如果有测试代码共享下就更好了! 我的思路: 1,获取一帧YUV图像数据; 2,通过HI_MPI_SYS_Mmap函数将物理地址映射到内存; 3,根据semiplanar420存储YUV的特点(Y连续,UV交叉存储),依次取出YUV数据; 4,通过公式来进行像素值转换; 5,将数据存入iplimage中; 6,保存RGB图像到本地。 以下为我的部分代码: [code]/* get video frame from vi chn */ s32ret = HI_MPI_VI_GetFrame(ViChn, &stFrame) ;                  if (HI_SUCCESS != s32ret)                  {                   printf("get vi frame err:0x%x\n", s32ret);                   return s32ret;                  }          /* deal with video frame ... */          int height=stFrame.stVFrame.u32Height;          int width=stFrame.stVFrame.u32Width;          unsigned char *Ybuf= (unsigned char *) malloc(sizeof(unsigned char)*height*width);          unsigned  char *UVbuf=(unsigned char *) malloc(sizeof(unsigned char)*height*width/2);          int R,G,B,Y,U,V;          Ybuf = (unsigned char *) HI_MPI_SYS_Mmap(stFrame.stVFrame.u32PhyAddr[0], height*width);          UVbuf = (unsigned char *) HI_MPI_SYS_Mmap(stFrame.stVFrame.u32PhyAddr[1], height*width/2);          /*        yuv转RGB单通道        */         for(i=0;i         {                 for(j=0;j                 {                         (gryimg->imageData+i*IMG_WIDTH)[j*gryimg->nChannels]=                                 *(Ybuf+i*IMG_WIDTH+j);                         //灰度图片为单通道,故nchannels=1                 }                }          /*        yuv转RGB        */         for(i=0;i         {                 for(j=0;j                 {//存储顺序为:BGR                 Y=max(Ybuf[i*IMG_WIDTH+j],0);                 U=max(UVbuf[((i*IMG_WIDTH+j)/4)*2]-128,0);                 V=max(UVbuf[((i*IMG_WIDTH+j)/4)*2+1]-128,0);                 //cout<<"u="<                        B = Y + 1.779 *U;                 G = Y-0.3455 *U-0.7169 *V;                       R = Y + 1.0475 *V;                                 B = min(255, max(0, B));                 G = min(255, max(0, G));                         R = min(255, max(0, R));                 img->imageData[i*IMG_WIDTH*3+3*j]= B;//B' = Y' + 2.032*U'                 img->imageData[i*IMG_WIDTH*3+3*j+1]= G;//G' = Y' - 0.394*U' - 0.581*V'                        img->imageData[i*IMG_WIDTH*3+3*j+2]= R;//R' = Y' + 1.140*V'                                        }                } [/code] 实际处理得到的图片如下: (1)直接保存灰度图 (2)RGB24图
    2015-05-16
    20 1 13464
  • 如题。我试过很多办法,设置vpss的prescale参数,设置GRP_ATTR的MaxW和MaxH,但最后通过GetFrame获取的视频帧数据都是960*576。由于图像太大,在进行数据处理时太慢了,我希望缩放到480*288来进行处理。请问有谁有尝试过获取缩放后的图像数据吗?
    2015-05-30
    4 0 3070
  • 本帖最后由 zhuifengsn 于 2015-2-1 13:23 编辑         安装opencv问题详解         我使用的是redhat 9.0,先安装了海思3515官方配套的SDK,gcc版本为3.4.3。在redhat下使用的是cmake3.1.1,是直接用已经编译好的程序,包含cmake-gui。鄙人私下认为,Linux系统版本和cmake的版本对于opencv的安装应该是没有什么影响的。不过,不同的安装环境的确会导致在安装过程中出现各种不同类型的错误。下图是安装好的arm-gcc相关编译工具。 安装步骤: ①配置cmake 选择源码文件夹(解压源码所得的文件夹),选择编译目录(自己建立一个目录),选择编译器和头文件目录。 如下图,operation stystem和version processor随便写,编译器分别选择gcc和g++,targetroot选择arm-linux编译器的头文件目录,我这里是 /opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/include/。点击finish完成。 然后,华丽丽地报错了。 查看错误提示,提到了CUDA,后来查了下,arm-linux没有相关的库。在列表中取消所有与CUBA相关的项,重新点击configure。没有报错了。 由于arm-linux有很多库是没有的,所以在配置这一步还要取消很多的选项。具体配置如下: 再点击Generate,生成makefiles。然后,进入build目录,开始make。出错,提示: /opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/bin/../../gcc-3.4.3-uClibc-0.9.28//usr/include/stdlib.h:691: error: syntax error before '*' token /opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/bin/../../gcc-3.4.3-uClibc-0.9.28//usr/include/stdlib.h:695: error: syntax error before "wchar_t" /opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/bin/../../gcc-3.4.3-uClibc-0.9.28//usr/include/stdlib.h:699: error: syntax error before '*' token /opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/bin/../../gcc-3.4.3-uClibc-0.9.28//usr/include/stdlib.h:703: error: syntax error before '*' token make[2]: *** [3rdparty/zlib/CMakeFiles/zlib.dir/gzclose.c.obj] Error 1 make[1]: *** [3rdparty/zlib/CMakeFiles/zlib.dir/all] Error 2 make: *** [all] Error 2 解决办法:打开stdlib.h文件,将684行和706行的#ifdef….   #endif注释取消。 继续make,然后出错。提示: In file included from /root/opencv/opencv-2.4.9/modules/core/include/opencv2/core/core.hpp:4855,                                     from /root/opencv/opencv-2.4.9/modules/core/src/precomp.hpp:48,                                                  from /root/opencv/opencv-2.4.9/modules/core/src/algorithm.cpp:43: /root/opencv/opencv-2.4.9/modules/core/include/opencv2/core/operations.hpp:4024: error: got 2 template parameters for `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv:: Ptr<_Tp2>&, bool, cv::  Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv:: Ptr<_Tp2>&), const std::string&)' /root/opencv/opencv-2.4.9/modules/core/include/opencv2/core/operations.hpp:4024: error:   but 1 required /root/opencv/opencv-2.4.9/modules/core/include/opencv2/core/operations.hpp:4033: error: redefinition of `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv:: Ptr<_Tp2>&, bool, cv:: Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv:: Ptr<_Tp2>&), const std::string&)' /root/opencv/opencv-2.4.9/modules/core/include/opencv2/core/operations.hpp:4024: error: `void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv:: Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv:: Ptr<_Tp2>&), const std::string&)' previously declared here make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.obj] Error 1 make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: *** [all] Error 2 解决办法:进入operations.hpp,将4021行的那个函数注释掉。 继续make,然后又有新错误出现了。 In file included from /root/opencv/opencv-2.4.9/modules/core/src/precomp.hpp:48,                  from /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp:43: /root/opencv/opencv-2.4.9/modules/core/include/opencv2/core/core.hpp:4826: warning: `class cv::TLSDataContainer' has virtual functions but non-virtual destructor /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp:48:19: wchar.h: No such file or directory /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp: In function `std::string cv::fromUtf16(const cv::WString&)': /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp:166: error: `wcstombs' undeclared (first use this function) /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp:166: error: (Each undeclared identifier is reported only once for each function it appears in.) /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp: In function `cv::WString cv::toUtf16(const std::string&)': /root/opencv/opencv-2.4.9/modules/core/src/persistence.cpp:178: error: `mbstowcs' undeclared (first use this function) make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/persistence.cpp.obj] Error 1 make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: *** [all] Error 2 解决办法:wchar.h文件其实在usr/include/bits目录下,故打开persistence.cpp文件,在48行处,将#include改为#include,错误减少了,但没有解决。还是会提示wcstombs函数没有定义。该函数包含在stdlib.h里,进入该头文件,将684行和706行的#ifdef和#endif注释掉,错误解决。 继续make,然后继续出错提示: /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:898: error: `pthread_spin_init' undeclared (first use this function) /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:898: error: (Each undeclared identifier is reported only once for each function it appears in.) /root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In destructor `cv::Mutex::Impl::~Impl()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:899: error: `pthread_spin_destroy' undeclared (first use this function)/root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In member function `void cv::Mutex::Impl::lock()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:901: error: `pthread_spin_lock' undeclared (first use this function) /root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In member function `bool cv::Mutex::Impl::trylock()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:902: error: `pthread_spin_trylock' undeclared (first use this function)/root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In member function `void cv::Mutex::Impl::unlock()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:903: error: `pthread_spin_unlock' undeclared (first use this function) make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.obj] Error 1 make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: *** [all] Error 2 解决办法:直接将893行到908行的条件编译代码注释掉,问题解决。 继续make,然后出错。提示: /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:898: error: `pthread_spin_init' undeclared (first use this function) /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:898: error: (Each undeclared identifier is reported only once for each function it appears in.) /root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In destructor `cv::Mutex::Impl::~Impl()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:899: error: `pthread_spin_destroy' undeclared (first use this function)/root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In member function `void cv::Mutex::Impl::lock()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:901: error: `pthread_spin_lock' undeclared (first use this function) /root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In member function `bool cv::Mutex::Impl::trylock()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:902: error: `pthread_spin_trylock' undeclared (first use this function)/root/opencv/opencv-2.4.9/modules/core/src/system.cpp: In member function `void cv::Mutex::Impl::unlock()': /root/opencv/opencv-2.4.9/modules/core/src/system.cpp:903: error: `pthread_spin_unlock' undeclared (first use this function) make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.obj] Error 1 make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: *** [all] Error 2 解决办法:test文件编译出错,进入cmake-gui,取消ts模块的勾选。该模块是用于测试的,可以不用勾选。重新configure和generation。错误解决。 继续make,然后出错,提示: /root/opencv/opencv-2.4.9/modules/legacy/src/pyrsegmentation.cpp: In function `CvStatus icvPyrSegmentation8uC3R(uchar*, int, uchar*, int, CvSize, int, CvSeq**, CvMemStorage*, int, int, int)': /root/opencv/opencv-2.4.9/modules/legacy/src/pyrsegmentation.cpp:1023: internal compiler error: in verify_local_live_at_start, at flow.c:546 Please submit a full bug report, with preprocessed source if appropriate. Send email to [email]arm-gnu@codesourcery.com[/email] for instructions. make[2]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/src/pyrsegmentation.cpp.obj] Error 1 make[1]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/all] Error 2 make: *** [all] Error 2 解决办法:进入pyrsegmentation.cpp,将CvStatus icvPyrSegmentation8uC3R函数里的代码清空,直接在函数里填上”return CV_OK;”,问题解决。 继续make,然后终于完成了。输入命令make install,完成安装。终于完成了,看到这一路遇到这么多错误,我也是醉了。 最后申明一下:由于本人也是新手上路,上述的解决办法仅供参考。这些解决办法,一部分来源百度,一部分来源于自己尝试探索还有一部分来自于本论坛的9crk大神的指导。欢迎大家补充各类错误及解决办法,欢迎拍砖。 最后,感谢9crk兄弟和bai华兄弟的无私帮助与分享。
    2015-02-01
    5 1 9833
  • OPENCV的很多文件都是C++的,但Hi3515貌似是很多C++头文件都没有?今天编译一个简单的helloworld程序都无法编译通过。 [img]http://ww1.sinaimg.cn/large/005yyi5Jjw1eoexheim41j30cu06h3z8.jpg[/img] 错误提示,无法找到iostream这个头文件 但我知道,是可以移植OPENCV的。请教下,我钻到哪个死胡同了?
    2015-01-19
    4 0 4616
  • 我使用的是海思3515开发板,开发板设置为静态IP。环境为教育网,局域网内的主机都是固定IP,通过网桥连接。 我将设备直接接入网桥后,开始可以在局域网内用其他电脑通过telnet进行远程访问,但过段时间后就无法与开发板进行网络通信。 开发板与电脑无法相互ping通。 我通过串口输入指令:ifconfig eth0 down 和ifconfig eth0 up对eth0进行重启后,又可以恢复正常。过段时间后,又会出现无法通信。 有没有其他小伙伴遇到这种情况?求指教!
    2015-01-08
    0 0 2311
  • 开发环境:red hat linux 3.2.3-53 目标板:Hi3515(华为海思开发板),Linux version 2.6.24-rt1-hi3515v100 ([email]root@localhost.localdomain[/email]) (gcc version 3.4.3 (release) (CodeSourcery ARM Q3cvs 2004)) #9 Sun Jul 17 02:18:13 CDT 2011 宿主机配置如下: exports文件内容: /mnt/                    *(rw,sync,no_root_squash) /mnt/nobody              192.168.1.100/24(rw,insecure,sync,no_subtree_check,insecure_locks,no_root_squash) /tmp0                    192.168.1.*(rw,insecure,async,insecure_locks,no_root_squash) 宿主机nfs,portmap运行都正常,网络方式为桥接。开发板和宿主机能相互ping通,开发板通过网线直接接到电脑网线端口。 但是,挂载时,总是出现如下错误: ~ $ mount -t nfs -o nolock -o tcp 192.168.1.192:/tmp0 /mnt mount: 192.168.1.192:/tmp0 failed, reason given by server: Permission denied mount: nfsmount failed: Bad file descriptor mount: Mounting 192.168.1.192:/tmp0 on /mnt failed: Bad file descriptor ~ $ 上网找了很多方法,一直不管用。请各路大神帮忙指点。
    2014-12-16
    5 1 4585
  • [img=889,518]http://ww3.sinaimg.cn/large/005yyi5Jjw1en8ehzcvugj30op0eegqb.jpg[/img] 本人最近在研究一套基于HI3515的开发板,板子见上图。我用了商家提供的系统内核,在使用NFS功能时提示出错。出错信息如下: BusyBox v1.1.2 (2010.03.16-02:37+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands. Welcome to HiLinux. None of nfsroot found in cmdline. ~ $ modprobe nfs insmod: cannot open module `/lib/modules/2.6.24-rt1-hi3515v100/kernel/net/sunrpc /sunrpc.ko': No such file or directory insmod: cannot open module `/lib/modules/2.6.24-rt1-hi3515v100/kernel/fs/nfs_com mon/nfs_acl.ko': No such file or directory insmod: cannot open module `/lib/modules/2.6.24-rt1-hi3515v100/kernel/fs/lockd/l ockd.ko': No such file or directory insmod: cannot open module `/lib/modules/2.6.24-rt1-hi3515v100/kernel/fs/nfs/nfs .ko': No such file or directory modprobe: failed to load module nfs 我这里有内核源码,源码中是包含错误中提到的文件的。请问我如何在SDK中编译内核源码生成hikernel?
    2014-12-13
    0 0 4508
易百纳技术社区
共7条
易百纳技术社区