I am current having the problem which shows that TypeError: 'Tensor' object is not callable

from ultralytics import YOLO
import cv2

cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)

model = YOLO(“…/yolo weights/yolov8n.pt”)

while True:
success, img = cap.read()
results = model(img, stream=True)
for r in results:
boxes = r.boxes
for box in boxes:
x1, y1, x2, y2 = box.xyxy(0)
print( x1, y1, x2, y2)

cv2.imshow("Image", img)

and the error is

box.xyxy(0) since you are calling it as a function. In case you want to index the tensor, use box.xyxy[0].

Thanks mate, it worked