# OpenCV test application

This section describes how to enable OpenCV library and run OpenCV test application

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by Microsoft Visio, SVG Export getting-started-workflow.svg getting-started-workflow -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" width="9.38542in" height="2.16667in" viewbox="0 0 675.75 156" xml:space="preserve" color-interpolation-filters="sRGB" class="st10" aria-label="../_images/getting-started-workflow.svg" svgdefaultwidth="75%"><style>.svg-1 .st1 { fill: #fafafa; stroke: #d2d7e1; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st2 { fill: #6280cc; stroke: #6280cc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-1 .st3 { fill: #ffffff; font-family: Roboto; font-size: 1.16666em }
.svg-1 .st4 { fill: #ffffff; stroke: #ffffff; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-1 .st5 { fill: #000000; font-family: Symbol; font-size: 1.00001em }
.svg-1 .st6 { font-size: 1em }
.svg-1 .st7 { font-family: Roboto; font-size: 1em }
.svg-1 .st8 { marker-end: url("#mrkr13-26"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5 }
.svg-1 .st9 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.37313432835821 }
.svg-1 .st10 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend13">		<path d="M 3 1 L 0 0 L 3 -1 L 3 1 " style="stroke:none"></path>	</g>	<marker id="mrkr13-26" class="st9" refx="-8.04" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend13" transform="scale(-2.68,-2.68) "></use>	</marker></defs><g>	<title>getting-started-workflow</title>	<g id="shape16-1" transform="translate(18,-18)">		<title>Rectangle.8</title>		<rect x="0" y="36" width="639.938" height="120" rx="3.6" ry="3.6" class="st1"></rect>	</g>	<g id="shape2-3" transform="translate(31.875,-88.125)">		<title>Sheet.2</title>		<desc>Prerequisites</desc>		<rect x="0" y="120" width="99" height="36" rx="4.5" ry="4.5" class="st2"></rect>		<text x="8.48" y="142.2" class="st3">Prerequisites</text>		</g>	<g id="shape3-6" transform="translate(45,-25.875)">		<title>Sheet.3</title>		<desc>Build procedure Enable OpenCV library and test package</desc>		<rect x="0" y="90.7501" width="143.625" height="65.25" rx="4.5" ry="4.5" class="st4"></rect>		<text x="4" y="105.33" class="st5"><tspan class="st6">·</tspan> <tspan class="st7">Build procedure </tspan><tspan x="4" dy="1.215em" class="st6">·</tspan> <tspan class="st7">Enable OpenCV </tspan><tspan x="22" dy="1.204em" class="st7">library and test </tspan><tspan x="22" dy="1.2em" class="st7">package</tspan></text>		</g>	<g id="shape4-15" transform="translate(256.875,-88.125)">		<title>Sheet.4</title>		<desc>Implement</desc>		<rect x="0" y="120" width="99" height="36" rx="4.5" ry="4.5" class="st2"></rect>		<text x="16.13" y="142.2" class="st3">Implement</text>		</g>	<g id="shape6-18" transform="translate(484.125,-88.125)">		<title>Sheet.6</title>		<desc>Test</desc>		<rect x="0" y="120" width="99" height="36" rx="4.5" ry="4.5" class="st2"></rect>		<text x="35.72" y="142.2" class="st3">Test</text>		</g>	<g id="shape11-21" transform="translate(130.875,-108)">		<title>Sheet.11</title>		<path d="M0 156 L113.94 156" class="st8"></path>	</g>	<g id="shape13-27" transform="translate(355.875,-108)">		<title>Sheet.13</title>		<path d="M0 156 L116.19 156" class="st8"></path>	</g>	<g id="shape14-32" transform="translate(270.375,-25.875)">		<title>Sheet.14</title>		<desc>Compile build Flash images on the device</desc>		<rect x="0" y="90.7501" width="143.625" height="65.25" rx="4.5" ry="4.5" class="st4"></rect>		<text x="4" y="112.53" class="st5"><tspan class="st6">·</tspan> <tspan class="st7">Compile build </tspan><tspan x="4" dy="1.215em" class="st6">·</tspan> <tspan class="st7">Flash images on the </tspan><tspan x="22" dy="1.204em" class="st7">device</tspan></text>		</g>	<g id="shape15-40" transform="translate(495.75,-25.875)">		<title>Sheet.15</title>		<desc>Run test application</desc>		<rect x="0" y="90.7501" width="143.625" height="65.25" rx="4.5" ry="4.5" class="st4"></rect>		<text x="4" y="127.02" class="st5"><tspan class="st6">·</tspan> <tspan class="st7">Run test application</tspan></text>		</g></g>
</svg>

## Prerequisites

- Set up your infrastructure as described in the [Qualcomm Linux Build Guide](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-254/introduction.html)
- Flash the latest software release to the development board.
- Set up SSH connection: Enable SSH in Permissive mode by performing the steps mentioned in [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-254/how_to.html#use-ssh)
- Confirm that the `libopencv_fastcv` library is present `/usr/lib` on the target.

    Occasionally, downloading the `fastcv_linux_aarch64_2025_02_12.tgz` fails, resulting in the `libopencv_fastcv` libraries not being generated.

    If the library is missing, [download the latest bitbake file](https://github.com/qualcomm-linux/meta-qcom-hwe/blob/scarthgap/recipes-support/opencv/opencv_4.11.0.qcom.bb)
(`opencv_4.11.0.qcom.bb`) and recompile the build.

    After flashing the build, confirm that the `libopencv_fastcv` library is present in `/usr/lib`.

## Enable the OpenCV library and test package

1. To enable the **tests** package, include `tests` in
`PACKAGECONFIG` in the
`<workspace>/layers/meta-qcom-hwe/recipes-support/opencv/opencv_4.11.0.qcom.bb`
recipe file as follows.

PACKAGECONFIG ??= "gapi python3 eigen jpeg png tiff v4l libv4l samples tbb gphoto2 tests \
        ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
        Copy to clipboard

    By default, only libraries shown in the compiled build as test bins are cleaned up.
2. To retain test bins, include the following code in the
`<workspace>/layers/meta-qcom-hwe/recipes-support/opencv/opencv_4.11.0.qcom.bb` recipe file:

RM_WORK_EXCLUDE += "opencv"
        Copy to clipboard
3. When the build is already compiled, OpenCV must be cleaned before compilation.
To clean OpenCV, run the following command:

bitbake -fc cleanall opencv
        Copy to clipboard

    During compilation no code is modified, so a direct compilation doesn’t generate the corresponding bins.
4. To compile OpenCV, run the following command:

bitbake opencv
        Copy to clipboard

The path to the libraries is `tmp-glibc\sysroots-components\armv8-2a\opencv\usr\lib`.

The path to the bins is `tmp-glibc\work\armv8-2a-qcom-linux\opencv\4.11.0.qcom\build\bin`.

## Run the existing test application

To invoke the OpenCV API, native OpenCV test examples can reference sample applications. Use the following procedure to invoke applications on the Snapdragon target.
Compile the full build image to ensure that all libraries are part of the application images.

1. Flash the images on the device as described in the [Qualcomm Linux Build Guide](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-254/).

    OpenCV libraries are on the device at `/usr/lib`.
2. For test data, `git clone` the projects at [https://github.com/opencv/opencv_extra/tree/4.11.0](https://github.com/opencv/opencv_extra/tree/4.11.0).
3. To avoid read only errors while trying to push test data and bins to the device, use the device IP address to log in to an SSH terminal and run the following command to remount the device.

mount -o remount,rw /usr
        Copy to clipboard
4. Use the `scp` command to push the test data to a preferred host location.

    For example: `scp -r [file] root@[IP-ADDR]:/tmp`
5. Use the `scp` command to push the required test bin to `/usr/bin`.

    For example: `scp -r [test] root@[IP-ADDR]:/usr/bin/`
6. Sign in to an SSH terminal and run the following commands.

chmod 777 /usr/bin/<opencv_test_bin>
        cd /usr/bin
        export OPENCV_LOG_LEVEL=DEBUG
        export OPENCV_VIDEOIO_DEBUG=1
        export OPENCV_TEST_DATA_PATH=/tmp
        ./<opencv_test_bin> --gtest_output=json:/tmp/results.json --gtest_also_run_disabled_tests
        exit
        Copy to clipboard

    Results are stored in `/tmp/results.json`.
To change the results filename, modify the
`--gtest_output=json:/tmp/{results.json}` argument.

Last Published: Dec 16, 2025

[Previous Topic
Overview](https://docs.qualcomm.com/bundle/publicresource/80-70023-21/topics/overview.md) [Next Topic
Implement new sample app](https://docs.qualcomm.com/bundle/publicresource/80-70023-21/topics/sample-applications.md)