Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 image description

Here is the original image image description