Answer the question
In order to leave comments, you need to log in
How to rewrite OpenCV python image?
Understanding image processing in python with OpenCV. There was a following problem: If I simply shift an array of the image in a new array, the image is strongly highlighted. As if I write there only white pixels. Here is the code:
import cv2 as cv
import numpy as np
img = cv.imread("test1.png")
print(img.shape)
line, row = img.shape[:2]
new_img = np.zeros([line, row, 3])
i = 0
while i < line:
j = 0
while j < row:
new_img[i, j, 0] = img[i, j, 0]
new_img[i, j, 1] = img[i, j, 1]
new_img[i, j, 2] = img[i, j, 2]
j += 1
i += 1
cv.imshow("Image", new_img)
cv.waitKey(0)
cv.destroyAllWindows()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question