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
ndarray from image ? #2
Comments
Sorry, I don't understand the question: you don't have to implement anything, if the array is one-, or two-dimensional. Do you want to have a three-dimensional array? |
Hi, the image array is one dimensional but in numpy, opencv etc.. it's typically loaded as a three-dimensional array (height, width, depth), the third dimension is the depth/channels (RGB), for example:
Is there a way to achieve this with ulab ? |
The short answer is no. The slightly longer one is it is not trivial at all. Third, you also have to read the image itself. I mean the imread function. That is not trivial either, given that somehow you have to fit the png library onto the microcontroller. But if you implement that, you could easily return a 3-tuple with three two-dimensional ndarrays, each holding the data for one colour channel. One more comment: as opposed to numpy, I tried to implement everything with minimal RAM overhead. That means that there are no auxiliary data holders. The downside of that is that tensor operations can't be scaled to arbitrary dimensions, you can't just say that a two-dimensional array is simply a bunch of one-dimensional arrays, and then you loop over them. That is not gonna work. |
We do have some image loading functions, not png specifically but other formats, and we may have SDRAM on board at some point. Anyway thanks for the answers, and for this great library. I think I got my answer so I'll close this issue now. |
I am re-opening the issue, because I am working on an upgrade for |
Awesome! Please let me know when it's ready and I'll help test it, thanks! |
Help with testing would be fantastic. I assign you to this issue, then. |
ulab.rst: Fix so it can be processed by sphinx in circuitpython
How can I create an ndarray of shape (w, h, c) from a C array of pixels (uint8_t) ? I can create 1D arrays by implementing getiter and unary_op, do I need to return an iter as the items of the first iter and so on ?
The text was updated successfully, but these errors were encountered: