GithubHelp home page GithubHelp logo

Comments (7)

mdedonno1337 avatar mdedonno1337 commented on August 15, 2024

Hi,
First, you have to compile the Cython module (needed for the image transformation).
You will have to create the TPS parameters with the TPS_generate() function.
Then, you can use the TPS_image() function.
See the functions docs in the https://github.com/mdedonno1337/TPS/blob/master/TPS/__init__.py module

from tps.

5wimming avatar 5wimming commented on August 15, 2024

thank you very much.
a whole night,I tried my best to make build,but failed...
So i use second method:gcc.exe -I -I -c TPSCy.c -o build/tpscy.o -O3 -mdll -fopenmp -fdce -ffast-math
I get them:a file named "tpscy.o" and a folder named “temp.win-amd64-3.5” in “./build”.
Then,i test a demo,but i get a error:

`Python

NotImplementedError Traceback (most recent call last)
F:\rym\image_quality_assessment\code\python\tps.py in ()
36
37 path0='./data/2.tif'
---> 38 img=TPS_image(g=g,infile=path0)
39 img.show()
40 plt.imshow(img)

F:\rym\image_quality_assessment\code\python\TPS_init_.py in TPS_image(**kwargs)
413 if TPSModule.lang() == "Python":
414 print(TPSModule.lang())
--> 415 raise NotImplementedError
416
417 else:
NotImplementedError: `

can you tell me why?
Thanks again

from tps.

mdedonno1337 avatar mdedonno1337 commented on August 15, 2024

Based upon the line 414/415, the Cython module is not loaded.

Here you have a screenshot of the folder structure after the compilation:
image

The TPSCy.pyd is the output of the compilation on a Windows machine.
You might also have to add some .dll (if not accessible via the path).

I should mention that the compilation is done on a Windows 10 machine, with MinGW installed.

Note : The compilation and use on a Linux machine is way easier than on a Windows machine

from tps.

5wimming avatar 5wimming commented on August 15, 2024

According to your advice,i put all.dll(you list above) to my TPSCy folder. there are problems:

PS F:\rym\image_quality_assessment\code\python\TPS\TPSCy> mingw32-make build
process_begin: CreateProcess(NULL, uname, ...) failed.
rm TPSCy.c
process_begin: CreateProcess(NULL, rm TPSCy.c, ...) failed.
make (e=2):
Makefile:42: recipe for target 'cleanc' failed
mingw32-make: [cleanc] Error 2 (ignored)
cython -V -v TPSCy.pyx
Cython version 0.28.3
Compiling F:\rym\image_quality_assessment\code\python\TPS\TPSCy\TPSCy.pyx
rm TPSCy.pyd
process_begin: CreateProcess(NULL, rm TPSCy.pyd, ...) failed.
make (e=2):
Makefile:45: recipe for target 'cleanpyd' failed
mingw32-make: [cleanpyd] Error 2 (ignored)
python setup.py build_ext --inplace --compiler=mingw32
running build_ext
skipping 'TPSCy.c' Cython extension (up-to-date)
building 'TPSCy' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include -IC:\Users\user\AppData\Local\Programs\Python\Python35\include -IC:\Users\user\AppData\Local\Programs\Python\Python35\include -c TPSCy.c -o build\temp.win-amd64-3.5\Release\tpscy.o -O3 -fopenmp -fdce -ffast-math -Wfatal-errors -w
In file included from C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1809:0,
                 from C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
                 from C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
                 from TPSCy.c:567:
C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:12:9: note: #pragma message: C:\Users\user\AppData\Local\Programs\Python\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
 #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \
         ^~~~~~~
writing build\temp.win-amd64-3.5\Release\TPSCy.cp35-win_amd64.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.5\Release\tpscy.o build\temp.win-amd64-3.5\Release\TPSCy.cp35-win_amd64.def -LC:\Users\user\AppData\Local\Programs\Python\Python35\libs -LC:\Users\user\AppData\Local\Programs\Python\Python35\PCbuild\amd64 -lm -lgomp -lpthread -lpython35 -lvcruntime140 -o F:\rym\image_quality_assessment\code\python\TPS\TPSCy\TPSCy.cp35-win_amd64.pyd
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
C:\Users\user\AppData\Local\Programs\Python\Python35\libs/libpython35.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
Makefile:30: recipe for target 'pyd' failed
mingw32-make: *** [pyd] Error 1

Maybe my use posture is wrong.
Thank you for your guidance.
It’s time to change the system. -_-|||

from tps.

mdedonno1337 avatar mdedonno1337 commented on August 15, 2024

I dont know if this is the problem, but I'am working on Python 2.7.14 for the moment.

The pthread is maybe not installed (cannot find -lpthread).
Check in the "MingGW Installation Manager" that you have the "mingw32-pthreads-w32". Need to check for other missing dependencies later on.

Edit:
Here is my compilation output:

rm TPSCy.c
cython -V -v TPSCy.pyx
Cython version 0.28.3
Compiling D:\Library\TPS\src\TPS\TPSCy\TPSCy.pyx
rm TPSCy.pyd
python setup.py build_ext --inplace --compiler=mingw32
running build_ext
skipping 'TPSCy.c' Cython extension (up-to-date)
building 'TPSCy' extension
c:\MinGW\bin\gcc.exe -mdll -O -Wall -Ic:\Python27\lib\site-packages\numpy\core\include -Ic:\Python27\include -Ic:\Python27\PC -c TPSCy.c -o build\temp.win32-2.7\Release\tpscy.o -O3 -fopenmp -fdce -ffast-math -Wfatal-errors -w
In file included from c:\Python27\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1816:0,
                 from c:\Python27\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
                 from c:\Python27\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
                 from TPSCy.c:567:
c:\Python27\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:12:9: note: #pragma message: c:\Python27\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
 #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \
         ^
writing build\temp.win32-2.7\Release\TPSCy.def
c:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\tpscy.o build\temp.win32-2.7\Release\TPSCy.def -Lc:\Python27\libs -Lc:\Python27\PCbuild -Lc:\Python27\PC\VS9.0 -lm -lgomp -lpthread -lpython27 -lmsvcr90 -o D:\Library\TPS\src\TPS\TPSCy\TPSCy.pyd

from tps.

5wimming avatar 5wimming commented on August 15, 2024

thank you
so cool, "mingw32-pthreads-w32"can solve that problem
but i meet a new:

PS F:\rym\image_quality_assessment\code\python\TPS\TPSCy> mingw32-make build
process_begin: CreateProcess(NULL, uname, ...) failed.
rm TPSCy.c
process_begin: CreateProcess(NULL, rm TPSCy.c, ...) failed.
make (e=2):
Makefile:42: recipe for target 'cleanc' failed
mingw32-make: [cleanc] Error 2 (ignored)
cython -V -v TPSCy.pyx
Cython version 0.28.3
Compiling F:\rym\image_quality_assessment\code\python\TPS\TPSCy\TPSCy.pyx
rm TPSCy.pyd
process_begin: CreateProcess(NULL, rm TPSCy.pyd, ...) failed.
make (e=2):
Makefile:45: recipe for target 'cleanpyd' failed
mingw32-make: [cleanpyd] Error 2 (ignored)
python setup.py build_ext --inplace --compiler=mingw32
running build_ext
skipping 'TPSCy.c' Cython extension (up-to-date)
building 'TPSCy' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include -IC:\Users\user\AppData\Local\Programs\Python\Python35\include -IC:\Users\user\AppData\Local\Programs\Python\Python35\include -c TPSCy.c -o build\temp.win-amd64-3.5\Release\tpscy.o -O3 -fopenmp -fdce -ffast-math -Wfatal-errors -w
In file included from C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1809:0,
                 from C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18,
                 from C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
                 from TPSCy.c:567:
C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:12:9: note: #pragma message: C:\Users\user\AppData\Local\Programs\Python\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
 #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \
         ^~~~~~~
writing build\temp.win-amd64-3.5\Release\TPSCy.cp35-win_amd64.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.5\Release\tpscy.o build\temp.win-amd64-3.5\Release\TPSCy.cp35-win_amd64.def -LC:\Users\user\AppData\Local\Programs\Python\Python35\libs -LC:\Users\user\AppData\Local\Programs\Python\Python35\PCbuild\amd64 -lm -lgomp -lpthread -lpython35 -lvcruntime140 -o F:\rym\image_quality_assessment\code\python\TPS\TPSCy\TPSCy.cp35-win_amd64.pyd
C:\Users\user\AppData\Local\Programs\Python\Python35\libs/libpython35.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
Makefile:30: recipe for target 'pyd' failed
mingw32-make: *** [pyd] Error 1

Maybe it can be solved by this method link?

from tps.

mdedonno1337 avatar mdedonno1337 commented on August 15, 2024

The format of the "libpython35" file seems not to be recognized. Try the link solution, and/or try with python 2.7 32bit.
I dont have support for Windows Python3 for the moment because my production runs on Linux, and the dev machine is running on Windows Python 2.7.14 32bit.

from tps.

Related Issues (1)

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.