I have write this short code:
from cv2 import cv2
img = cv2.imread("1.png")
print("Высота:"+str(img.shape[0]))
print("Ширина:" + str(img.shape[1]))
print("Количество каналов:" + str(img.shape[2]))
for x in img.shape[0]:
for y in img.shape[1]:
if img[x, y] == (255, 255, 255):
img[x, y] = (0, 0, 0)
cv2.imwrite("result.png", img)
And I have this error:
Traceback (most recent call last):
File "e:\Projects\Captcha Decrypt\main.py", line 9, in <module>
for x in img.shape[0]:
TypeError: 'int' object is not iterable
Can you solve this problem?
img.shape[0]is an integer not an iterable (list, dict, etc.)img.shape[0]is an INT, how do you want ot iterate on it ? From 0 to that value ? use arangefor that