Ofxhapplayer getpixels return null

#1

Hi,
I am using of_v0.9.2_vs_release on windows 10.

while playing a HAP encoded video, using the ofxHapPlayer add on , I try to get the pixels using

player.getPixels() ;

I am consistently getting a null as a return value from the above function.
Any help will be highly appreciated.

Thanks,

Ajay

#2

the hap player is decoded in the gpu and because of that it doesn’t use pixels i guess

#3

so is there any way I can change the Alpha part of the video being played?
please advise.

Thanks

#4

using a shader should be the fastest and most flexible but there might be something simpler like using a different blending mode or a global color, depending on what you mean by changing the alpha

#5

I have to overlay the HAP video over a live video feed.

The live feed has a moving object which is identified using absDiff of ofxCvGrayScaleImage with a static image.

Now I want to make the area occupied by the object as transparent in the HAP video. so that the object appears to be a part of the HAP video.

I hope I am making sense…

#6

you can set one texture as a mask for another using ofTexture::setAlphaMask so you can probably do something like:

hapPlayer.getTexture().setAlphaMask(grayImg.getTexture());
#7

No luck there,


the image below is the diff, and the one on top is the overlay video,
the live video feed is not visible.

using
texture = player1.getTexture();
texture->setAlphaMask(diff.getTexture());

#8

ofxhapplayer seems to be using a shader internally to draw so you probably need to draw the texture instead of the player itself

#9

Am getting an error saying

[ error ] ofTexture: Cannot set alpha mask with different texture target.

#10

you probably need to use GL_TEXTURE_2D as the target for your mask texture, the easiest is to disable rect textures globally with ofDisableArbTex()

#11

How would one go about using GL_TEXTURE_2D as the target for a mask texture, practically speaking?

#12

using setAlphaMask should work the same as long as both textures are GL_TEXTURE_2D

#13

It works, thanks. But it would seem that using an alpha channel on a video as an alpha mask for another video also multiplies the result by the RGB pixel values? Is there a way to disable that?

#14

Hey Arturo,
do you have any example of code, didn’t manage to get it working.
texture.getTexture()->setAlphaMask(alpha.getTexture());
gives me:
Non-const lvalue reference to type ‘ofTexture’ cannot bind to a temporary of type ‘ofTexture *’

((