Home Copy from CV_8UC4 to CV_8UC3 using alpha channel
Reply: 0

Copy from CV_8UC4 to CV_8UC3 using alpha channel

Notinlist Published in 2017-12-07 16:21:48Z

I have a small rendered image with alpha channel as GpuMat with type CV_8UC4. I have many GpuMat instances with 3 channels as CV_8UC3. I want to blit this RGBA to every other image's top left corner respecting the aplha channel correctly.

GpuMat icon = renderLogoWithTransparency(); // CV_8UC4
std::vector<GpuMat> &images = imageLibrary();  // CV_8UC3
for(auto &image: images)
  Rect target(0,0,icon.cols,icon.rows);

The resulting error is: OpenCV Error: Assertion failed (!fixedType() || ((cuda::GpuMat*)obj)->type() == mtype) in create, file /root/opencv/modules/core/src/matrix.cpp, line 2260

Which seems rightful as copyTo is for simple copying and I want color blending. How can I do the blending without downloading from GPU to main memory?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.313533 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO