How to read and display an image in OpenCV?

devquora
devquora

Posted On: Feb 22, 2018

 

The cv2.imread() and cv2.imshow() method is used by the OpenCV to read and show images.

  • Cv2.imread() - It requires an argument that is the path of the image file. The second option is optional. They are cv2.IMREAD_COLOR, cv2.IMREAD_GRAYSCALE, cv2.IMREAAD_UNCHANGED and they define to load a colored image, grayscale image, and load image with the alpha channel. This method returns the numpy array that contains the pixel values of the image in RGB.
  • Cv2.imshow() - It accepts two argument. The first is the name of the window where the image should be displayed and the second argument is the name of the image itself.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    OpenCV Interview Questions

    What is OpenCV?

    OpenCV is Open Source Computer Vision Library relaesed under BSD license, which is free for both commercial and academic..

    OpenCV Interview Questions

    Enlist different types of video filters available in OpenCV ?

    Blurring, Smoothing, Distortion, Warp Stabilizer, alpha extract, bilateral, color matrix, chrome hold are few video filters available in OpenCV....

    OpenCV Interview Questions

    What is use of Mat class in OpenCV?

    The primary use of the Mat class in OpenCV is to store and obtain the values of any image. This class is used in representing the n-dimensional array and is utilized in storing data of the image of gr...