alyssaq / face_morpher

:angel: Morph faces with Python, Numpy, Scipy
882 stars 233 forks source link

libopencv_aruco.so.3.1: cannot open shared object file #15

Open brainstormapps opened 7 years ago

brainstormapps commented 7 years ago

Hi alyssaq, I am trying to use face morpher with following specs: My operating system ubuntu 16.04, opencv 3.1 and all requirements in requirements.txt, but when I run command:

python facemorpher/morpher.py --src='/home/mna/Downloads/face_morpher/face1.jpg' --dest='/home/mna/Downloads/face_morpher/face2.jpg'

return an error: error while loading shared libraries: libopencv_aruco.so.3.1: cannot open shared object file: No such file or directory Traceback (most recent call last): File "facemorpher/morpher.py", line 145, in args['--alpha'], args['--plot']) File "facemorpher/morpher.py", line 130, in morpher src_img, src_points = next(images_points_gen) File "facemorpher/morpher.py", line 66, in load_valid_image_points img, points = load_image_points(path, size) File "facemorpher/morpher.py", line 56, in load_image_points points = locator.face_points(path) File "/home/mna/Downloads/face_morpher/facemorpher/locator.py", line 55, in face_points s = subprocess.check_output(command, universal_newlines=True) File "/usr/lib/python2.7/subprocess.py", line 574, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '['/home/mna/Downloads/face_morpher/facemorpher/bin/stasm_util_linux_cv3', '-f', '/home/mna/Downloads/face_morpher/facemorpher/data', '/home/mna/Downloads/face_morpher/face1.jpg']' returned non-zero exit status 127

Can you help me to solve this error.

bu2zhouzhu commented 7 years ago

I had almost same problem. Only on my pc it said can't load library libopencv_calib3d.so.3.1

OS: Manjaro 17.0 OpenCV: 3.2.0

Error

/home/me/code/face_morpher-master/facemorpher/bin/stasm_util_linux_cv3: error while loading shared libraries: libopencv_calib3d.so.3.1: cannot open shared object file: No such file or directory

Traceback

File "facemorpher/morpher.py", line 145, in args['--alpha'], args['--plot']) File "facemorpher/morpher.py", line 130, in morpher src_img, src_points = next(images_points_gen) File "facemorpher/morpher.py", line 66, in load_valid_image_points img, points = load_image_points(path, size) File "facemorpher/morpher.py", line 56, in load_image_points points = locator.face_points(path) File "/home/me/code/face_morpher-master/facemorpher/locator.py", line 55, in face_points s = subprocess.check_output(command, universal_newlines=True) File "/usr/lib/python3.6/subprocess.py", line 336, in check_output **kwargs).stdout File "/usr/lib/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['/home/me/code/face_morpher-master/facemorpher/bin/stasm_util_linux_cv3', '-f', '/home/me/code/face_morpher-master/facemorpher/data', 'hillary_clinton.jpg']' returned non-zero exit status 127.

bu2zhouzhu commented 7 years ago

According to Archlinux package webpage, there is no file libopencv_calib3d.so.3.1. Instead it has usr/lib/libopencv_calib3d.so.3.2. How shoud I change source code so it will load library libopencv_calib3d.so.3.2 instead of libopencv_calib3d.so.3.1 ?

bu2zhouzhu commented 7 years ago

Problem solved.

Problem

file facemorpher/bin/stasm_util_linux_cv3

Solution

According to this project's README, at bottom, it says You can build a new stasm binary with the Stasm 4 build scripts. So I followed README in stasm_build project, build a new stasm_util file, rename it to stasm_util_linux_cv3, then copy it to face_morpher/facemorpher/bin to replace origin stasm_util_linux_cv3 file.

alyssaq commented 7 years ago

Awesome. Thanks @bu2zhouzhu. Glad that worked.

@brainstormapps could you try building a stasm binary for your OS and replace it in face_morpher/facemorpher/bin/stasm_util_linux_cv3

hafquangbaox commented 7 years ago

@alyssaq I was build new stasm_util on my vps (Ubuntu 14.04,32 bit), but i run command to test it, i got error

./stasm_util -f /home/Ylinkee/public_html/face_morpher/facemorpher/data /home/Ylinkee/public_html/routes/../public/uploaded/appnhe/tilevang/images/1502849486700LNG3k2v/1.png 213 144 213 168 215 190 222 216 241 240 264 254 283 257 304 252 328 235 343 212 348 188 349 168 349 147 308 91 280 84 252 88 258 121 247 122 237 130 248 128 258 127 269 127 295 130 306 124 319 126 329 137 317 134 306 131 310 139 255 135 265 145 260 141 255 139 250 141 245 144 250 147 255 148 260 147 256 143 311 147 300 148 305 144 310 143 315 144 320 148 315 150 310 152 305 150 291 169 281 169 272 169 271 186 281 181 291 187 301 184 295 191 281 193 267 189 262 183 261 214 268 206 276 204 282 205 287 204 295 207 302 215 292 211 282 210 272 210 272 217 282 219 292 218 299 223 291 227 282 228 273 227 265 222 pure virtual method called terminate called without an active exception Aborted

Please help me :(

hafquangbaox commented 7 years ago

I sloved it by change OS from ubuntu 14.04 32-bit to ubuntu 14.04 64-bit and build another stasm_util, it worked :)

@alyssaq please review https://github.com/alyssaq/stasm_build to sure it don't work with ubuntu 14.04 32-bit

johnny-human commented 4 years ago

I had the same problem when building a rust project with opencv. Solved it by adding library path to opencv.conf and update cache:

sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig