Skip to content

Commit d59dd37

Browse files
committed
Added opencv.md and OpenCV_DIR tests
1 parent 9e08ede commit d59dd37

3 files changed

Lines changed: 95 additions & 3 deletions

File tree

playbooks/dependencies/opencv.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!--
2+
Copyright Advanced Micro Devices, Inc.
3+
4+
SPDX-License-Identifier: MIT
5+
-->
6+
7+
### OpenCV 4.11.0
8+
9+
**1. Install build dependencies**
10+
```bash
11+
sudo apt update
12+
sudo apt install -y build-essential cmake git pkg-config unzip wget
13+
sudo apt install -y libgtk-3-dev libavcodec-dev libavformat-dev libswscale-dev
14+
sudo apt install -y libjpeg-dev libpng-dev libtiff-dev
15+
```
16+
17+
**2. Download OpenCV 4.11.0 source**
18+
```bash
19+
cd /tmp
20+
wget -O opencv-4.11.0.zip https://github.com/opencv/opencv/archive/refs/tags/4.11.0.zip
21+
unzip opencv-4.11.0.zip
22+
```
23+
24+
**3. Configure build**
25+
```bash
26+
cd /tmp/opencv-4.11.0
27+
mkdir build
28+
cd build
29+
30+
cmake -S .. -B . \
31+
-DCMAKE_BUILD_TYPE=Release \
32+
-DCMAKE_INSTALL_PREFIX=/opt/opencv-4.11.0 \
33+
-DBUILD_opencv_python3=OFF \
34+
-DBUILD_opencv_python2=OFF \
35+
-DBUILD_TESTS=OFF \
36+
-DBUILD_PERF_TESTS=OFF \
37+
-DBUILD_EXAMPLES=OFF
38+
```
39+
40+
**4. Build and install**
41+
```bash
42+
cmake --build . --parallel "$(nproc)"
43+
sudo cmake --install .
44+
```
45+
46+
**5. Set OPENCV_INSTALL_ROOT permanently for interactive shells**
47+
```bash
48+
echo 'export OPENCV_INSTALL_ROOT=/opt/opencv-4.11.0' >> ~/.bashrc
49+
source ~/.bashrc
50+
```
51+
52+
Verify:
53+
```bash
54+
echo $OPENCV_INSTALL_ROOT
55+
ls $OPENCV_INSTALL_ROOT
56+
```
57+
58+
You should see folders like:
59+
- bin
60+
- include
61+
- Lib
62+
- share
63+
or similar.
64+
65+
66+
**6. System library path setup**
67+
If the sample executable cannot find OpenCV shared libraries at runtime, add:
68+
```bash
69+
export LD_LIBRARY_PATH=/opt/opencv-4.11.0/lib:$LD_LIBRARY_PATH
70+
```
71+

playbooks/dependencies/registry.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
"windows": ["halo_box"]
2525
}
2626
},
27+
"opencv": {
28+
"name": "OpenCV",
29+
"description": "Computer Vision library and framework",
30+
"category": "framework",
31+
"platforms": ["windows", "linux"],
32+
"file": "opencv.md",
33+
"preinstalled": {
34+
"linux": ["halo_box"],
35+
"windows": ["halo_box"]
36+
}
37+
},
2738
"lmstudio": {
2839
"name": "LM Studio",
2940
"description": "Desktop app for running local LLMs",

playbooks/supplemental/cvml/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ git lfs version
6565
cmake --version
6666
6767
if (-not $env:OPENCV_INSTALL_ROOT) {throw "OPENCV_INSTALL_ROOT is not set. Set it to your OpenCV 4.11 installation root before running this test."}
68-
6968
if (-not (Test-Path $env:OPENCV_INSTALL_ROOT)) {throw "OPENCV_INSTALL_ROOT does not exist: $env:OPENCV_INSTALL_ROOT"}
7069
70+
if (-not $env:OpenCV_DIR) {throw "OpenCV_DIR is not set. Set it to point to the folder containing OpenCVConfig.cmake before running this test."}
71+
if (-not (Test-Path $env:OpenCV_DIR)) {throw "OpenCV_DIR does not exist: $env:OpenCV_DIR"}
72+
7173
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
7274
if (-not (Test-Path $vswhere)) {throw "vswhere.exe not found. Install Visual Studio 2022 with Desktop development with C++ workload."}
7375
@@ -99,12 +101,20 @@ if [ -z "${OPENCV_INSTALL_ROOT:-}" ]; then
99101
echo "OPENCV_INSTALL_ROOT is not set. Set it to your OpenCV 4.11 installation root before running this test."
100102
exit 1
101103
fi
102-
103104
if [ ! -d "$OPENCV_INSTALL_ROOT" ]; then
104105
echo "OPENCV_INSTALL_ROOT does not exist: $OPENCV_INSTALL_ROOT"
105106
exit 1
106107
fi
107108

109+
if [ -z "${OpenCV_DIR:-}" ]; then
110+
echo "OpenCV_DIR is not set. Set it to point to the folder containing OpenCVConfig.cmake before running this test."
111+
exit 1
112+
fi
113+
if [ ! -d "$OpenCV_DIR" ]; then
114+
echo "OpenCV_DIR does not exist: $OpenCV_DIR"
115+
exit 1
116+
fi
117+
108118
if ! command -v glslc >/dev/null 2>&1 && ! command -v vulkaninfo >/dev/null 2>&1; then
109119
echo "Vulkan SDK tools were not found. Install the Vulkan SDK before running this test."
110120
exit 1
@@ -526,7 +536,7 @@ for dir in "$OPENCV_INSTALL_ROOT/lib" "$OPENCV_INSTALL_ROOT/lib64" "$OPENCV_INST
526536
fi
527537
done
528538

529-
input_image="$playbook_root/assets/sample_face.jpg"
539+
input_image="$playbook_root/sample_face.jpg"
530540
if [ ! -f "$input_image" ]; then
531541
input_image="$work/sample_face.jpg"
532542
curl -L -o "$input_image" "https://images.pexels.com/photos/895863/pexels-photo-895863.jpeg?cs=srgb&dl=pexels-jopwell-895863.jpg&fm=jpg"

0 commit comments

Comments
 (0)