Image processing with Virgil #242
Replies: 2 comments 9 replies
-
Hey, really nice work. I'm impressed you figured out how to do this with how little documentation there is here :-) Your approach mirrors some tinkering I did with the I love these kinds of demos and would happily accept (small) demos and improvements to documentation that make it easier to get started and do what you've done here. One improvement I didn't do in the
You can then define an object that wraps up the
|
Beta Was this translation helpful? Give feedback.
-
Hi Ben i looked a lot at your Mandelbrot example that was useful to get the Pointer but the problem for me was to solve how to fill the data as an argument. I had read that in the Pointer documentation exist the My idea is also to use About the documentation: You can find a resource in the test folder, i discovered this fact after writing my code, it's a bit hard but you can find some interesting snippets of code. In the end i'm very impressed how you developed Virgil, i hope you continue on this road... |
Beta Was this translation helpful? Give feedback.
-
I'm playing with Virgil and image processing and i have created a simple repository vrgl-imgproc. My goal is to develop a small library to perform some basic image processing task with Virgil. Because there aren't yet libraries for Virgil dedicated to load images or video-streams, it's "easier" to deploy a WASM file that handle Virgil Pointer's to load and return RGBA data.
This is the method i used to accomplish this task:
Before all you need to "allocate" some space in the WASM linear memory:
the function will return a Pointer ( an address of the memory) this will be used soon. In the javascript code after instantiated the WASM code you invoke that function:
at this point you can:
then invoke the imgProc_invert function
the imgProc_invert function is defined as:
note that we are invokeing another function instantiating the ImgProc class and we get the Pointer.atContents thanks to the
invert
function:we are using an Array since we can't get a Pointer address with a Vector type? So we can't resize or shrink our array, better will be using a Vector.
so we can easily display the result:
At the end we have our inverted image....
For more test the examples at test/Filters
Beta Was this translation helpful? Give feedback.
All reactions