转载请注明出处:

https://www.cnblogs.com/darkknightzh/p/11285239.html

参考网址:

https://github.com/YuliangXiu/PoseFlow

http://xiuyuliang.cn/2014/12/05/deepmatching/

1 简介

pose flow可以直接使用,但是需要编译deep matching的文件夹。官方给出的编译步骤如下:

cd deepmatching
make clean all
make python
cd ..

2 makefile

但是直接使用官方的makefile无法编译成功,需要修改一下。

由于这边是用的是anaconda3,下面直接贴出修改后的makefile:

注意:如果直接拷贝可能由于网页原因,把下面28、31、34等这些行前面的tab换成了空格,导致make的时候出错。此时将这些行的空格改成tab即可。

 CC=g++

 OS_NAME=$(shell uname -s)
ifeq ($(OS_NAME),Linux)
LAPACKLDFLAGS=/home/xxx/anaconda3/lib/libsatlas.so # single-threaded blas #LAPACKLDFLAGS=/usr/lib64/atlas/libtatlas.so # multi-threaded blas
#BLAS_THREADING=-D MULTITHREADED_BLAS # remove this if wrong
endif
ifeq ($(OS_NAME),Darwin) # Mac OS X
LAPACKLDFLAGS=-framework Accelerate # for OS X
endif
LAPACKCFLAGS=-Dinteger=int $(BLAS_THREADING)
STATICLAPACKLDFLAGS=-fPIC -Wall -g -fopenmp -static -static-libstdc++ /home/xxx/anaconda3/lib/libjpeg.a /home/xxx/anaconda3/lib/libpng.a /usr/lib64/libz.a /usr/lib64/libblas.a /usr/lib/gcc/x86_64-redhat-linux/4.9./libgfortran.a /usr/lib/gcc/x86_64-redhat-linux/4.9./libquadmath.a # statically linked version CFLAGS= -fPIC -Wall -g -std=c++ $(LAPACKCFLAGS) -fopenmp -DUSE_OPENMP -O3
LDFLAGS=-fPIC -Wall -g -ljpeg -lpng -fopenmp -lblas
CPYTHONFLAGS=-I/home/xxx/anaconda3/include/python3.6m SOURCES := $(shell find . -name '*.cpp' ! -name 'deepmatching_matlab.cpp')
OBJ := $(SOURCES:%.cpp=%.o)
HEADERS := $(shell find . -name '*.h') all: deepmatching .cpp.o: %.cpp %.h
$(CC) -o $@ $(CFLAGS) -c $+ deepmatching: $(HEADERS) $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS) $(LAPACKLDFLAGS) -L/home/xxx/anaconda3/lib -I/home/xxx/anaconda3/include deepmatching-static: $(HEADERS) $(OBJ)
$(CC) -o $@ $^ $(STATICLAPACKLDFLAGS) python: $(HEADERS) $(OBJ)
# swig -python $(CPYTHONFLAGS) deepmatching.i # not necessary, only do if you have swig compiler
g++ $(CFLAGS) -c deepmatching_wrap.c $(CPYTHONFLAGS)
g++ -shared $(LDFLAGS) $(LAPACKLDFLAGS) deepmatching_wrap.o $(OBJ) -o _deepmatching.so $(LIBFLAGS) -L/home/xxx/anaconda3/lib clean:
rm -f $(OBJ) deepmatching *~ *.pyc .gdb_history deepmatching_wrap.o _deepmatching.so deepmatching.mex???

3 说明

3.1. 虽然STATICLAPACKLDFLAGS也进行了修改,但是由于未编译静态库,因而未进行测试这个是否成功。

3.2. 其他修改主要是设置路径,最主要的是LDFLAGS,增加了-lblas,否则我这边会出错。

/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_stop_numeric'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_pow_i4_i4'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_transfer_character'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_compare_string'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_st_write_done'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_pow_r8_i4'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_concat_string'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_pow_r4_i4'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_etime'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_copy_string'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_transfer_integer'
/home/xxx/anaconda3/lib/libsatlas.so: undefined reference to `_gfortran_st_write'

3.3. 另一方面,31行增加了-L/home/xxx/anaconda3/lib,否则提示下面的错(原因是使用的是anaconda3,这些库都是anaconda3里面的,不在系统目录中)。

/usr/bin/ld: cannot find -ljpeg
/usr/bin/ld: cannot find –lpng

若提示找不到头文件,可以在该行-I处添加。

3.4. 将deepmatching_wrap.c中2983行

#include <numpy/arrayobject.h>

修改为

#include </home/xxx/anaconda3/lib/python3./site-packages/numpy/core/include/numpy/arrayobject.h>

这个不记得是哪个参考网址里面给出的了(我这边根据anaconda3的路径重新配置了),见谅。。。

3.5 http://xiuyuliang.cn/2014/12/05/deepmatching/中指出,ubuntu中没有libsatlas.so,按照该网页的第一步,直接将libatlas.a liblapack.a libf77blas.a libcblas.a捏成一个即可。在anaconda3中,这些.a文件均在/home/xxx/anaconda3/lib中,因而在该文件夹中打开终端,而后输入网页中的命令即可(若需复制命令,请移步该网页,此处只是保存个备份,如有侵权,我会删除)。

3.6 在~/.bashrc中添加下面两句(不知道为何3.3中-I添加了include路径,结果还是有错)

export C_INCLUDE_PATH=/home/xxx/anaconda3/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/home/xxx/anaconda3/include:$CPLUS_INCLUDE_PATH

否则找不到jpeglib.h

io.cpp:19:21: fatal error: jpeglib.h: No such file or directory

 =================================================================================

190807更新:

3.7 编译成功之后,运行pose flow的matching.py时,若使用deep matching,会提示找不到libjpeg.so.9,原因是其不在系统的目录里面。可以将matching.py的最后一句修改成:

解决方法参考网页https://stackoverflow.com/questions/29888716/i-use-os-system-to-run-executable-file-but-it-need-a-so-file-it-cant-find-li

cmd = "LD_LIBRARY_PATH=/home/xxx/anaconda3/lib ./deepmatching/deepmatching %s %s -nt 10 -downscale 3 -out %s/%s_%s.txt > cache"%(img1,img2,vidname,img1_id,img2_id)

之后便可以成功使用deep matching。

190807更新结束

 =================================================================================

(原)在anaconda3+ubuntu16.04中编译Pose flow中的deepmatching动态库的更多相关文章

  1. Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件)

    Ubuntu16.04下编译OpenCV2.4.13静态库(.a文件) https://blog.csdn.net/woainishifu/article/details/79712110 我们在做项 ...

  2. 在ubuntu16.04上编译android源码【转】

    本文转载自:http://blog.csdn.net/fuchaosz/article/details/51487585 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6. ...

  3. Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)

    Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...

  4. 动态库与静态库的学习 博主写的很好 静态库 编译的时候 需要加上 static 动态库编译ok运行不成功就按照文章中的方法修改

    来源连接   http://www.cnblogs.com/skynet/p/3372855.html C++静态库与动态库 这次分享的宗旨是--让大家学会创建与使用静态库.动态库,知道静态库与动态库 ...

  5. ubuntu16.04下编译ceres-solver

    一.编译环境 ubuntu16.04 二.准备工作之安装必要的库 2.1安装cmake sudo apt-get install cmake 2.2 安装google-glog + gflags su ...

  6. Ubuntu16.04下编译android6.0源码

    http://blog.csdn.net/cnliwy/article/details/52189349 作为一名合格的android开发人员,怎么能不会编译android源码呢!一定要来一次说编译就 ...

  7. ubuntu16.04下编译安装vim8.1

    之前写过一篇centos7下编译安装vim8.0的教程,ubuntu16.04相比centos7下安装过程不同在于依赖包名字的不同,其余都是一样.下面给出ubuntu16.04编译安装vim8.0需要 ...

  8. Ubuntu16.04下编译安装及运行单目ORBSLAM2

    官网有源代码和配置教程,地址是 https://github.com/raulmur/ORB_SLAM2 1 安装必要工具 首先,有两个工具是需要提前安装的.即cmake和Git. sudo apt- ...

  9. 关于jni编译32位、64位动态库(Android.mk和Application.mk文件)

    最近新项目需要编译64位的动态库,这里记录如何配置. 在jni目录下加入Android.mk和Application.mk文件. Application.mk APP_ABI := armeabi a ...

随机推荐

  1. shell脚本的输入以及脚本拥有特效地输出

    shell脚本的输入以及脚本拥有特效地输出 shell脚本输入之read命令 之前是直接在sh 后加参数 现在是另一种方式 语法:read -参数 -p:给出提示符.默认不支持"\n&quo ...

  2. 链接doc命令行的mysql的编码问题

    好几次用doc命令行链接mysql数据库进行保存注册等内容,一直出错,要么插入数据库的是乱码问题,要么是没插进去,怎么回事? 在修改了代码(接收中文数据)的基础上(即在代码中用utf-8接收数据) 也 ...

  3. electron 创建托盘应用

    在Electron中我们创建一个托盘需要如下几个文件: 1. main.js 用来存放应用代码.2. 一张PNG格式的图片用作应用图标.3. 一个package.json文件用来描述应用配置. 下面是 ...

  4. K12

    K12,教育类专用名词(kindergarten through twelfth grade),是学前教育至高中教育的缩写,现在普遍被用来代指基础教育. K-12教育是美国基础教育的统称.“K12”中 ...

  5. Java System.getProperty vs System.getenv

    转自:https://www.baeldung.com/java-system-get-property-vs-system-getenv 1. Introduction The package ja ...

  6. SWA2G422&485JK2G基础篇: STM32+W5500实现MQTT通信控制,485/422透传通信

    说明 这节实现的功能: STM32+W5500实现MQTT通信控制 细节功能: 1.DHCP动态获取IP 2.DNS域名解析 3.网口<--MQTT-->485/422透传通信 测试准备工 ...

  7. alarm()函数的使用总结

    alarm()函数说明 1.引用头文件:#include <unistd.h>; 2.函数标准式:unsigned int alarm(unsigned int seconds); 3.功 ...

  8. 显示隐藏文件.reg

    显示隐藏文件.reg Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\Curren ...

  9. [LeetCode] 565. Array Nesting 数组嵌套

    A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest ...

  10. [LeetCode] 465. Optimal Account Balancing 最优账户平衡

    A group of friends went on holiday and sometimes lent each other money. For example, Alice paid for ...