-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
[question]: How to receive raw data(texture) instead of an DOM object from the pipeline? #54
Comments
A If you inspect the code of the Image Sink at src/core/pipeline/nodes/images/sink.js, you'll see that a texture is first rendered to a canvas, and then an |
Hi @alemart thank you for the answer. 🙂
Do you mean that it's needed to modify the source code? |
Yes. Instead of converting an |
|
@alemart thank you for the inputs i will try for sure! |
I'm testing a new sink in this PR webarkit/webarkit-testing#24 i will let you know how it goes. 🙂 |
So i created a new sink node, basically a copy of the original node but the run method return ImageData: run(gpu)
{
const { image, format } = /** @type {SpeedyPipelineMessageWithImage} */ ( this.input().read() );
return new SpeedyPromise(resolve => {
const canvas = gpu.renderToCanvas(image);
const ctx = canvas.getContext('2d');
ctx.drawImage(image.source, 0, 0);
ctx.getImageData(0, 0, image.width, image.height).data.then(data => {
//this._imageData = data;
this._bitmap = data;
this._format = format;
resolve();});
});
} but i got this error:
i suppose that because ImageData is not an ImageMedia type, so i think i have to make slightly changes directly inside speedy-vision. i would avoid this but i think i have no choice if i want his feature. P.E.: the new node is sink-image-data.js |
Are you trying to input an
hmmm, maybe you could just |
yes that's was the idea, but maybe require more works and more changes in the speedy-vision core. Instead i can try as you suggested. |
i have tried in the export() but i get again:
code in this commit. |
…emart#54 and PR's alemart#56 alemart#57 Signed-off-by: kalwalt <[email protected]>
…emart#54 and PR's alemart#56 alemart#57 Signed-off-by: kalwalt <[email protected]> Signed-off-by: Walter Perdan <[email protected]>
new class SpeedyImageDataMediaSource to handle ImageData see issue #54 and PR's #56 #57 (#58) Signed-off-by: kalwalt <[email protected]> Signed-off-by: Walter Perdan <[email protected]>
In my testing app, developed with OpenCV C++ and Emscripten, my input data are Uint8Array, I'm passing data from a video stream into a speedy-vision pipeline and then the output
ImageBitmap
is transformed in aImageData
by s simple convert routine:then i pass the ImageData.data in a worker when needed.
Looking in the speedy-vision code you can't get a Uint8Array from a speedy-media-source.
Does it possible to pass raw data as Uint8Array from the pipeline instead doing that conversion? Or there is an alternative approach? In this sense i could avoid this conversion.
The text was updated successfully, but these errors were encountered: