I am writing a code in openCV python for copying an image for practice purpose only, though np.copy() command is already available. Code is as below:
import numpy as np
import cv2 as cv
img = cv.imread('Photos/image_1.jpg')
r, c, d = img.shape
img_copy = np.zeros((r, c, d))
for i in range(r):
for j in range(c):
for k in range(d):
img_copy[i, j, k] = img[i, j, k]
cv.imshow('original image', img)
cv.imshow('copied image', img_copy)
cv.waitKey(0)
The img_copy is not shown instead black image is shown. If I use img_copy = np.ones(rows, cols, 3), and apply same for loop, still then a white image is shown, original image is not shown. Can any one explain why this occures? Original and copied images are shown below.

