qt - 在 ubuntu 18.04 上正确安装 openbr
问题描述
我一直在尝试在 ubuntu 18.04 digitalocean droplet 上安装 openbr。
这是我已经开始的最新过程:
# --opencv install and build--
# installs opencv 2.4
sudo apt-get update
sudo apt install -y \
build-essential \
cmake \
git \
pkg-config \
libgtk-3-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libxvidcore-dev \
libx264-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
gfortran \
openexr \
libatlas-base-dev \
python3-dev \
python3-numpy \
libtbb2 \
libtbb-dev \
libdc1394-22-dev
mkdir ~/opencv_build && cd ~/opencv_build
git clone --single-branch --branch 2.4 https://github.com/opencv/opencv.git
cd ~/opencv_build/opencv
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_EXAMPLES=ON ..
make -j6
sudo make install
# --qt install--
sudo apt-get update
# Installs qt version 5.9.5 as of 1 Apr 2020
sudo apt-get install -y qt5-default libqt5svg5-dev qtcreator
# --openbr install and build--
# download & prep openbr
git clone https://github.com/biometrics/openbr.git
cd openbr
git checkout v1.1.0
git submodule init
git submodule update
# build openbr
mkdir build # from the OpenBR root directory
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6
sudo make install
这构建到我可以测试openbr的示例的地步:
$ br -algorithm FaceRecognition -compare me.jpg you.jpg
使用任何图像运行上述行时,我收到此错误:
Set algorithm to FaceRecognition
Loading /usr/local/share/openbr/models/algorithms/FaceRecognition
Fatal: Failed to set br::Transform* br::IndependentTransform::transform to:
SDK Path: /usr/local
File:
Function:
Line: 0
据我了解,这是因为我的 qt 版本错误。Openbr 想要 5.4.1,但我最早安装的是 5.9.5。
说我的问题是如何安装 qt5.4.1 可能更正确。最后,我所追求的只是一种可靠且可重复的方式来让 openbr 在 ubuntu 18.04 上运行。
解决方案
尝试在 Ubuntu 18 上运行 OpenBR 时遇到了同样的问题。您的诊断是正确的,它是 QT 版本问题。该修复程序已合并到此处的 OpenBR 主程序中,但不在 2.4 分支上。如果您将该编辑应用于 2.4 上的内容并重新运行构建步骤,它就可以在我的盒子上运行。以下步骤:
- 打开openbr/openbr/openbr_plugin.cpp
- 最初,第 1620 行读取
independent.set("transform", qVariantFromValue<void*>(transform));
- 将其替换为
independent.set("transform", QVariant::fromValue(transform));
- 从构建文件夹中重新运行构建步骤。
希望有效。谢谢。
推荐阅读
- c++ - 如何更改 cv::Mat 中所有像素的值
- python - 在 Python 中格式化 ttk 样式的最有效方法是什么?
- gremlin - Janusgraph 性能评估与数据大小
- php - 使用 PHP 循环遍历 JSON 文件
- c++ - (VSCode Mac)无法开始调试,是的,我用谷歌搜索过,没有任何帮助
- java - 尝试运行 gradle 命令时无法从“11.0.1”确定 java 版本
- regex - 当 sed 中没有前面的冒号时,用换行符替换特定的空格模式?
- node.js - NodeJS 代码不等待函数完成
- python - 绘制一行不同的数据框
- java - How to access child element using @XmlElement with Hibernate