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.
@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)
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_pointsresult with the size of the image frame as obtained by OpenCV
Thank you so so much!!
Is it possible to install all this onto a Raspberry Pi ?
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?
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.