labforcomputationalvision / pyrtools Goto Github PK
View Code? Open in Web Editor NEWimage pyramid code in python 3
Home Page: https://pyrtools.readthedocs.io/
License: MIT License
image pyramid code in python 3
Home Page: https://pyrtools.readthedocs.io/
License: MIT License
Is it possible to support custom pyramid coefficients as input to recon_pyr
? I believe this could apply to all the Pyramid modules except GaussianPyramid. My particular use case is implementing phase-based motion magnification, where the coefficients of the complex CSP are modified before reconstruction. This may be useful for other applications, as well.
I've been using a modified version of this repo with this feature, so I'd be happy to start a PR.
Copied from plenoptic, since this is a pyrtools issue.
Describe the bug
Failure to import on MacOSX Arm64, either installed via git clone ... ; pip install -e .
Log
import plenoptic as po
Traceback (most recent call last):
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3442, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-31aae8407192>", line 1, in <module>
import plenoptic as po
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/__init__.py", line 1, in <module>
from . import simulate as simul
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/__init__.py", line 1, in <module>
from .models import *
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/models/__init__.py", line 1, in <module>
from .frontend import *
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/models/frontend.py", line 20, in <module>
from .naive import Gaussian, CenterSurround
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/models/naive.py", line 8, in <module>
from plenoptic.tools.conv import same_padding
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/tools/__init__.py", line 1, in <module>
from .data import *
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/tools/data.py", line 8, in <module>
from pyrtools import synthetic_images
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/__init__.py", line 1, in <module>
from . import pyramids
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/__init__.py", line 1, in <module>
from .GaussianPyramid import GaussianPyramid
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/GaussianPyramid.py", line 3, in <module>
from .c.wrapper import corrDn
File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapper.py", line 17, in <module>
lib = ctypes.cdll.LoadLibrary(libpath[0])
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/Users/user/mambaforge/envs/XXX/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so, 0x0006): tried: '/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (no such file), '/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
System (please complete the following information):
OS: MacOS 13.2 Ventura (M1 Max chip)
Python 3.10 (Mambaforge)
Additional context
Can possibly be remedied using certain tricks, e.g. https://apple.stackexchange.com/questions/436801/m1-mac-mach-o-file-but-is-an-incompatible-architecture-have-x86-64-need-a
This issue seems to be primarily with pyrtools
After installing pyrtools in a new environment: python -c "import pyrtools as pt" 2> pyrtools.log
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/__init__.py", line 1, in <module>
from . import pyramids
File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/__init__.py", line 1, in <module>
from .GaussianPyramid import GaussianPyramid
File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/GaussianPyramid.py", line 3, in <module>
from .c.wrapper import corrDn
File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapper.py", line 17, in <module>
lib = ctypes.cdll.LoadLibrary(libpath[0])
File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so, 0x0006): tried: '/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (no such file), '/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
在Windows系统下调用pyrtools包,其中的wrapper.py文件中使用了lib
python版本为3.8 pyrtools版本为1.0.2
I'm trying to construct a steerable frequency pyramid of order 3 but with n orientations (usually around 16), but once I get the steer_coeffs()
output and modify it to my needs, I can't add it back to the pyramid to do the recon_pyr()
.
Is there a current method to solve this without having to overload the init function?
If not, some potential solutions could be:
recon_pyr()
accept coefficients as inputIf you can silence this warning it would be helpful. You just need to change np.float to float itself in line 52 of the pyramid.py file.
Log:
./pyrtools/pyramids/pyramid.py:52: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`.
To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe.
I'm trying to replicate the steerable pyramid notebook. The results were correct. However, it pt.imshow
always shows 2 sets of output images (shown below). Is there any way to solve this?
pip
)We're having an issue with wxPython from within virtual environments on OSX. You'll receive an error that looks something like the following:
This program needs access to the screen.
Please run with 'pythonw', not 'python', and only when you are logged
in on the main display of your Mac.
This is a known issue, and there are a couple workarounds:
for using python on the command-line, it seems sufficient to run conda install python.app
and then use the pythonw
command instead of python
(note that this assumes you're using conda
as the package manager)
however, even if you do the above, you'll run into the same error when you try to use showIm
(which is our only function that calls wxPython) from within a jupyter notebook. It looks like this is the solution. I believe this is similar to the solution I mentioned, which requires installing a separate jupyter kernel, only associated with your virtual environment.
Hopefully, none of this is an issue if you use your main conda environment for pyrtools.
how to add panoramic image to pt.pyramids.SteerablePyramidFreq()
I have Exception: All images must be able to be 'zoomed in' to the largest image.That is, the largest image must be a scalar multiple of all images.
I do resize image(12000x6000 to 3000x1000 for example) keeping proportions, but an error occurs the image must be the same height and width - for example 500x500
what to do ?
TODO animshow
At this place in the tutorial:
# look at all orientation bands at one level (scale):
imgList = []
for b in range(pyr.num_scales):
it should be num_orientations
instead of num_scale
(by chance, it happens to be the same here, since order=3 and height=4)
This is a very useful package, which allowed me to play with the steerable pyramids I heard about 25 years ago! That's a fantastic and underrated tool.
Hello,
I can not install the library with pip it gives me "failed with exit code 1120" error code.
Hello, thank you for the open-source package.
I used both pip
and git clone
methods as shown in your documentation, but I am unable to install pyrtools
.
When I run pip install pyrtools
, the error message reads:
----------------------------------------
ERROR: Failed building wheel for pyrtools
Running setup.py clean for pyrtools
Failed to build pyrtools
Installing collected packages: pyrtools
Running setup.py install for pyrtools ... error
When I try python setup.py -e .
after cd pyrtools git clone directory here
, the message reads:
python: can't open file 'setup.py': [Errno 2] No such file or directory
I've tried pip install --upgrade setuptools
with no success.
Could you please point me to the right direction?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.