Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

PNG image with alpha channel

I'm new to OpenCV and I've done a small POC for reading an image from some URL.

I'm reading the image from an URL using video capture. The code is as follows:

   VideoCapture vc;
   vc.open("http://files.kurento.org/img/mario-wings.png");
   if(vc.isOpened() && vc.grab()) 
   {
           cv::Mat logo;
           vc.retrieve(logo);
           cv::namedWindow("t");
           imwrite( "mario-wings-opened.png", logo);
           cv::imshow("t", logo);
           cv::waitKey(0);
           vc.release();
   }


This image is not opened correctly, possibly due to alpha channel.
What is the way to preserve alpha channel and get the image correctly?
Any help is appreciated.

-Thanks

Actual image and expected output:
image description

Opened image:
image description

PNG image with alpha channel

I'm new to OpenCV and I've done a small POC for reading an image from some URL.

I'm reading the image from an URL using video capture. The code is as follows:

   VideoCapture vc;
   vc.open("http://files.kurento.org/img/mario-wings.png");
   if(vc.isOpened() && vc.grab()) 
   {
           cv::Mat logo;
           vc.retrieve(logo);
           cv::namedWindow("t");
           imwrite( "mario-wings-opened.png", logo);
           cv::imshow("t", logo);
           cv::waitKey(0);
           vc.release();
   }


This image is not opened correctly, possibly due to alpha channel.
What is the way to preserve alpha channel and get the image correctly?
Any help is appreciated.

-Thanks

Actual image and expected output:
image description

Opened image:
image description