Comments (4)
Great, thanks for the input! I just pushed an updated version and uploaded it to PyPI that is able to do what you are referring to.
It turned out that there was still a problem with interleaved formats and the YUVFrame
container, I fixed that. Solving your problem then was quite straightforward by allowing to read and write not only to/from file objects but arbitrary io
streams. By wrapping the in-memory data with io.BytesIO
, de-interleaving can be performed using imread
.
import io
import yuvio
rawdata = [...] # np.ndarray
f = yuvio.imread(io.BytesIO(rawdata), width, height, format="uyvy422")
f.y # returns just the Y plane
The only additional information that is required is the resolution of the Y plane (width
, height
).
from yuvio.
Great to hear that the library can be useful to others as well.
Do I understand correctly that you'd like the functionality to
- separate the individual yuv planes from an interleaved format
- perform automatic chroma channel sub-/upsampling depending on the source and target subsampling format?
The first functionality is something that I've thought about as well for a while. Hearing that it might be useful for more people than just me could make it worth implementing. I'll give it a go.
The second functionality is something I haven't thought about yet, but definitely sounds useful. Would you like to have a "security" argument like chroma_resampling_ok
that is False
by default to prevent accidental resampling?
from yuvio.
Yes, the first functionality is what I was referring to.
To give you a bit more background: we are getting pixels in packed/interleaved format and need just the Y plane to do some calculations. Originally I thought I could use PyAV' grey
conversion, which it does through FFmpeg, but I believe it does a weighting of the Y/U/V components. So this is not working either. My fallback was to use frame.planes[0]
, but this does not work for packed formats like UYVY.
Since our use case is just handling UYVY as the (probably) second most common non-YUV format, resampling hadn't occurred to me. So, automatic sub-/upsampling is a bit more challening, and having just the former would be nice, like:
rawdata = […] # np.ndarray
f = yuvio.frame(rawdata, format = "uyvy422")
f.y # returns just the Y plane
from yuvio.
That's great, thank you! I will try to implement this over the coming days.
from yuvio.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yuvio.