how do you make the code check which section a tracked object is in?

If I understand you correctly you want to put an image up with the frame, that image depends on what direction your fish is going. Like you’re steering it with the wasd commands right? To place an image ofe another image:

import cv2

import numpy as np

img1 = cv2.imread('Fishframe.jpg')
img2 = cv2.imread('W_button.jpg')

img3 = img1.copy()
# replace values at coordinates (300, 300) to (399, 399) of img3 with region of img2
img3[300:400,300:400,:] = img2[300:400,300:400,:]
cv2.imshow('Result1', img3)

So you just “cut” out a piece and paist your pic in the hole it left.

Let me know if it works! Have fun!

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top