opencv - Ошибка TypeError: only size-1 arrays can be converted to Python scalars

Есть такой код:

import cv2
import random
import numpy as np
t=int(input())
r=int(input())
g=int(input())
b=int(input())
r=0
g=0
b=0
img = cv2.imread("color.bmp")
r=cv2.imread("color.bmp")
for i in range(1,480,t):
    for j in range(1,720,t):
        img[i:i+t, j:j+t]= ( b/((480+720)/t-2)*(((i-1)/t)+((j-1)/t)), g/((480+720)/t-2)*(((i-1)/t)+((j-1)/t)), r/((480+720)/t-2)*(((i-1)/t)+((j-1)/t)))
        cv2.imshow('hello',img)
        cv2.waitKey(1)
cv2.imwrite("color.jpg", img)

Выводит ошибку

Traceback (most recent call last):
  File "cv.py", line 19, in <module>
    img[i:i+t, j:j+t]= (int( b/ int((480+720)/t-2) * int(((i-1)/t)+((j-1)/t))) , int( g/ int((480+720)/t-2) * int(((i-1)/t)+((j-1)/t))), int( r/ int((480+720)/t-2) * int(((i-1)/t)+((j-1)/t))))
TypeError: only size-1 arrays can be converted to Python scalars 

Подскажите, пожалуйста, как исправить.


Ответы (0 шт):