<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using OpenCV with Yocto on the iMX6 in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Using-OpenCV-with-Yocto-on-the-iMX6/m-p/436177#M66794</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there was a similar question already asked in which it was asked how to install OpenCV in a Yocto image. After doing that successfully, I tried to cross compile a small application reading frames from a camera. The code follows here:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;math.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;#include &amp;lt;opencv2/core/core.hpp&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;opencv2/highgui/highgui.hpp&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;opencv2/imgproc/imgproc.hpp&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;int main(int argc, char *argv[])&lt;/SPAN&gt;{&lt;/P&gt;&lt;P&gt; if (argc &amp;lt; 2){&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf("Usage: cameratest cameraId \n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; printf("Trying camera at port %s \n", argv[1]);&lt;/P&gt;&lt;P&gt; cv::VideoCapture capture = cv::VideoCapture(atoi(argv[1]));&lt;/P&gt;&lt;P&gt; if (capture.isOpened() == false){&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf("Could not open camera port. \n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; return -1;&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; cv::Mat frame;&lt;/P&gt;&lt;P&gt; int frameCount = 0;&lt;/P&gt;&lt;P&gt; printf("Camera test started. \n");&lt;/P&gt;&lt;P&gt; while(1){&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (! capture.read(frame) ){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("Failed reading. \n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf("Read frame %d \n", frameCount);&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the CMakeLists.txt file that I'm using here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cmake_minimum_required(VERSION 2.6)&lt;/P&gt;&lt;P&gt;project(camera_test)&lt;/P&gt;&lt;P&gt;set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O3 -fsigned-char -march=armv7-a -mfpu=neon -mfloat-abi=hard")&lt;/P&gt;&lt;P&gt;file(GLOB_RECURSE src/*.cpp)&lt;/P&gt;&lt;P&gt;find_package(OpenCV REQUIRED)&lt;/P&gt;&lt;P&gt;add_executable(camera_test src/camera_test.cpp)&lt;/P&gt;&lt;P&gt;target_link_libraries(camera_test opencv_core opencv_ml opencv_highgui)&lt;/P&gt;&lt;P&gt;install(TARGETS camera_test DESTINATION /usr/bin)&lt;/P&gt;&lt;P&gt;~&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can create the image with this code and there is no problem, but when I try to execute it, I always get the same error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~# camera_test 0&lt;/P&gt;&lt;P&gt; Trying camera at port 0&lt;/P&gt;&lt;P&gt; Floating point exception&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; There is no other error message and the code runs in my machine (native compilation) without any problem.&amp;nbsp; Did someone experience this problem before? I had to patch the kernel in order to change the camera driver from mt9p032 to the mt9v032 (Phytec cameras) but I don't think this should have anything to do with it.... However, in the dmesg output I found this line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;coda 2040000.vpu: Direct firmware load for v4l-coda960-imx6q.bin failed with error -2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could it be the problem? In that case, how can it be solved?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Aug 2015 13:23:01 GMT</pubDate>
    <dc:creator>juanrosell</dc:creator>
    <dc:date>2015-08-12T13:23:01Z</dc:date>
    <item>
      <title>Using OpenCV with Yocto on the iMX6</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-OpenCV-with-Yocto-on-the-iMX6/m-p/436177#M66794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there was a similar question already asked in which it was asked how to install OpenCV in a Yocto image. After doing that successfully, I tried to cross compile a small application reading frames from a camera. The code follows here:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;math.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;#include &amp;lt;opencv2/core/core.hpp&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;opencv2/highgui/highgui.hpp&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;opencv2/imgproc/imgproc.hpp&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;int main(int argc, char *argv[])&lt;/SPAN&gt;{&lt;/P&gt;&lt;P&gt; if (argc &amp;lt; 2){&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf("Usage: cameratest cameraId \n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; printf("Trying camera at port %s \n", argv[1]);&lt;/P&gt;&lt;P&gt; cv::VideoCapture capture = cv::VideoCapture(atoi(argv[1]));&lt;/P&gt;&lt;P&gt; if (capture.isOpened() == false){&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf("Could not open camera port. \n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; return -1;&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; cv::Mat frame;&lt;/P&gt;&lt;P&gt; int frameCount = 0;&lt;/P&gt;&lt;P&gt; printf("Camera test started. \n");&lt;/P&gt;&lt;P&gt; while(1){&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (! capture.read(frame) ){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("Failed reading. \n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf("Read frame %d \n", frameCount);&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the CMakeLists.txt file that I'm using here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cmake_minimum_required(VERSION 2.6)&lt;/P&gt;&lt;P&gt;project(camera_test)&lt;/P&gt;&lt;P&gt;set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O3 -fsigned-char -march=armv7-a -mfpu=neon -mfloat-abi=hard")&lt;/P&gt;&lt;P&gt;file(GLOB_RECURSE src/*.cpp)&lt;/P&gt;&lt;P&gt;find_package(OpenCV REQUIRED)&lt;/P&gt;&lt;P&gt;add_executable(camera_test src/camera_test.cpp)&lt;/P&gt;&lt;P&gt;target_link_libraries(camera_test opencv_core opencv_ml opencv_highgui)&lt;/P&gt;&lt;P&gt;install(TARGETS camera_test DESTINATION /usr/bin)&lt;/P&gt;&lt;P&gt;~&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can create the image with this code and there is no problem, but when I try to execute it, I always get the same error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~# camera_test 0&lt;/P&gt;&lt;P&gt; Trying camera at port 0&lt;/P&gt;&lt;P&gt; Floating point exception&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; There is no other error message and the code runs in my machine (native compilation) without any problem.&amp;nbsp; Did someone experience this problem before? I had to patch the kernel in order to change the camera driver from mt9p032 to the mt9v032 (Phytec cameras) but I don't think this should have anything to do with it.... However, in the dmesg output I found this line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;coda 2040000.vpu: Direct firmware load for v4l-coda960-imx6q.bin failed with error -2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could it be the problem? In that case, how can it be solved?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 13:23:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-OpenCV-with-Yocto-on-the-iMX6/m-p/436177#M66794</guid>
      <dc:creator>juanrosell</dc:creator>
      <dc:date>2015-08-12T13:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using OpenCV with Yocto on the iMX6</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-OpenCV-with-Yocto-on-the-iMX6/m-p/436178#M66795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Our VPU firmware's name is &lt;SPAN lang="ZH-CN" style="font-size: 10.0pt; font-family: 'Microsoft YaHei UI',sans-serif; color: black;"&gt;vpu_fw_imx6q.bin , not v4l-coda960-imx6q.bin, so please check the reason why the message displayed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN lang="ZH-CN" style="font-size: 10.0pt; font-family: 'Microsoft YaHei UI',sans-serif; color: black;"&gt;Regards.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN lang="ZH-CN" style="font-size: 10.0pt; font-family: 'Microsoft YaHei UI',sans-serif; color: black;"&gt;Weidong&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2015 03:41:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-OpenCV-with-Yocto-on-the-iMX6/m-p/436178#M66795</guid>
      <dc:creator>weidong_sun</dc:creator>
      <dc:date>2015-08-13T03:41:13Z</dc:date>
    </item>
  </channel>
</rss>

