Loading in Assets in OpenCV
This command will work to load in the file named logo.jpg from the assets folder. If you did not include a separate folder to store images and video files, but they are in the same folder as the python script you can just include its file name.
img = cv2.imread('assets/logo.jpg` )
By default OpenCV loads files in BGR and not RGB. We can specify what mode we want to read in the images.
-1, cv2.IMREAD_COLOR #default flag, ignore all transparent areas and load in full image 0, cv2.IMREAD_GRAYSCALE # loads image in grayscale 1, cv2.IMREAD_UNCHANGED # loads in image with alpha channel (transparency info)
0
1
Tags
Python Programming Language
Data Science
Related
Loading in Assets in OpenCV
Displaying Images
Resizing Images
Rotating Images
Conceptual Breakdown of OpenCV Image Storage
Slicing / Copying Portions of the Image
Creating Text
Project Directory Structure for OpenCV
Shape Creation in OpenCV
Writing Images (OpenCV)
Live Video Feed Processing in OpenCV
Installing and Importing OpenCV
Loading in Assets in OpenCV