Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get position of draw rectangle on image?

Status
Not open for further replies.

jobsilva

Technical User
Jul 5, 2014
15
0
0
MX
Hello;

I'm creating OCR application and my idea is to draw rectangle on a image to create bounding box from where I want to extract text from image for get recognized text.

I'm trying to do it with GDI+ but I can't find a way to do it.

I don't know if there is any OCX or DLL library that allows me to do it without going crazy.

I really appreciate any help you can give me.

Best Regards.
 
Jobsilva,
If I understand correctly, your intention is to perform OCR on an image based on an area (region) of the image, that the user selects, by dragging an area over the image with a mousedown and completing the selection of the area with a mouseup event. You want that to provide a graphical selection (rectangle/square) and then you will extract just those pixels/area of text to submit to an OCR engine for recognition.
Is this correct?


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS, ATD

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
I think you focus too much on the thought your rectangle has to be a part of the image. You can have a container control made transparent in its backstyle, for example. I bet Scott has a solution at hand, just ensuring that's what you want before posting it.

Chriss
 
Placing a rectangle on top of an image would be straightforward. Just add a shape control to your form, make it initially the same size as the image, and put it in the same place. You can do all that programmatically.

What's more difficult is to fix it so that the user can drag the shape around or resize it. That's what Scott had in mind when he mentioned dragging the area in the mousedown. No doubt Scott or Chis will be able to suggest some code to help with that.

Meanwhile, you might take a look at Christof Wollenhaupt's SplitterBar class, in which he uses a similar technique to drag a vertical or horizontal bar around the screen. That's not exactly the same as what you want to do, but the the overall approach will be similar, so it should give you some ideas for how to go about it.

EDIT: You can download the SplitterBar (and lots of other good stuff) from
Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top