简体   繁体   English

如何将多个(大于4个)`CV :: Mat`图像`Size(M,N),CV_8UC1`加入一个RGBA图像中?

[英]How to Join multiple (more than 4) `CV::Mat` images `Size(M, N), CV_8UC1` into one RGBA image?

So we have created many, (say 100 ) Mat::zeros(Size(100, 100), CV_8UC1); 因此,我们创建了许多(例如100Mat::zeros(Size(100, 100), CV_8UC1); binary images (with values 0 or 255). 二进制图像(值为0或255)。 We filled them with some data (that can overlay on different images). 我们为它们填充了一些数据(可以覆盖在不同的图像上)。 Now we want to join them into one savable RGBA image on which all data of each single Mat will be represented by unique RGB value and alpha == 0.5. 现在,我们要将它们合并为一个可保存的RGBA图像,在该图像上,每个单个Mat的所有数据将由唯一的RGB值和alpha == 0.5表示。 How to do such thing with openCV 2? 用openCV 2怎么做?

Unfortunately openCV doesn't support alpha channel and I don't think any of it's file I/O libs support transparency on any of the formats that handle it (such as PNG) 不幸的是,openCV不支持Alpha通道,并且我认为它的任何文件I / O库都不支持处理它的任何格式的透明性(例如PNG)

"Only 8-bit (or 16-bit in the case of PNG, JPEG 2000 and TIFF) single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function" http://opencv.willowgarage.com/documentation/cpp/reading_and_writing_images_and_video.html#cv-imwrite “使用此功能只能保存8位(对于PNG,JPEG 2000和TIFF,则为16位)的单通道或3通道(具有'BGR'通道顺序)图像http:// opencv。 willowgarage.com/documentation/cpp/reading_and_writing_images_and_video.html#cv-imwrite

You can create a 4 channel image format using CV_8UC4 and manipulate the alpha yourself but you won't be able to read/write it using imread/imwrite 您可以使用CV_8UC4创建4通道图像格式并自己操作Alpha,但无法使用Imread / imwrite读取/写入它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM