Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How can I get position of draw rectangle on image?

How can I get position of draw rectangle on image?

How can I get position of draw rectangle on image?


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.

RE: How can I get position of draw rectangle on image?

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,

"I try to be nice, but sometimes my mouth doesn't cooperate."

RE: How can I get position of draw rectangle on image?

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.


RE: How can I get position of draw rectangle on image?

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 http://www.foxpert.com/downloads.html


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close