CImg Python 3 bindings or something at least comparable? - python

i'm searching a Python lib with good image processing functionalities .
I was searching for CImg (which i've already used on C++ projects) bindings, but i wasn't lucky.
I found PIL, but it lacks a lot of features that CImg has so, is there any good alternative ?
Thanks
UPDATE
PIL is good, but i need Python 3 support on a Mac OS X system.

I would suggest you to enumerate the functionality that you find desirable which is there in Cimg and not in PIL.
Discussion on SO
Image Processing, In Python?
pypi also throws up a lot of modules on image processing. Try seeing, if some of them is suitable for you.
http://pypi.python.org/pypi?:action=search&term=image+processing&submit=search

Related

Python - 3D Medical Image Registration Libraries

What are some libraries in Python that have the ability to read CT model files with extensions such as .vtk or .stl and perform 3D image registration with normal videos. I have found many softwares that have this ability but what I am looking for is not a program but a Python library such as Numpy or OpenCV, where all I need to do is import numpy or import cv2.
Made up example of what I want to do
Step 1 - Get the 3D CT model of a person's skull
Step 2 - Read the 3D CT model into Python
Step 3 - Get a normal video of a person standing still
Step 4 - Perform registration of the 3D CT skull and
person's head from the normal video
Step 5 - Display the registration output
I have found a couple of Python libraries that "seem" to do this sort of thing but they do not have enough information in the library description to be sure that this is what I want. I am also open to using multiple libraries. Is there anyone who has done something similar to this and it would be great if someone with experience with any libraries could give me some recommendations, thanks. If there aren't any, I will also consider libraries in other languages.
What I have considered so far
FW4SPL Libarary in C++
MITK Library in C++
MeVisLab Software in Python
Elastix Library in C++
SimpleElastix Library in Python
ITK Library in C++
SimpleITK Library in Python
For FW4SPL and MITK, I have been unable to successfully compile the source code due to new errors continuously occurring after debugging old errors. It seems that the occurrence of new errors will not stop occurring (I have spent a lot of time doing this and do not wish to continue anymore).
For MeVisLab, this is not a Python library such as numpy or opencv but it is a GUI which is also said to be programmable.
For Elastix, SimpleElastix, ITK and SimpleITK, they are indeed C++ and Python libraries which seem perfect but I am not sure if they provide the requirements of my application described above. Also, I am very confused about the relationship to one another.
I am playing with vtk and stl files for the first time. Your question drove me curious but I am clearly not experienced. I started looking into this before the above comment. I did not realize we were off-topic, sorry. So I give you my conclusions at this point, since there were built for sharing.
1) for .vtk files
It turns out that most of the library I saw are for python 2.7 while I prefer the up to date version (3.5 for now).
For 3.5 I finally adopted the version of ‘woodscn’ that seems promising, for coding it seems to me all the required info is on Reading a .vtk file with python
2) for .stl files
the ‘nestly’ package from 'conda-forge’ looks good, with a typical example on https://github.com/fhcrc/nestly/blob/master/examples/basic_nest/make_nest.py
then you just have to write import vtk and import nestly in the python script.
hope this helps

Fastest way to resize image

As in the title, which is the fastest way to resize an image? I'm using Python + OpenCV 2.11 (not openCV3), and it seems cv2.resize() is very slow.
We can use CUDA with OpenCV3 (http://www.coldvision.io/2015/12/22/image-resize-with-opencv-and-cuda/), but is it supported in OpenCV 2?
OpenCV 2 has gpu module but unfortunately there's no bindings for Python.
CUDA programming comes with a pretty big warmup- and code complexity overhead itself.
There exists a SIMD fork of Pillow, which claims to have much better performance than ImageMagick or plain Pillow, but there are no comparisons to OpenCV. Maybe worth checking out how they compare.

Python image processing without external libraries

Im working of a project in python that is intended to be as modular and flexible as possible. The project must to be written in Python, and it involves some image processing (access to individual pixels and image size).
what would be the best way to manipulate an image in Python without the use of external libraries? I am trying to use as little dependancies as possible, so it will be easy to transfer to different platforms.
I would appreciate any other approaches that might work better.
Well I can understand your concern I myself had a similar problem when i did a project on image processing and i had to port it to nanoboard(FPGA) so using external libraries is much of a headache.
What i did was, first programmed the code using the libraries at hand and then looked up for their implementation. You can view the source code for functions in python and they could be used with a little modifications. Hope it helps. Reach me for any furthur queries.

PIL SANE interface: where can I find it?

Apparently PIL includes a SANE (Scanner Access Now Easy) interface - I'm looking at code right now that does
import sane
where sane is provided by PIL.
I've installed PIL under both OS X and Windows, but "import sane" doesn't work for me. I did a fair bit of googling to see if there's something extra I need to install but I'm not finding anything.
How do I get the SANE interface for PIL?
I'm happy with any SANE interface (doesn't have to be PIL), so if you know of an alternative that would help too.
Disclaimer: I never used SANE.
I don't think that sane is provided with the PIL library.
It seems, instead, that the package you're looking for is called pysane.

Python 2D image generation

What are some of the better libraries for image generation in Python? If I were to implement a GOTCHA (for example's sake), thereby having to manipulate an image on the pixel level, what would my options be? Ideally I would like to save resulting image as a low-resolution jpeg, but this is mere wishing, I'll settle for any common image format.
Thank you for your attention.
The Python Imaging Library (PIL) is the de facto image manipulation library on Python. You can find it here, or through easy_install or pip if you have them.
Edit: PIL has not been updated in a while, but it has been forked and maintained under the name pillow. Just install it this way in a shell:
pip install Pillow
The import statements are still the same as PIL (e.g., from PIL import image) and is backward compatible.
Pillow is a fork of PIL that is still actively developed. While PIL is not dead it has been a number of years since the last release.
If you should generate text or other vector based images (and then save to .png or .jpg), you could also consider Cairo (PyCairo, in this case). I use it a lot.
Otherwise, for pixel-level manipulation, PIL is the obvious choice.

Categories

Resources