I recently found myself in the situation of wanting to implement a 3rd party sdk as part of the imagepack workflow with the cvimagelink datatype…
On the imagepack github it says to look for specific examples to see how to use the cvimagelink properly, but tbh I couldnt figure it out from looking at that sourcecode :
I do get it to work, but it feels a little cumbersome…
In most 3rd party sdk examples that I’ve looked at, there will be a helper function to convert a bitmap each frame to a raw byte array, which then gets processed by the sdk’s own functions. What would be the best way to deal with that kind of situation in the imagepack?
Take the bitmap of the frontbuffer and convert it to a byte array? Does it even make sense to only get the frontbuffer?
Is there a more streamlined solution?
thanks for jumping in. At the moment im using none of the interfaces you mentioned… I didn’t make it very clear that in this case I’m also not passing an image through or creating it, but rather just need to get the image data from an imagelink (upstream) and analyze it. I guess I was hoping for a general guideline on how the imagelink type works or rather what i have to be aware of… Node workshop material? :D
The way it works in the specific example I was working on last:
a sdk-specific frame object has to be created out of width, height, byte array, pixelformat, timestamp.
new Affdex.Frame(bitmap.Width, bitmap.Height, rgbValues, Affdex.Frame.COLOR_FORMAT.RGB, stopwatch.ElapsedMilliseconds);
Right now I have a method that will extract the byte array from a bitmap (marshal copy) which i will then use for the Affdex.Frame
If I don’t get you totally wrong, then your last question doesn’t really apply in this case, as I’m only analyzing the image, right?
The code (draft) is on github github.com/lukasio/affectiva-vvvv
ok makes more sense
you want to consume an image, not provide one
so you want to look into ‘Destinations’ (that’s my term for a Sink, i.e. consumer)
You can see examples of Destination nodes at:
here’s a particularly simple example:
note the Process function.
If i remember correctly, FInput has a member IntPtr Data which you can use to access the pixels directly.
You should be able to figure it out with intellisense from there (look at all the public members of FInput)