You are not logged in.
Pages: 1
Hi Im following this tutorial on cropping images with python and opencv:
https://www.learnopencv.com/how-to-sele … pp-python/
When I run the code, or compile it and runs it as a C++ program I get the same error:
[libprotobuf FATAL /home/thund3r/pkgbuilds/opencv-git/src/opencv/3rdparty/protobuf/src/google/protobuf/stubs/common.cc:67] This program requires version 3.3.0 of the Protocol Buffer runtime library, but the installed version is 3.1.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.3.0 of the Protocol Buffer runtime library, but the installed version is 3.1.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)
Aborted (core dumped)
It says it needs protobuf version 3.3.0, and thinks that the installed version is 3.1.0.
However:
[thund3r@orion kode]$ pacman -Q protobuf python-protobuf protobuf-c
protobuf 3.3.2-1
python-protobuf 3.3.2-1
protobuf-c 1.2.1-6
and:
[joachim@orion kode]$ ldconfig -p | grep proto
libprotoc.so.13 (libc6,x86-64) => /usr/lib/libprotoc.so.13
libprotoc.so (libc6,x86-64) => /usr/lib/libprotoc.so
libprotobuf.so.13 (libc6,x86-64) => /usr/lib/libprotobuf.so.13
libprotobuf.so (libc6,x86-64) => /usr/lib/libprotobuf.so
libprotobuf-lite.so.13 (libc6,x86-64) => /usr/lib/libprotobuf-lite.so.13
libprotobuf-lite.so (libc6,x86-64) => /usr/lib/libprotobuf-lite.so
libprotobuf-c.so.1 (libc6,x86-64) => /usr/lib/libprotobuf-c.so.1
libprotobuf-c.so (libc6,x86-64) => /usr/lib/libprotobuf-c.so
what might be the cause?
Last edited by thund3rpantz (2017-09-19 08:40:16)
Offline
So you have what looks like a custom compiled version of openvc (opencv-git from your path above). Has it been recompiled lately to make sure it has picked up the protobuf 3.3 version? What version of opencv do you have installed? Can you post your source code and make file so others can try and build it to see if they get the same issue?
Matt
"It is very difficult to educate the educated."
Offline
Any reason you use opencv-git from AUR and not just stock opencv?
Also check ldd on the binary (to see which libs are linked/resolved)
Offline
I need opencv-contrib, and the opencv-git installs that too. I will try to install opencv from the repository and see how it goes.
import cv2
import numpy as np
if __name__ == '__main__' :
# Read image
im = cv2.imread("image.jpg")
# Select ROI
r = cv2.selectROI(im)
# Crop image
imCrop = im[int(r[1]):int(r[1]+r[3]), int(r[0]):int(r[0]+r[2])]
# Display cropped image
cv2.imshow("Image", imCrop)
cv2.waitKey(0)
im compiling with makefile
crop:
g++ crop.cpp -L /usr/local/lib `pkg-config --libs opencv` `pkg-config --cflags --libs protobuf` -o crop
or the python version and get the same error as above.
ldd returns:
[thund3r@orion kode]$ ldd crop
linux-vdso.so.1 (0x00007ffd38dfa000)
libopencv_stitching.so.3.3 => /usr/lib/libopencv_stitching.so.3.3 (0x00007f88ba05e000)
.... and lots of other .so's that seem to be happy
Last edited by thund3rpantz (2017-09-13 14:56:29)
Offline
after installing opencv from the repo im missing this shared object:
libopencv_dnn_modern.so.3.3
however, it does not get the protobuf error. And the python program is working.
Thanks for the help so far.
Last edited by thund3rpantz (2017-09-13 15:39:34)
Offline
For what actual makefile? Which pkgconf does link dnn_modern?
Offline
when building opencv-git with this PKGBUILD it works.
It has added these cmake-flags:
'-D BUILD_PROTOBUF=OFF'
'-D PROTOBUF_INCLUDE_DIR=/usr/include')
Now it works in both C++ and python.
The compiling command is the whole makefile.
# Maintainer: Andrew Crerar <andrew (at) crerar (dot) io>
# Contributor: Valentin Churavy <v.churavy@gmail.com>
# Contributor: Romain Reignier <rom.reignier@gmail.com>
# Contributor: Fabien Dubosson <fabien.dubosson@gmail.com>
# Contributor: David Manouchehri <david@davidmanouchehri.com>
# Contributor: CHEN Xing <cxcxcxcx@gmail.com>
# Contributor: Martin Imobersteg <martin.imobersteg@gmail.com>
# Contributor: Artyom Smirnov <smirnoffjr@gmail.com>
# Also largely inspired by `opencv` in extra, so including contributors too:
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
_name=opencv
pkgname="${_name}-git"
pkgver=3.3.0.r270.g4435ec5f26
pkgrel=1
pkgdesc="Open Source Computer Vision Library"
url="http://opencv.org/"
license=('BSD')
arch=('i686' 'x86_64')
depends=('intel-tbb'
'openexr'
'xine-lib'
'libdc1394'
'hdf5'
'gst-plugins-base-libs'
'gtk3'
'protobuf')
makedepends=('git' 'cmake' 'python2-numpy' 'python-numpy' 'mesa' 'eigen')
optdepends=('opencv-samples'
'eigen'
'opencl-icd-loader: For coding with OpenCL'
'python-numpy: Python 3 interface'
'python2-numpy: Python 2 interface')
conflicts=('opencv' 'opencv-git')
provides=("${_name}=${pkgver}")
source=('git+https://github.com/opencv/opencv.git'
'git+https://github.com/opencv/opencv_contrib.git')
sha512sums=('SKIP'
'SKIP')
_cmakeopts=('-D WITH_OPENCL=ON'
'-D WITH_OPENGL=ON'
'-D WITH_TBB=ON'
'-D WITH_XINE=ON'
'-D BUILD_WITH_DEBUG_INFO=OFF'
'-D BUILD_TESTS=OFF'
'-D BUILD_PERF_TESTS=OFF'
'-D BUILD_EXAMPLES=ON'
'-D INSTALL_C_EXAMPLES=ON'
'-D INSTALL_PYTHON_EXAMPLES=ON'
'-D CMAKE_BUILD_TYPE=Release'
'-D CMAKE_INSTALL_PREFIX=/usr'
'-D CMAKE_SKIP_RPATH=ON'
'-D BUILD_PROTOBUF=OFF'
'-D PROTOBUF_INCLUDE_DIR=/usr/include')
# SSE only available from Pentium 3 onwards (i686 is way older)
[[ "$CARCH" = 'i686' ]] && \
_cmakeopts+=('-D ENABLE_SSE=OFF'
'-D ENABLE_SSE2=OFF'
'-D ENABLE_SSE3=OFF')
pkgver() {
cd "${srcdir}/${_name}"
git describe --long | sed -r 's/([^-]*-g)/r\1/;s/-/./g'
}
build() {
cmake ${_cmakeopts[@]} \
-DOPENCV_EXTRA_MODULES_PATH="${srcdir}/opencv_contrib/modules" \
${_name}
make
}
package() {
options=('staticlibs')
make DESTDIR="${pkgdir}" install
# install LICENSE file
install -Dm644 "${srcdir}/${_name}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
Last edited by thund3rpantz (2017-09-19 08:42:24)
Offline
Pages: 1