-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add native I/O support for numpy arrays as image types #28
Comments
OpenCV inspiration code for any type of pixel size to CImg: https://github.com/dtschump/CImg/blob/master/plugins/cvMat.h |
Per-pixel size is in ndarray.dtype
|
Work is in progress for |
Design notes: INPUTFor inputting of OUTPUT
|
Single item images |
as far as 2D RGB images are concerned, these POCs are ready but uncomitted yet:
The design is changing slightly: Those |
Work on the class method |
Working full time on this now |
libgmic 2.9.0 which was just released is targetted |
interleaving and dtype checking+conversion should not happen in any of the gmic.run() input/output images processing loop which is quite long already, but in the from_numpy() to_numpy() methods. |
There are a few unit tests already regarding numpy support, but I am lost in them. Here is a simple handmade test that shows OK support for the numpy ndarray output: (image.png is a lena sample picture)
let me see for simple numpy ndarray Gmic input hand testing... |
the testing scenario now works OK a bit further (except that dtype variety is not yet covered):
|
Progress on above empirical test by extending it thanks to to_numpy_array and from_numpy_array simplification and solidification. See below. Sold unit tests will be written. Will check boxes in the above message when those upcoming tests pass for each method.
|
Note that |
Updated TODO list in topmost message above |
|
…b ci: adding wheelhouse as artifact
…structor; cleaning numpy/ndarray occurences
will be finished in #59 // numpy support subpart |
Basically Gmic's
run()
method should accept 1 or severalnparray
for itsimages=
parameter.Numpy type official documentation page
We want as low-level optimization as possible, grabbing the numpy buffers arrays, and without any extra binary dependency.
Workflows yielding a
nparray
for an image are typicall from scikit-image and PIL/Pillow.De-interlacing and re-interlacing at the
gmic.run()'s
input and output are necessary.TODO list
- [ ]GmicImage(data=a_numpy_array """no dimensions info, they are inferred from the object's shape""") -> GmicImage
- [ ]GmicImage(ndarray)
unit testingGmicImage.to_numpy_array(self, astype=numpy.float32: numpy.dtype, interleave=True: bool) -> numpy.ndarray
GmicImage().to_numpy_array()
unit testingGmicImage.from_numpy_array(cls, obj: numpy.ndarray, deinterleave=True: bool) -> GmicImage()
GmicImage().from_numpy_array()
unit testing- [ ]gmic.run(images=List<numpy.ndarray>|List<GmicImage>) -> in place change of
images=List; same behaviour for gmic.Gmic(...) or gmic.Gmic(...).run(...)
- [ ]gmic.run()
(& gmic instance alternatives) unit testing- [ ] add complex numbers numpy array dtype support- [ ] unit test complex numbers support- [ ] potential memory leaks caregmic.__build__
stringThe text was updated successfully, but these errors were encountered: