Thursday, July 3, 2025

Write given 2-D data in image file

 import numpy as np 

 import cv2 

 data=np.array([[255,0,255,0],[0,255,0,255],[255,0,255,0],[0,255,0,255]], dtype=np.uint8)

 cv2.imwrite('output_image.png',data) 

 cv2.imshow('image',data) 

 cv2.waitKey(0) 

 cv2.destroyAllWindows()

No comments:

Post a Comment

SD Card vs SSD: What’s Really Happening Inside Your Storage

  We use SD cards in phones and cameras, and SSDs in laptops and PCs, almost without thinking. They both feel similar—fast, silent, and com...