For example i've an image like below
I want to draw a box for recognize_text() which is in the first line with mouse and extract that text with the help of Pytesseract or EasyOCR in python. Can anyone please help me with this?
There is a python code in github. I'm attaching the link below and the image. The code will enable to draw one rectangle. But i'm unable to extract text present in that rectangle.

You can use
image_to_datan_boxesvariable stores all the detected text regions in the given input image.Now, for each localized region, we need to get the coordinates and draw the box (rectangle method)
Since you want to draw the box (rectangle) around the text "recognize_text", you can do:
Results will be:
Most probably the second result is what you wanted.
Maybe you could also add another constraint:
You should also read the improving tesseract quality
Code:
Result: