To create a very basic pattern using opencv library in python, here I will be making The Indian flag
Aug 1, 2023
Here is a pretty simple code to print out a canvas that looks like the Indian flag
import numpy as np
import cv2
canvas=np.zeros((100,100,3))
canvas[:,:]=[255,255,255]
canvas[0:33]=[0,0,255]
canvas[33:68]=[255,255,255]
canvas[34:67,34:67]=[255,0,0]
canvas[68:100]=[0,255,0]
cv2.imshow('hi',canvas)
cv2.waitKey()
cv2.destroyAllWindows()
As you can see, it is a pretty simple code, you will first have to install the open cv library through
pip install opencv-python