How to show transparent images
I am able to show a simple png image on a imshow image window. but a blue strip is coming.
I am using opencv2
here is the code
#include <stdio.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main (int argc, char** argv) {
if(argc != 2)
return -1;
Mat srcImage = imread(argv[1],-1);
if(!srcImage.data)
return -1;
namedWindow("output",1);
imshow("output",srcImage);
waitKey(0);
return 0;
}
I am also attaching an image to show my problem.
Please help me understand the issue.
Here is the loaded image
Here is the original image
transparency has no use in computer-vision, so imshow() just drops the alpha channel.
you probably should avoid using images with alpha, they were made to look nice in a webrowser, but are quite problematic otherwise.
Thanks for the information, i thought there is problem with my code. After doing further research i am able to show a transparent image on top of a non transparent image. I will post it as an answer so it could help someone else.