Giter VIP home page Giter VIP logo

pyflow's Introduction

Python Dense Optical Flow

Python wrapper for Ce Liu's C++ implementation of Coarse2Fine Optical Flow. This is super fast and accurate optical flow method based on Coarse2Fine warping method from Thomas Brox. This python wrapper has minimal dependencies, and it also eliminates the need for C++ OpenCV library. For real time performance, one can additionally resize the images to a smaller size.

Run the following steps to download, install and demo the library:

git clone https://github.com/pathak22/pyflow.git
cd pyflow/
python setup.py build_ext -i
python demo.py    # -viz option to visualize output

This wrapper code was developed as part of our CVPR 2017 paper on Unsupervised Learning using unlabeled videos. Github repository for our CVPR 17 paper is here.

pyflow's People

Contributors

pathak22 avatar thmoa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyflow's Issues

color map and vector array

Which part of your code is about optical flow map?

I want to know about process of making optical flow map.

Is there any part about converting between color map and vector map which is provided in .npy form

I need to get vector map from color map

Warping different image using OpticalFlow

Hi, I'm just wondering if you think I could modify this to calculate the optical flow for 2 images(As it currently does) but warp a third image of my choosing, instead of the first image(as it currently does)?

Thanks in advance.

Link error when compiling on Windows

I was trying to compile this on a Windows machine. However I got this error:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 /LIBPATH:C:\Python27\PC\VS9.0\amd64 /EXPORT:initpyflow build\temp.win-amd64-2.7\Release\pyflow.obj build\temp.win-amd64-2.7\Release\src\Coarse2FineFlowWrapper.obj build\temp.win-amd64-2.7\Release\src\GaussianPyramid.obj build\temp.win-amd64-2.7\Release\src\OpticalFlow.obj build\temp.win-amd64-2.7\Release\src\Stochastic.obj build\temp.win-amd64-2.7\Release\src/Coarse2FineFlowWrapper.obj "/OUT:C:\Users\iliuh\Documents\Python Scripts\pyflow-master\pyflow.pyd" /IMPLIB:build\temp.win-amd64-2.7\Release\pyflow.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\pyflow.pyd.manifest
Coarse2FineFlowWrapper.obj : error LNK2005: "void __cdecl Coarse2FineFlowWrapper(double *,double *,double *,double const *,double const *,double,double,int,int,int,int,int,int,int,int)" (?Coarse2FineFlowWrapper@@YAXPEAN00PEBN1NNHHHHHHHH@Z) already defined in Coarse2FineFlowWrapper.obj
pyflow.obj : warning LNK4197: export 'initpyflow' specified multiple times; using first specification

   Creating library build\temp.win-amd64-2.7\Release\pyflow.lib and object build\temp.win-amd64-2.7\Release\pyflow.exp
C:\Users\iliuh\Documents\Python Scripts\pyflow-master\pyflow.pyd : fatal error LNK1169: one or more multiply defined symbols found
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\amd64\\link.exe' failed with exit status 1169

Any ideas? I also tried this code in the Ubuntu system and it complied successfully.
Thanks so much!

Cython.Compiler.Errors.CompileError: pyflow.pyx

first ,thank you for your work !
I want to use this pyflow work alone,but when i run python setup.py build_ext -i ,it make some wrong like this:

Compiling pyflow.pyx because it changed.
Cythonizing pyflow.pyx

Error compiling Cython file:
------------------------------------------------------------
...
    void Coarse2FineFlowWrapper(double * vx, double * vy, double * warpI2,
                                  const double * Im1, const double * Im2,
                                  double alpha, double ratio, int minWidth,
                                  int nOuterFPIterations, int nInnerFPIterations,
                                  int nSORIterations, int colType,
                                  int h, int w, int c);
                                                     ^
------------------------------------------------------------

pyflow.pyx:17:54: Syntax error in C variable declaration
Traceback (most recent call last):
  File "setup.py", line 20, in <module>
    ext_modules=cythonize(extensions),
  File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 798, in cythonize
    cythonize_one(*args[1:])
  File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 915, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pyflow.pyx

Can you give me some suggestion on this problem ?Thank you .

How to use in code?

Hi, I tried to mimic your usage in demo.py by trying to use pyflow.coarse2fine_flow, but my interpreter does not recognize it.
Am I missing something? Is this not the correct way to use your module?

windows support?

Hello,

I'm trying to setup (compile) the source on Windows 10 with VC++ 14, python 3.5 but I get the following error(s)

running build_ext building 'pyflow' extension C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adi\Miniconda3\envs\python35\lib\site-packages\numpy\core\include -IC:\Users\Adi\Miniconda3\envs\python35\lib\site-packages\numpy\core\include -IC:\Users\Adi\Miniconda3\envs\python35\include -IC:\Users\Adi\Miniconda3\envs\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tppyflow.cpp /Fobuild\temp.win-amd64-3.5\Release\pyflow.obj pyflow.cpp c:\users\adi\miniconda3\envs\python35\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION pyflow.cpp(1949): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data pyflow.cpp(1958): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data pyflow.cpp(1967): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adi\Miniconda3\envs\python35\lib\site-packages\numpy\core\include -IC:\Users\Adi\Miniconda3\envs\python35\lib\site-packages\numpy\core\include -IC:\Users\Adi\Miniconda3\envs\python35\include -IC:\Users\Adi\Miniconda3\envs\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /EHsc /Tpsrc\Coarse2FineFlowWrapper.cpp /Fobuild\temp.win-amd64-3.5\Release\src\Coarse2FineFlowWrapper.obj Coarse2FineFlowWrapper.cpp d:\pyflow\src\project.h(41): error C2146: syntax error: missing ')' before identifier 'a' d:\pyflow\src\project.h(41): error C2365: 'T1': redefinition; previous definition was 'template parameter' d:\pyflow\src\project.h(40): note: see declaration of 'T1' d:\pyflow\src\project.h(41): error C2061: syntax error: identifier 'a' d:\pyflow\src\project.h(41): error C2059: syntax error: ')' d:\pyflow\src\project.h(41): error C2146: syntax error: missing ')' before identifier 'b' d:\pyflow\src\project.h(41): error C2146: syntax error: missing ';' before identifier 'b' d:\pyflow\src\project.h(42): error C2143: syntax error: missing ';' before '{' d:\pyflow\src\project.h(42): error C2447: '{': missing function header (old-style formal list?) d:\pyflow\src\project.h(47): error C2146: syntax error: missing ')' before identifier 'a' d:\pyflow\src\project.h(47): error C2365: 'T1': redefinition; previous definition was 'template parameter' d:\pyflow\src\project.h(46): note: see declaration of 'T1' d:\pyflow\src\project.h(47): error C2061: syntax error: identifier 'a' d:\pyflow\src\project.h(47): error C2059: syntax error: ')' d:\pyflow\src\project.h(47): error C2146: syntax error: missing ')' before identifier 'b' d:\pyflow\src\project.h(47): error C2146: syntax error: missing ';' before identifier 'b' d:\pyflow\src\project.h(48): error C2143: syntax error: missing ';' before '{' d:\pyflow\src\project.h(48): error C2447: '{': missing function header (old-style formal list?) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\vcruntime_typeinfo.h(110): error C2989: 'type_info': class template has already been declared as a non-class template C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\eh.h(49): note: see declaration of 'type_info' d:\pyflow\src\ImageProcessing.h(130): error C2039: 'BilinearInterpolate': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(152): error C2039: 'BilinearInterpolate': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(179): error C2039: 'BilinearInterpolate_transpose': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(205): error C2039: 'ResizeImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(226): error C2039: 'ResizeImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(249): error C2039: 'hfiltering': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(274): error C2039: 'hfiltering_transpose': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(299): error C2039: 'Laplacian': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(339): error C2039: 'vfiltering': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(363): error C2039: 'vfiltering_transpose': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(390): error C2039: 'filtering': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(422): error C2039: 'filtering_transpose': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(450): error C2039: 'getPatch': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(471): error C2039: 'warpImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(493): error C2039: 'warpImageFlow': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(515): error C2039: 'warpImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(533): error C2039: 'warpImage_transpose': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(555): error C2039: 'warpImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(573): error C2039: 'warpImage_transpose': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(593): error C2039: 'warpImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(623): error C2039: 'cropImage': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(647): error C2039: 'generate2DGaussian': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(671): error C2039: 'generate1DGaussian': is not a member of 'ImageProcessing' d:\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing' error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.11.25503\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2

coarse-to-fine

what is the parameter list of the coarse2fine function, and on what that parameters depend?

Installation error on Windows 10 with Python 3.6

Hi guys,

I'm getting the following installation error:

Compiling pyflow.pyx because it changed.
[1/1] Cythonizing pyflow.pyx
running build_ext
building 'pyflow' extension
creating build
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\src
C:\Mingw\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\User
s\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\gelaz\Anaconda3\include -IC:\Users\gelaz\Anaconda3\inc
lude -c pyflow.cpp -o build\temp.win-amd64-3.6\Release\pyflow.o
In file included from C:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1818:0,
from C:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
from C:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
from pyflow.cpp:525:
C:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:13:79: note: #pragma messag
e: C:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h(12) : Warning Msg: Using
deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
^
pyflow.cpp: In function 'PyTypeObject* __Pyx_ImportType(const char*, const char*, size_t, int)':
pyflow.cpp:7960:53: warning: unknown conversion type character 'z' in format [-Wformat=]
module_name, class_name, basicsize, size);
^
pyflow.cpp:7960:53: warning: unknown conversion type character 'z' in format [-Wformat=]
pyflow.cpp:7960:53: warning: too many arguments for format [-Wformat-extra-args]
C:\Mingw\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\User
s\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\gelaz\Anaconda3\include -IC:\Users\gelaz\Anaconda3\inc
lude -c src/Coarse2FineFlowWrapper.cpp -o build\temp.win-amd64-3.6\Release\src\coarse2fineflowwrapper.o
In file included from src/Image.h:9:0,
from src/Coarse2FineFlowWrapper.cpp:8:
src/ImageProcessing.h: In static member function 'static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int
, int, int)':
src/ImageProcessing.h:230:60: warning: 'memset' used with constant zero length parameter; this could be due to transpose
d parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
C:\Mingw\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\User
s\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\gelaz\Anaconda3\include -IC:\Users\gelaz\Anaconda3\inc
lude -c src\GaussianPyramid.cpp -o build\temp.win-amd64-3.6\Release\src\gaussianpyramid.o
In file included from src\Image.h:9:0,
from src\GaussianPyramid.h:7,
from src\GaussianPyramid.cpp:4:
src\ImageProcessing.h: In static member function 'static void ImageProcessing::ResizeImage(const T1
, T2*, int, int, int
, int, int)':
src\ImageProcessing.h:230:60: warning: 'memset' used with constant zero length parameter; this could be due to transpose
d parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
src\ImageProcessing.h: In instantiation of 'static void ImageProcessing::vfiltering(const T1
, T2*, int, int, int, const
double*, int) [with T1 = double; T2 = double]':
src\Image.h:1331:29: required from 'void Image::imfilter_hv(Image&, const double*, int, const double*, int) con
st [with T1 = double; T = double]'
src\Image.h:1199:2: required from 'void Image::GaussianSmoothing(Image&, double, int) const [with T1 = double;
T = double]'
src\GaussianPyramid.cpp:67:45: required from here
src\ImageProcessing.h:344:14: warning: unused variable 'offset' [-Wunused-variable]
int i,j,l,k,offset,ii;
^~~~~~
C:\Mingw\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\User
s\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\gelaz\Anaconda3\include -IC:\Users\gelaz\Anaconda3\inc
lude -c src\OpticalFlow.cpp -o build\temp.win-amd64-3.6\Release\src\opticalflow.o
In file included from src\Image.h:9:0,
from src\OpticalFlow.h:6,
from src\OpticalFlow.cpp:4:
src\ImageProcessing.h: In static member function 'static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int
, int, int)':
src\ImageProcessing.h:230:60: warning: 'memset' used with constant zero length parameter; this could be due to transpose
d parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
src\OpticalFlow.cpp: In static member function 'static void OpticalFlow::SmoothFlowSOR(const DImage&, const DImage&, DIm
age&, DImage&, DImage&, double, int, int, int)':
src\OpticalFlow.cpp:267:11: warning: unused variable 'power_alpha' [-Wunused-variable]
double power_alpha = 0.5;
^~~~~~~~~~~
src\OpticalFlow.cpp:287:11: warning: unused variable '_a' [-Wunused-variable]
double _a = 10000, _b = 0.1;
^~
src\OpticalFlow.cpp:287:24: warning: unused variable '_b' [-Wunused-variable]
double _a = 10000, _b = 0.1;
^~
src\OpticalFlow.cpp: In static member function 'static void OpticalFlow::SmoothFlowPDE(const DImage&, const DImage&, DIm
age&, DImage&, DImage&, double, int, int, int)':
src\OpticalFlow.cpp:545:11: warning: unused variable 'power_alpha' [-Wunused-variable]
double power_alpha = 0.5;
^~~~~~~~~~~
src\OpticalFlow.cpp:565:11: warning: unused variable '_a' [-Wunused-variable]
double _a = 10000, _b = 0.1;
^~
src\OpticalFlow.cpp:565:24: warning: unused variable '_b' [-Wunused-variable]
double _a = 10000, _b = 0.1;
^~
In file included from src\Image.h:9:0,
from src\OpticalFlow.h:6,
from src\OpticalFlow.cpp:4:
src\ImageProcessing.h: In instantiation of 'static void ImageProcessing::vfiltering(const T1
, T2*, int, int, int, const
double*, int) [with T1 = double; T2 = double]':
src\Image.h:1331:29: required from 'void Image::imfilter_hv(Image&, const double*, int, const double*, int) con
st [with T1 = double; T = double]'
src\OpticalFlow.cpp:52:42: required from here
src\ImageProcessing.h:344:14: warning: unused variable 'offset' [-Wunused-variable]
int i,j,l,k,offset,ii;
^~~~~~
In file included from src\OpticalFlow.h:6:0,
from src\OpticalFlow.cpp:4:
src\Image.h: In instantiation of 'void Image::warpImageBicubicRef(const Image&, Image&, const Image&, const
Image&, const Image&, const Image&, const Image&) const [with T1 = double; T2 = double; T = double]':
src\Image.h:2482:2: required from 'void Image::warpImageBicubicRef(const Image&, Image&, const Image&, co
nst Image&) const [with T1 = double; T = double]'
src\OpticalFlow.cpp:437:43: required from here
src\Image.h:2525:4: warning: variable 'ImgMax' set but not used [-Wunused-but-set-variable]
T ImgMax;
^~~~~~
C:\Mingw\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\User
s\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\gelaz\Anaconda3\include -IC:\Users\gelaz\Anaconda3\inc
lude -c src\Stochastic.cpp -o build\temp.win-amd64-3.6\Release\src\stochastic.o
C:\Mingw\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\User
s\gelaz\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\gelaz\Anaconda3\include -IC:\Users\gelaz\Anaconda3\inc
lude -c src/Coarse2FineFlowWrapper.cpp -o build\temp.win-amd64-3.6\Release\src\coarse2fineflowwrapper.o
In file included from src/Image.h:9:0,
from src/Coarse2FineFlowWrapper.cpp:8:
src/ImageProcessing.h: In static member function 'static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int
, int, int)':
src/ImageProcessing.h:230:60: warning: 'memset' used with constant zero length parameter; this could be due to transpose
d parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
writing build\temp.win-amd64-3.6\Release\pyflow.cp36-win_amd64.def
C:\Mingw\bin\g++.exe -shared -s build\temp.win-amd64-3.6\Release\pyflow.o build\temp.win-amd64-3.6\Release\src\coarse2fi
neflowwrapper.o build\temp.win-amd64-3.6\Release\src\gaussianpyramid.o build\temp.win-amd64-3.6\Release\src\opticalflow.
o build\temp.win-amd64-3.6\Release\src\stochastic.o build\temp.win-amd64-3.6\Release\src\coarse2fineflowwrapper.o build
temp.win-amd64-3.6\Release\pyflow.cp36-win_amd64.def -LC:\Users\gelaz\Anaconda3\libs -LC:\Users\gelaz\Anaconda3\PCbuild
amd64 -lpython36 -lmsvcr140 -o C:\Users\gelaz\Desktop\pyflow\pyflow.cp36-win_amd64.pyd
build\temp.win-amd64-3.6\Release\src\coarse2fineflowwrapper.o:Coarse2FineFlowWrapper.cpp:(.text+0x11): multiple definiti
on of `Coarse2FineFlowWrapper(double
, double*, double*, double const*, double const*, double, double, int, int, int, in
t, int, int, int, int)'
build\temp.win-amd64-3.6\Release\src\coarse2fineflowwrapper.o:Coarse2FineFlowWrapper.cpp:(.text+0x11): first defined her
e
C:\Users\gelaz\Anaconda3\libs/libpython36.dll.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
error: command 'C:\Mingw\bin\g++.exe' failed with exit status 1

Understanding the output npy array

Feeding 2 images of resolution 240x320 is generating a .npy array of shape (320, 240, 2) containing positive and negative values. I want to feed these as features for an action modeling problem. I want to get a better idea of what these values actually mean.
Is it the distance moved by that particular pixel in the next frame? or coordinate?
Would really appreciate if someone could give me clarity.
Thanks, in advance.

why so slow?

It takes me 4 seconds per 331x331 image. That's significantly slower than the 0.06 seconds Zisserman reports in the original two stream paper. Can i make this code work on the GPU somehow? Or do you know of a GPU implementation?

Installing error

I am running on windows 10. This error comes when running:

python setup.py build_ext -i

error: Unable to find vcvarsall.bat

installation error in ubuntu

When I install pyflow in ubuntu, it happen

(pytorch100) hym@VIPA109:~/pycharm_remote/pyflow-master$ python setup.py build_ext -i
Compiling pyflow.pyx because it changed.
[1/1] Cythonizing pyflow.pyx
/home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/disk1/hym/pycharm_remote/pyflow-master/pyflow.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'pyflow' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -B /home/disk1/hym/anaconda3/envs/pytorch100/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/numpy/core/include -I/home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/numpy/core/include -I/home/disk1/hym/anaconda3/envs/pytorch100/include/python3.7m -c pyflow.cpp -o build/temp.linux-x86_64-3.7/pyflow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from pyflow.cpp:29:0:
/home/disk1/hym/anaconda3/envs/pytorch100/include/python3.7m/Python.h:14:2: error: #error "Something's broken. UCHAR_MAX should be defined in limits.h."
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
^
/home/disk1/hym/anaconda3/envs/pytorch100/include/python3.7m/Python.h:18:2: error: #error "Python's source code assumes C's unsigned char is an 8-bit type."
#error "Python's source code assumes C's unsigned char is an 8-bit type."
^
In file included from /home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
from /home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyflow.cpp:632:
/home/disk1/hym/anaconda3/envs/pytorch100/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with "
^
In file included from /usr/include/stdio.h:74:0,
from /home/disk1/hym/anaconda3/envs/pytorch100/include/python3.7m/Python.h:25,
from pyflow.cpp:29:
/usr/include/libio.h:306:3: error: ‘size_t’ does not name a type
size_t __pad5;
^
/usr/include/libio.h:310:67: error: ‘size_t’ was not declared in this scope
char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
^
/usr/include/libio.h:338:62: error: ‘size_t’ has not been declared
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
^
/usr/include/libio.h:347:6: error: ‘size_t’ has not been declared
size_t __n);
^
In file included from /usr/include/stdio.h:74:0,
from /home/disk1/hym/anaconda3/envs/pytorch100/include/python3.7m/Python.h:25,
from pyflow.cpp:29:
...............
Please,if u know why, tell e solution?

How the optical flow hyperparameters are set ?

Hello,
How did you set these parameters  and how can they vary ?
Is is related to image shape / or resolution ?
Pyramidlevel= 12
alpha = 0.012
ratio = 0.75
minWidth = 20
nOuterFPIterations = 7
nInnerFPIterations = 1
nSORIterations = 30

Thank you

Installation error on Windows 10 using Python 3.7

When I ran python setup.py build_ext -i, I got this list or errors. Any suggestions/guide on fixing these?

building 'pyflow' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Python 3.7\lib\site-packages\numpy\core\include" "-IC:\Python 3.7\lib\site-packages\numpy\core\include" "-IC:\Python 3.7\include" "-IC:\Python 3.7\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tppyflow.cpp /Fobuild\temp.win-amd64-3.7\Release\pyflow.obj
pyflow.cpp
c:\python 3.7\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pyflow.cpp(2085): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
pyflow.cpp(2094): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
pyflow.cpp(2103): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Python 3.7\lib\site-packages\numpy\core\include" "-IC:\Python 3.7\lib\site-packages\numpy\core\include" "-IC:\Python 3.7\include" "-IC:\Python 3.7\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpsrc\Coarse2FineFlowWrapper.cpp /Fobuild\temp.win-amd64-3.7\Release\src\Coarse2FineFlowWrapper.obj
Coarse2FineFlowWrapper.cpp
c:\users\vnmin\documents\pyflow\src\project.h(41): error C2146: syntax error: missing ')' before identifier 'a'
c:\users\vnmin\documents\pyflow\src\project.h(41): error C2365: 'T1': redefinition; previous definition was 'template parameter'
c:\users\vnmin\documents\pyflow\src\project.h(40): note: see declaration of 'T1'
c:\users\vnmin\documents\pyflow\src\project.h(41): error C2061: syntax error: identifier 'a'
c:\users\vnmin\documents\pyflow\src\project.h(41): error C2059: syntax error: ')'
c:\users\vnmin\documents\pyflow\src\project.h(41): error C2146: syntax error: missing ')' before identifier 'b'
c:\users\vnmin\documents\pyflow\src\project.h(41): error C2146: syntax error: missing ';' before identifier 'b'
c:\users\vnmin\documents\pyflow\src\project.h(42): error C2143: syntax error: missing ';' before '{'
c:\users\vnmin\documents\pyflow\src\project.h(42): error C2447: '{': missing function header (old-style formal list?)
c:\users\vnmin\documents\pyflow\src\project.h(47): error C2146: syntax error: missing ')' before identifier 'a'
c:\users\vnmin\documents\pyflow\src\project.h(47): error C2365: 'T1': redefinition; previous definition was 'template parameter'
c:\users\vnmin\documents\pyflow\src\project.h(46): note: see declaration of 'T1'
c:\users\vnmin\documents\pyflow\src\project.h(47): error C2061: syntax error: identifier 'a'
c:\users\vnmin\documents\pyflow\src\project.h(47): error C2059: syntax error: ')'
c:\users\vnmin\documents\pyflow\src\project.h(47): error C2146: syntax error: missing ')' before identifier 'b'
c:\users\vnmin\documents\pyflow\src\project.h(47): error C2146: syntax error: missing ';' before identifier 'b'
c:\users\vnmin\documents\pyflow\src\project.h(48): error C2143: syntax error: missing ';' before '{'
c:\users\vnmin\documents\pyflow\src\project.h(48): error C2447: '{': missing function header (old-style formal list?)
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\vcruntime_typeinfo.h(111): error C2989: 'type_info': class template has already been declared as a non-class template
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\eh.h(49): note: see declaration of 'type_info'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(130): error C2039: 'BilinearInterpolate': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(152): error C2039: 'BilinearInterpolate': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(179): error C2039: 'BilinearInterpolate_transpose': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(205): error C2039: 'ResizeImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(226): error C2039: 'ResizeImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(249): error C2039: 'hfiltering': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(274): error C2039: 'hfiltering_transpose': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(299): error C2039: 'Laplacian': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(339): error C2039: 'vfiltering': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(363): error C2039: 'vfiltering_transpose': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(390): error C2039: 'filtering': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(422): error C2039: 'filtering_transpose': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(450): error C2039: 'getPatch': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(471): error C2039: 'warpImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(493): error C2039: 'warpImageFlow': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(515): error C2039: 'warpImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(533): error C2039: 'warpImage_transpose': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(555): error C2039: 'warpImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(573): error C2039: 'warpImage_transpose': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(593): error C2039: 'warpImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(623): error C2039: 'cropImage': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(647): error C2039: 'generate2DGaussian': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(671): error C2039: 'generate1DGaussian': is not a member of 'ImageProcessing'
c:\users\vnmin\documents\pyflow\src\ImageProcessing.h(19): note: see declaration of 'ImageProcessing'

installation on mac

for ' python setup.py build_ext -i ' , I get these errors:

running build_ext
building 'pyflow' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ecem/miniconda3/include -arch x86_64 -I/Users/ecem/miniconda3/include -arch x86_64 -I/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/ecem/miniconda3/include/python3.7m -c pyflow.cpp -o build/temp.macosx-10.9-x86_64-3.7/pyflow.o
In file included from pyflow.cpp:639:
In file included from /Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:
/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with "
^
1 warning generated.
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ecem/miniconda3/include -arch x86_64 -I/Users/ecem/miniconda3/include -arch x86_64 -I/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/ecem/miniconda3/include/python3.7m -c src/Stochastic.cpp -o build/temp.macosx-10.9-x86_64-3.7/src/Stochastic.o
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ecem/miniconda3/include -arch x86_64 -I/Users/ecem/miniconda3/include -arch x86_64 -I/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/ecem/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/ecem/miniconda3/include/python3.7m -c src/GaussianPyramid.cpp -o build/temp.macosx-10.9-x86_64-3.7/src/GaussianPyramid.o
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
In file included from src/Image.h:9:
src/ImageProcessing.h:154:20: warning: unused variable 'l' [-Wunused-variable]
int xx,yy,m,n,u,v,l,offset;
^
src/ImageProcessing.h:344:14: warning: unused variable 'offset' [-Wunused-variable]
int i,j,l,k,offset,ii;
^
src/ImageProcessing.h:415:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
delete pBuffer;
^
[]
src/ImageProcessing.h:395:18: note: allocated with 'new[]' here
double* pBuffer=new double[nChannels];
^
src/ImageProcessing.h:425:28: warning: unused variable 'offset' [-Wunused-variable]
int i,j,u,v,k,ii,jj,wsize,offset;
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
In file included from src/Image.h:14:
src/Stochastic.h:157:10: error: reference to '__max' is ambiguous
result=__max(result,pData[i]);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
In file included from src/Image.h:14:
src/Stochastic.h:405:7: error: reference to '__max' is ambiguous
u=__max(__min(u,NumPoints-1),0);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:62:8: error: reference to '__max' is ambiguous
Max=__max(Max,pData[i]);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1339:16: error: reference to '__max' is ambiguous
int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1339:16: error: type name requires a specifier or qualifier
int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
^
src/Image.h:1339:16: error: expected ')'
src/Image.h:1339:15: note: to match this '('
int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
^
src/Image.h:1340:16: error: reference to '__max' is ambiguous
int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1340:16: error: type name requires a specifier or qualifier
int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
^
src/Image.h:1340:16: error: expected ')'
src/Image.h:1340:15: note: to match this '('
int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
^
src/Image.h:1351:6: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
i = i;
~ ^ ~
src/Image.h:1428:16: error: reference to '__max' is ambiguous
int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1428:16: error: type name requires a specifier or qualifier
int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
^
src/Image.h:1428:16: error: expected ')'
src/Image.h:1428:15: note: to match this '('
int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
^
src/Image.h:1429:16: error: reference to '__max' is ambiguous
int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1429:16: error: type name requires a specifier or qualifier
int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
^
src/Image.h:1429:16: error: expected ')'
src/Image.h:1429:15: note: to match this '('
int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
^
src/Image.h:1495:16: error: reference to '__max' is ambiguous
data[i] = __max(data[i],pData[offset+j]);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1613:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
for(int k=0;k<firstNChannels;k++)
~^~~~~~~~~~~~~~~
src/Image.h:1933:20: error: reference to '__max' is ambiguous
pData[i] = __min(__max(pData[i],0),ImgMax);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:2288:15: error: reference to '__max' is ambiguous
x0 = __min(__max(x0,0),imWidth-1);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:2289:15: error: reference to '__max' is ambiguous
x1 = __min(__max(x1,0),imWidth-1);
^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
error: command 'gcc' failed with exit status 1

/cs/software/anaconda3/compiler_compat/ld: cannot find -lm

Can you please have a look and suggest fixes?

[jalal@goku HW4]$ git clone https://github.com/pathak22/pyflow.git
Cloning into 'pyflow'...
remote: Counting objects: 96, done.
remote: Total 96 (delta 0), reused 0 (delta 0), pack-reused 96
Unpacking objects: 100% (96/96), done.
[jalal@goku HW4]$ ls
pyflow
[jalal@goku HW4]$ cd pyflow/
[jalal@goku pyflow]$ ls
LICENSE  README.md  demo.py  examples  pyflow.pyx  setup.py  src
[jalal@goku pyflow]$ python demo.py 
Traceback (most recent call last):
  File "demo.py", line 11, in <module>
    import pyflow
ImportError: No module named 'pyflow'
[jalal@goku pyflow]$ python setup.py build_ext -i
Compiling pyflow.pyx because it changed.
[1/1] Cythonizing pyflow.pyx
running build_ext
building 'pyflow' extension
creating build
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/src
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c pyflow.cpp -o build/temp.linux-x86_64-3.5/pyflow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
                 from /usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from pyflow.cpp:564:
/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/Coarse2FineFlowWrapper.cpp -o build/temp.linux-x86_64-3.5/src/Coarse2FineFlowWrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/GaussianPyramid.cpp -o build/temp.linux-x86_64-3.5/src/GaussianPyramid.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/Image.h:9:0,
                 from src/GaussianPyramid.h:7,
                 from src/GaussianPyramid.cpp:4:
src/ImageProcessing.h: In instantiation of ‘static void ImageProcessing::vfiltering(const T1*, T2*, int, int, int, const double*, int) [with T1 = double; T2 = double]’:
src/Image.h:1331:96:   required from ‘void Image<T>::imfilter_hv(Image<T1>&, const double*, int, const double*, int) const [with T1 = double; T = double]’
src/Image.h:1199:47:   required from ‘void Image<T>::GaussianSmoothing(Image<T1>&, double, int) const [with T1 = double; T = double]’
src/GaussianPyramid.cpp:67:45:   required from here
src/ImageProcessing.h:344:14: warning: unused variable ‘offset’ [-Wunused-variable]
  int i,j,l,k,offset,ii;
              ^
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/OpticalFlow.cpp -o build/temp.linux-x86_64-3.5/src/OpticalFlow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
src/OpticalFlow.cpp: In static member function ‘static void OpticalFlow::SmoothFlowSOR(const DImage&, const DImage&, DImage&, DImage&, DImage&, double, int, int, int)’:
src/OpticalFlow.cpp:267:11: warning: unused variable ‘power_alpha’ [-Wunused-variable]
    double power_alpha = 0.5;
           ^
src/OpticalFlow.cpp:287:11: warning: unused variable ‘_a’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
           ^
src/OpticalFlow.cpp:287:24: warning: unused variable ‘_b’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
                        ^
src/OpticalFlow.cpp: In static member function ‘static void OpticalFlow::SmoothFlowPDE(const DImage&, const DImage&, DImage&, DImage&, DImage&, double, int, int, int)’:
src/OpticalFlow.cpp:545:11: warning: unused variable ‘power_alpha’ [-Wunused-variable]
    double power_alpha = 0.5;
           ^
src/OpticalFlow.cpp:565:11: warning: unused variable ‘_a’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
           ^
src/OpticalFlow.cpp:565:24: warning: unused variable ‘_b’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
                        ^
In file included from src/Image.h:9:0,
                 from src/OpticalFlow.h:6,
                 from src/OpticalFlow.cpp:4:
src/ImageProcessing.h: In instantiation of ‘static void ImageProcessing::vfiltering(const T1*, T2*, int, int, int, const double*, int) [with T1 = double; T2 = double]’:
src/Image.h:1331:96:   required from ‘void Image<T>::imfilter_hv(Image<T1>&, const double*, int, const double*, int) const [with T1 = double; T = double]’
src/OpticalFlow.cpp:52:42:   required from here
src/ImageProcessing.h:344:14: warning: unused variable ‘offset’ [-Wunused-variable]
  int i,j,l,k,offset,ii;
              ^
In file included from src/OpticalFlow.h:6:0,
                 from src/OpticalFlow.cpp:4:
src/Image.h: In instantiation of ‘void Image<T>::warpImageBicubicRef(const Image<T>&, Image<T>&, const Image<T1>&, const Image<T1>&, const Image<T1>&, const Image<T2>&, const Image<T2>&) const [with T1 = double; T2 = double; T = double]’:
src/Image.h:2482:55:   required from ‘void Image<T>::warpImageBicubicRef(const Image<T>&, Image<T>&, const Image<T1>&, const Image<T1>&) const [with T1 = double; T = double]’
src/OpticalFlow.cpp:437:43:   required from here
src/Image.h:2525:4: warning: variable ‘ImgMax’ set but not used [-Wunused-but-set-variable]
  T ImgMax;
    ^
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/Stochastic.cpp -o build/temp.linux-x86_64-3.5/src/Stochastic.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
g++ -pthread -shared -L/cs/software/anaconda3/lib -B /cs/software/anaconda3/compiler_compat -Wl,-rpath=/cs/software/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.5/pyflow.o build/temp.linux-x86_64-3.5/src/Coarse2FineFlowWrapper.o build/temp.linux-x86_64-3.5/src/GaussianPyramid.o build/temp.linux-x86_64-3.5/src/OpticalFlow.o build/temp.linux-x86_64-3.5/src/Stochastic.o -L/cs/software/anaconda3/lib -lpython3.5m -o /home/grad3/jalal/CS585/HW4/pyflow/pyflow.cpython-35m-x86_64-linux-gnu.so
/cs/software/anaconda3/compiler_compat/ld: cannot find -lm
/cs/software/anaconda3/compiler_compat/ld: cannot find -lpthread
/cs/software/anaconda3/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
[jalal@goku pyflow]$ uname -a
Linux goku.bu.edu 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[jalal@goku pyflow]$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.4.1708 (Core) 
Release:	7.4.1708
Codename:	Core


error C2146: syntax error: missing ')' before identifier 'a'

Hi, I'm trying to install the package according to the instructions and get the following:

C:\temp\pyflow>python setup.py build_ext -i
Compiling pyflow.pyx because it changed.
[1/1] Cythonizing pyflow.pyx
running build_ext
building 'pyflow' extension
creating build
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Anaconda3\lib\site-packages\numpy\core\include" "-IC:\Program Files\Anaconda3\lib\site-packages\numpy\core\include" "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /EHsc /Tppyflow.cpp /Fobuild\temp.win-amd64-3.5\Release\pyflow.obj
pyflow.cpp
c:\program files\anaconda3\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pyflow.cpp(1594): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
pyflow.cpp(1603): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
pyflow.cpp(1612): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Anaconda3\lib\site-packages\numpy\core\include" "-IC:\Program Files\Anaconda3\lib\site-packages\numpy\core\include" "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /EHsc /Tpsrc\Coarse2FineFlowWrapper.cpp /Fobuild\temp.win-amd64-3.5\Release\src\Coarse2FineFlowWrapper.obj
Coarse2FineFlowWrapper.cpp
c:\temp\pyflow\src\project.h(41): error C2146: syntax error: missing ')' before identifier 'a'
c:\temp\pyflow\src\project.h(41): error C2365: 'T1': redefinition; previous definition was 'template parameter'
c:\temp\pyflow\src\project.h(40): note: see declaration of 'T1'
c:\temp\pyflow\src\project.h(41): error C2061: syntax error: identifier 'a'
c:\temp\pyflow\src\project.h(41): error C2059: syntax error: ')'
c:\temp\pyflow\src\project.h(41): error C2146: syntax error: missing ')' before identifier 'b'
c:\temp\pyflow\src\project.h(41): error C2146: syntax error: missing ';' before identifier 'b'
c:\temp\pyflow\src\project.h(47): error C2146: syntax error: missing ')' before identifier 'b'
c:\temp\pyflow\src\project.h(47): error C2146: syntax error: missing ';' before identifier 'b'
c:\temp\pyflow\src\project.h(47): error C2059: syntax error: ')'
c:\temp\pyflow\src\project.h(48): error C2143: syntax error: missing ';' before '{'
c:\temp\pyflow\src\project.h(48): error C2447: '{': missing function header (old-style formal list?)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\vcruntime_typeinfo.h(108): error C2989: 'type_info': class template has already been declared as a non-class template
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\eh.h(49): note: see declaration of 'type_info'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

macOS Failure to run setup.py

Similar to others I am having issues running setup.py on Mac

Below is my error log.

Compiling pyflow.pyx because it changed. [1/1] Cythonizing pyflow.pyx /usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/brettfazio/Documents/School/CAP5415/pyflow/pyflow.pyx tree = Parsing.p_module(s, pxd, full_module_name) running build_ext building 'pyflow' extension creating build creating build/temp.macosx-10.15-x86_64-3.7 creating build/temp.macosx-10.15-x86_64-3.7/src clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/lib/python3.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c pyflow.cpp -o build/temp.macosx-10.15-x86_64-3.7/pyflow.o In file included from pyflow.cpp:649: In file included from /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4: In file included from /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12: In file included from /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832: /usr/local/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings] #warning "Using deprecated NumPy API, disable it with " \ ^ 1 warning generated. clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/lib/python3.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/Stochastic.cpp -o build/temp.macosx-10.15-x86_64-3.7/src/Stochastic.o clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/lib/python3.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/GaussianPyramid.cpp -o build/temp.macosx-10.15-x86_64-3.7/src/GaussianPyramid.o In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: In file included from src/Image.h:9: src/ImageProcessing.h:154:20: warning: unused variable 'l' [-Wunused-variable] int xx,yy,m,n,u,v,l,offset; ^ src/ImageProcessing.h:344:14: warning: unused variable 'offset' [-Wunused-variable] int i,j,l,k,offset,ii; ^ src/ImageProcessing.h:415:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete] delete pBuffer; ^ [] src/ImageProcessing.h:395:18: note: allocated with 'new[]' here double* pBuffer=new double[nChannels]; ^ src/ImageProcessing.h:425:28: warning: unused variable 'offset' [-Wunused-variable] int i,j,u,v,k,ii,jj,wsize,offset; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: In file included from src/Image.h:14: src/Stochastic.h:157:10: error: reference to '__max' is ambiguous result=__max(result,pData[i]); ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: In file included from src/Image.h:14: src/Stochastic.h:405:7: error: reference to '__max' is ambiguous u=__max(__min(u,NumPoints-1),0); ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:62:8: error: reference to '__max' is ambiguous Max=__max(Max,pData[i]); ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:1339:16: error: reference to '__max' is ambiguous int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2; ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:1339:16: error: type name requires a specifier or qualifier int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2; ^ src/Image.h:1339:16: error: expected ')' src/Image.h:1339:15: note: to match this '(' int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2; ^ src/Image.h:1340:16: error: reference to '__max' is ambiguous int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2; ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:1340:16: error: type name requires a specifier or qualifier int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2; ^ src/Image.h:1340:16: error: expected ')' src/Image.h:1340:15: note: to match this '(' int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2; ^ src/Image.h:1351:6: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign] i = i; ~ ^ ~ src/Image.h:1428:16: error: reference to '__max' is ambiguous int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2; ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:1428:16: error: type name requires a specifier or qualifier int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2; ^ src/Image.h:1428:16: error: expected ')' src/Image.h:1428:15: note: to match this '(' int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2; ^ src/Image.h:1429:16: error: reference to '__max' is ambiguous int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2; ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:1429:16: error: type name requires a specifier or qualifier int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2; ^ src/Image.h:1429:16: error: expected ')' src/Image.h:1429:15: note: to match this '(' int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2; ^ src/Image.h:1495:16: error: reference to '__max' is ambiguous data[i] = __max(data[i],pData[of... ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:1613:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] for(int k=0;k<firstNChannels;k++) ~^~~~~~~~~~~~~~~ src/Image.h:1933:20: error: reference to '__max' is ambiguous pData[i] = __min(__max(pData[i],0),ImgMax); ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:2288:15: error: reference to '__max' is ambiguous x0 = __min(__max(x0,0),imWidth-1); ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ In file included from src/GaussianPyramid.cpp:4: In file included from src/GaussianPyramid.h:7: src/Image.h:2289:15: error: reference to '__max' is ambiguous x1 = __min(__max(x1,0),imWidth-1); ^ src/project.h:47:4: note: candidate found by name lookup is '__max' T1 __max(T1 a, T2 b) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:163:32: note: candidate found by name lookup is 'std::__max' enum align_val_t { __zero = 0, __max = (size_t)-1 }; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 6 warnings and 20 errors generated. error: command 'clang' failed with exit status 1

Setup.py errors on OS X Catalina

I get the following errors when trying to run python setup.py build_ext -i
python 3.7.4

In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
In file included from src/Image.h:9:
src/ImageProcessing.h:154:20: warning: unused variable 'l' [-Wunused-variable]
        int xx,yy,m,n,u,v,l,offset;
                          ^
src/ImageProcessing.h:344:14: warning: unused variable 'offset' [-Wunused-variable]
        int i,j,l,k,offset,ii;
                    ^
src/ImageProcessing.h:415:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?
      [-Wmismatched-new-delete]
        delete pBuffer;
        ^
              []
src/ImageProcessing.h:395:18: note: allocated with 'new[]' here
        double* pBuffer=new double[nChannels];
                        ^
src/ImageProcessing.h:425:28: warning: unused variable 'offset' [-Wunused-variable]
        int i,j,u,v,k,ii,jj,wsize,offset;
                                  ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
In file included from src/Image.h:14:
src/Stochastic.h:157:10: error: reference to '__max' is ambiguous
                result=__max(result,pData[i]);
                       ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
In file included from src/Image.h:14:
src/Stochastic.h:405:7: error: reference to '__max' is ambiguous
                                u=__max(__min(u,NumPoints-1),0);
                                  ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:62:8: error: reference to '__max' is ambiguous
                        Max=__max(Max,pData[i]);
                            ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1339:16: error: reference to '__max' is ambiguous
        int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
                      ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1339:16: error: type name requires a specifier or qualifier
        int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
                      ^
src/Image.h:1339:16: error: expected ')'
src/Image.h:1339:15: note: to match this '('
        int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
                     ^
src/Image.h:1340:16: error: reference to '__max' is ambiguous
        int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
                      ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1340:16: error: type name requires a specifier or qualifier
        int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
                      ^
src/Image.h:1340:16: error: expected ')'
src/Image.h:1340:15: note: to match this '('
        int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
                     ^
src/Image.h:1351:6: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                        i = i;
                        ~ ^ ~
src/Image.h:1428:16: error: reference to '__max' is ambiguous
        int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
                      ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1428:16: error: type name requires a specifier or qualifier
        int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
                      ^
src/Image.h:1428:16: error: expected ')'
src/Image.h:1428:15: note: to match this '('
        int hfsize = (__max(hfilter.width(),hfilter.height())-1)/2;
                     ^
src/Image.h:1429:16: error: reference to '__max' is ambiguous
        int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
                      ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1429:16: error: type name requires a specifier or qualifier
        int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
                      ^
src/Image.h:1429:16: error: expected ')'
src/Image.h:1429:15: note: to match this '('
        int vfsize = (__max(vfilter.width(),vfilter.height())-1)/2;
                     ^
src/Image.h:1495:16: error: reference to '__max' is ambiguous
                                        data[i] = __max(data[i],pData[offset+j]);
                                                  ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:1613:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
                        for(int k=0;k<firstNChannels;k++)
                                    ~^~~~~~~~~~~~~~~
src/Image.h:1933:20: error: reference to '__max' is ambiguous
                pData[i] = __min(__max(pData[i],0),ImgMax);
                                 ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:2288:15: error: reference to '__max' is ambiguous
                        x0 = __min(__max(x0,0),imWidth-1);
                                   ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
In file included from src/GaussianPyramid.cpp:4:
In file included from src/GaussianPyramid.h:7:
src/Image.h:2289:15: error: reference to '__max' is ambiguous
                        x1 = __min(__max(x1,0),imWidth-1);
                                   ^
src/project.h:47:4: note: candidate found by name lookup is '__max'
T1 __max(T1 a, T2 b)
   ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:158:32: note: candidate found by name lookup is 'std::__max'
enum align_val_t { __zero = 0, __max = (size_t)-1 };
                               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
error: command 'clang' failed with exit status 1

How to optmize the parameters for better results

Hi there,

I modified the demo code to feed a video and extract the flow between 2 consecutive frames. while the first result seems to be good, starting the next one, the result looks a bit weird. I am posting two pictures to show that. the original video is a dog walking around inside a room (camera top-down view). I turned the np result to a picture to view the process and as I said, except the first one, the rest does not look right: (I resized the frames to make it go faster, but original size gives the same results)

flow1

flow2

I can only think that it might be caused by the parameters set at the beginning. Or is it something else ? please let me know if you know how to get accurate optical flow.

Thank you !!

Pyflow fails to build on MacOS Big Sur 11.0.1

Pyflow fails to build. I am using python 3.9.0. This is the error I get:

Compiling pyflow.pyx because it changed. [1/1] Cythonizing pyflow.pyx /usr/local/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/thijsheijden/Developer/python/iSeeBetter/pyflow/pyflow.pyx tree = Parsing.p_module(s, pxd, full_module_name) running build_ext building 'pyflow' extension creating build creating build/temp.macosx-11-x86_64-3.9 creating build/temp.macosx-11-x86_64-3.9/src clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/usr/local/lib/python3.9/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pyflow.cpp -o build/temp.macosx-11-x86_64-3.9/pyflow.o Traceback (most recent call last): File "/Users/thijsheijden/Developer/python/iSeeBetter/pyflow/setup.py", line 17, in <module> setup( File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 529, in build_extension objects = self.compiler.compile(sources, File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/ccompiler.py", line 574, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/unixccompiler.py", line 117, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/ccompiler.py", line 910, in spawn spawn(cmd, dry_run=self.dry_run) File "/usr/local/Cellar/[email protected]/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/spawn.py", line 66, in spawn if _cfg_target_split > [int(x) for x in cur_target.split('.')]: AttributeError: 'int' object has no attribute 'split'

So it comes down to the error:
AttributeError: 'int' object has no attribute 'split'

how to install pyflow into root lib?

Hello,
I have 2 questions:

1, How to install pyflow into root, so we can directly use it?
2, I assume that we calculate the optical flow using current frame and previous frame, I want to make sure that and I want to make sure that 2 input image into the function are in right order.
For example the image in demo.py, car1 will be the frame in time step 1, car2 will be the frame in time step 2?

thanks in advance.

3rd party module

I wish to use this as a 3rd party module in my application. I have compiled the code in a directory called pyflow in my application.
How can I use this as a 3rd party module and call pyflow.coarse2fine_flow(....) from my application?

Any suggestions are helpful

pyflow install

Compiling pyflow.pyx because it changed.
[1/1] Cythonizing pyflow.pyx
/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/hai/tianchi/pyflow-master/pyflow.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'pyflow' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -B /home/hai/anaconda3/envs/tianchi/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/include/python3.7m -c pyflow.cpp -o build/temp.linux-x86_64-3.7/pyflow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
from /home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyflow.cpp:632:
/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with "
^
gcc -pthread -B /home/hai/anaconda3/envs/tianchi/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/include/python3.7m -c src/Coarse2FineFlowWrapper.cpp -o build/temp.linux-x86_64-3.7/src/Coarse2FineFlowWrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from src/Image.h:9:0,
from src/Coarse2FineFlowWrapper.cpp:8:
src/ImageProcessing.h: In static member function ‘static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int, int, int)’:
src/ImageProcessing.h:230:60: warning: ‘memset’ used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
gcc -pthread -B /home/hai/anaconda3/envs/tianchi/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/include/python3.7m -c src/Stochastic.cpp -o build/temp.linux-x86_64-3.7/src/Stochastic.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/hai/anaconda3/envs/tianchi/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/include/python3.7m -c src/OpticalFlow.cpp -o build/temp.linux-x86_64-3.7/src/OpticalFlow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from src/Image.h:9:0,
from src/OpticalFlow.h:6,
from src/OpticalFlow.cpp:4:
src/ImageProcessing.h: In static member function ‘static void ImageProcessing::ResizeImage(const T1, T2*, int, int, int, int, int)’:
src/ImageProcessing.h:230:60: warning: ‘memset’ used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
src/OpticalFlow.cpp: In static member function ‘static void OpticalFlow::SmoothFlowSOR(const DImage&, const DImage&, DImage&, DImage&, DImage&, double, int, int, int)’:
src/OpticalFlow.cpp:267:11: warning: unused variable ‘power_alpha’ [-Wunused-variable]
double power_alpha = 0.5;
^
src/OpticalFlow.cpp:287:11: warning: unused variable ‘_a’ [-Wunused-variable]
double _a = 10000, _b = 0.1;
^
src/OpticalFlow.cpp:287:24: warning: unused variable ‘_b’ [-Wunused-variable]
double _a = 10000, _b = 0.1;
^
src/OpticalFlow.cpp: In static member function ‘static void OpticalFlow::SmoothFlowPDE(const DImage&, const DImage&, DImage&, DImage&, DImage&, double, int, int, int)’:
src/OpticalFlow.cpp:545:11: warning: unused variable ‘power_alpha’ [-Wunused-variable]
double power_alpha = 0.5;
^
src/OpticalFlow.cpp:565:11: warning: unused variable ‘_a’ [-Wunused-variable]
double _a = 10000, _b = 0.1;
^
src/OpticalFlow.cpp:565:24: warning: unused variable ‘_b’ [-Wunused-variable]
double _a = 10000, _b = 0.1;
^
In file included from src/Image.h:9:0,
from src/OpticalFlow.h:6,
from src/OpticalFlow.cpp:4:
src/ImageProcessing.h: In instantiation of ‘static void ImageProcessing::vfiltering(const T1, T2*, int, int, int, const double*, int) [with T1 = double; T2 = double]’:
src/Image.h:1331:96: required from ‘void Image::imfilter_hv(Image&, const double*, int, const double*, int) const [with T1 = double; T = double]’
src/OpticalFlow.cpp:52:42: required from here
src/ImageProcessing.h:344:14: warning: unused variable ‘offset’ [-Wunused-variable]
int i,j,l,k,offset,ii;
^
In file included from src/OpticalFlow.h:6:0,
from src/OpticalFlow.cpp:4:
src/Image.h: In instantiation of ‘void Image::warpImageBicubicRef(const Image&, Image&, const Image&, const Image&, const Image&, const Image&, const Image&) const [with T1 = double; T2 = double; T = double]’:
src/Image.h:2482:55: required from ‘void Image::warpImageBicubicRef(const Image&, Image&, const Image&, const Image&) const [with T1 = double; T = double]’
src/OpticalFlow.cpp:437:43: required from here
src/Image.h:2525:4: warning: variable ‘ImgMax’ set but not used [-Wunused-but-set-variable]
T ImgMax;
^
In file included from /usr/include/string.h:635:0,
from /usr/include/memory.h:29,
from src/Image.h:8,
from src/OpticalFlow.h:6,
from src/OpticalFlow.cpp:4:
In function ‘void* memset(void*, int, size_t)’,
inlined from ‘static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int, int, int) [with T1 = double; T2 = double]’ at src/ImageProcessing.h:230:2:
/usr/include/x86_64-linux-gnu/bits/string3.h:86:32: warning: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters
__warn_memset_zero_len ();
^
gcc -pthread -B /home/hai/anaconda3/envs/tianchi/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/lib/python3.7/site-packages/numpy/core/include -I/home/hai/anaconda3/envs/tianchi/include/python3.7m -c src/GaussianPyramid.cpp -o build/temp.linux-x86_64-3.7/src/GaussianPyramid.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from src/Image.h:9:0,
from src/GaussianPyramid.h:7,
from src/GaussianPyramid.cpp:4:
src/ImageProcessing.h: In static member function ‘static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int, int, int)’:
src/ImageProcessing.h:230:60: warning: ‘memset’ used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
memset(pDstImage,sizeof(T2)DstWidthDstHeightnChannels,0);
^
src/ImageProcessing.h: In instantiation of ‘static void ImageProcessing::vfiltering(const T1, T2*, int, int, int, const double*, int) [with T1 = double; T2 = double]’:
src/Image.h:1331:96: required from ‘void Image::imfilter_hv(Image&, const double*, int, const double*, int) const [with T1 = double; T = double]’
src/Image.h:1199:47: required from ‘void Image::GaussianSmoothing(Image&, double, int) const [with T1 = double; T = double]’
src/GaussianPyramid.cpp:67:45: required from here
src/ImageProcessing.h:344:14: warning: unused variable ‘offset’ [-Wunused-variable]
int i,j,l,k,offset,ii;
^
g++ -pthread -shared -B /home/hai/anaconda3/envs/tianchi/compiler_compat -L/home/hai/anaconda3/envs/tianchi/lib -Wl,-rpath=/home/hai/anaconda3/envs/tianchi/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/pyflow.o build/temp.linux-x86_64-3.7/src/Coarse2FineFlowWrapper.o build/temp.linux-x86_64-3.7/src/Stochastic.o build/temp.linux-x86_64-3.7/src/OpticalFlow.o build/temp.linux-x86_64-3.7/src/GaussianPyramid.o -o /home/hai/tianchi/pyflow-master/pyflow.cpython-37m-x86_64-linux-gnu.so

Python setup.py build_ext -i is running successfully?

Argument error

I tried using your module with the following code:

alpha = 0.012
ratio = 0.75
minWidth = 20
nOuterFPIterations = 7
nInnerFPIterations = 1
nSORIterations = 30
colType = 0  # 0 or default:RGB, 1:GRAY (but pass gray image with shape (h,w,1))

im1 = im2 = cv2.imread('data/baloo.jpeg')
u, v, im2W = pyflow.coarse2fine_flow(
    im1, im2, alpha, ratio, minWidth, nOuterFPIterations, nInnerFPIterations,
    nSORIterations, colType)

Which is pretty much copied from the demo other than im1 and im2.

But I got this error:
ValueError: Buffer dtype mismatch, expected 'double' but got 'unsigned char'

What can I do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.