# How to select ROI within the code, without using Mouse?

**URL:** <https://forum.opencv.org/t/how-to-select-roi-within-the-code-without-using-mouse/6553>\
**Category:** Python\
**Created:** [December 4, 2021, 1:03am UTC](https://forum.opencv.org/t/how-to-select-roi-within-the-code-without-using-mouse/6553 "2021-12-04T01:03:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav\_Nawale](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/gaurav_nawale/32/3925_2.png) [@Gaurav\_Nawale](https://forum.opencv.org/u/Gaurav_Nawale)\
**Post date:** [December 4, 2021, 1:03am UTC](https://forum.opencv.org/t/how-to-select-roi-within-the-code-without-using-mouse/6553/1 "2021-12-04T01:03:21Z")

</div>

I have noticed that my object tracking code detects the object of interest pretty accurately for a second and then it starts to loose track of the object. I want to experiment, if refreshing ROI every second helps or not!

But I could not selectROI without using mouse, please guide me on how to selectROI (the bounding box) without using mouse , so that I can run the code continuously…

I will really appreciate any help!

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [December 4, 2021, 9:08am UTC](https://forum.opencv.org/t/how-to-select-roi-within-the-code-without-using-mouse/6553/2 "2021-12-04T09:08:58Z")

</div>

what are you trying to track ?  
maybe there is a XXXX\_detector for that, which can replace “human annotation” ?

> [@Gaurav\_Nawale](#):
>
> I want to experiment, if refreshing ROI every second helps or not!

yea, makes sense.
