OpenCV
OpenCV - 차원 변경후, 이미지 생성
Hoon[]
2022. 11. 5. 13:06
흑백 이미지 데이터 1차원 벡터 변경 후 다시 2차원 변경 후 이미지 생성
'''
import pandas as pd
img = cv2.imread('./lena.jpg', cv2.IMREAD_GRAYSCALE) # cv2.IMREAD_COLOR
print('img.shape=', img.shape)
img1 = img.flatten()
# img = img.reshape(img.shape[0] * img.shape[1])
print('img1.shape=', img1.shape)
img1 = img1.reshape(512, 512)
print('img1.shape=', img1.shape)
cv2.imshow('img', img)
cv2.imshow('img1', img1)
cv2.waitKey()
cv2.destroyAllWindows()
reshape 전에 1차원 벡터 변경 하기 위해 flatten() 사용