<jupyter_start><jupyter_text>Reading, writing and displaying images<jupyter_code>import cv2
import numpy as np
# Load first image
# Don't need to load library again but, it's a good habit

import cv2
import numpy as np

# Load an image using the speciafying image path
input = cv2.imread('./images/image.jpg')

# The file 'image.jpg' is loaded to input variable in python


# To display image, use 'imshow'
cv2.imshow('<NAME>', input)

# 'waitKey' allow show input information 3000 image window open
# Leaving a blank key -> wait for any key press
# Insert number (milisecond) to specify a delay for how long the window opens.
cv2.waitKey()

# Make sure to insert this line
# to close all windows open. Unless, the image window will cause to hang.
cv2.destroyAllWindows()<jupyter_output><empty_output><jupyter_text>Take a look, how images are stored<jupyter_code>import numpy as np
print input.shape<jupyter_output>(900, 1350, 3)<jupyter_text>**input has 3 dimensionals**:- Height = 959 pixels- Width = 719 pixels- Color = 3 colors (RGB)  Save images to file<jupyter_code>import cv2
cv2.imwrite('./images/output.jpg', input)
cv2.imwrite('./images/output.png', input)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup