Skip to content
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

How to add transpranet background overlay on image (IplImage) #306

Open
xiaos opened this issue Jan 9, 2016 · 6 comments
Open

How to add transpranet background overlay on image (IplImage) #306

xiaos opened this issue Jan 9, 2016 · 6 comments

Comments

@xiaos
Copy link

xiaos commented Jan 9, 2016

Hi

@saudet , I try to add an overlay on iplimage, but I find overlay's background are black...

Any idea on how to solve this?

@saudet
Copy link
Member

saudet commented Jan 9, 2016

Do you have some code in C/C++ that does what you want?

@saudet saudet added the question label Feb 6, 2016
@nicolake
Copy link

Hi, I think something like this : http://jepsonsblog.blogspot.com.ar/2012/10/overlay-transparent-image-in-opencv.html
it's possible?

@saudet
Copy link
Member

saudet commented Apr 17, 2016

Sure, what issues are you having doing the same in Java?

@nicolake
Copy link

nicolake commented Apr 17, 2016

for(int c = 0; opacity > 0 && c < output.channels(); ++c)
      {
        unsigned char foregroundPx =
          foreground.data[fY * foreground.step + fX * foreground.channels() + c];
        unsigned char backgroundPx =
          background.data[y * background.step + x * background.channels() + c];
        output.data[y*output.step + output.channels()*x + c] =
          backgroundPx * (1.-opacity) + foregroundPx * opacity;
      }

so far I could't translate those lines to test the function in java

@saudet
Copy link
Member

saudet commented Apr 17, 2016

You might want to try to use indexers: http://bytedeco.org/news/2014/12/23/third-release/
If you're still having issues understanding the code, you may also want to try and ask on Stack Overflow...

@saudet
Copy link
Member

saudet commented Mar 31, 2018

FYI, this is going to be much easier done using FFmpegFrameFilter with the overlay filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants