Finding the location of an object detected in a video

Is there anyway that I can find the location of an object that has been detected in a video? I am doing a fire-fighting robot project. I want to be able to detect the location of the fire so that I can instruct the robot to move closer to the fire by giving instructions to the motors connected to Arduino and extinguish the fire.

1 Like

@SruthiRam You can use the coordinates of the detection results, compare it to the size of the image frame and use that to determine the position of the fire (either left or right)

1 Like

That’s a great way to determine the position, thank you very much! How do you determine the size of the image frame?

You can achieve this by doing the following:

  • Obtain each frame from the video using OpenCV
  • use the CustomObjectDetection class to detect the image frame
  • obtain the detection information from the .detectObjectsFromImage() function
  • compare the box_points result with the size of the image frame as obtained by OpenCV
1 Like

Thank you so so much!!

Is it possible to install all this onto a Raspberry Pi ?

1 Like

Yes you can. Just ensure you follow the instructions for installing the dependencies accordingly.

That’s great!! I noticed that the co-ordinates of the detection results are given only in x- y coordinates. I need to move the robot to the middle of the room, corner etc. Will it be possible to do this as well along with moving the robot in left or right direction?

1 Like

If you want to move the robot in the “Z”, you will need to use a model for computing distance to visible objects in the camera. Please note that ImageAI doesn’t have distance model pre-built into it. You may need to use another code base to do this.

Okay I will check it out. Thank you very much.

1 Like