If you are using OpenCV 2 or OpenCV 3 you should use IMREAD_* flags (as mentioned at here).
C++
using namespace cv;
Mat image = imread("image.png", IMREAD_UNCHANGED);
Python
import cv2
im = cv2.imread("image.png", cv2.IMREAD_UNCHANGED)
More Related Contents:
- Detect semicircle in OpenCV
- How to verify the correctness of calibration of a webcam?
- How to detect simple geometric shapes using OpenCV
- opencv drawing a 2d histogram
- How to define the markers for Watershed in OpenCV?
- How to find out what type of a Mat object is with Mat::type() in OpenCV?
- Computing x,y coordinate (3D) from image point
- How to simulate fisheye lens effect by openCV?
- How to detect colored patches in an image using OpenCV?
- Inverting a real-valued index grid
- ‘unresolved external symbol’ error when linking with OpenCV 3.0
- Why OpenCV Using BGR Colour Space Instead of RGB
- How to crop away convexity defects?
- How to reduce number of classes in YOLOv3 files?
- CMake Error: Variables are set to NOTFOUND
- Augmented Reality SDK with OpenCV [closed]
- OpenCV / SURF How to generate a image hash / fingerprint / signature out of the descriptors?
- Sift implementation with OpenCV 2.2
- Does Kinect Infrared View Have an offset with the Kinect Depth View
- How to use OpenCV SimpleBlobDetector
- Opencv virtually camera rotating/translating for bird’s eye view
- How to crop a CvMat in OpenCV?
- OpenCV as a static library (cmake options)
- Error compiling OpenCV, fatal error: stdlib.h: No such file or directory
- OpenCV floodfill with mask
- Camera pose estimation (OpenCV PnP)
- Multi otsu(multi-thresholding) with openCV
- OpenCV window always on top
- Package opencv was not found in the pkg-config search path
- Preprocessing image for Tesseract OCR with OpenCV