Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 1, 2007 12:29:49 AM(UTC)
deepaksah

Groups: Registered
Posts: 8


I need to draw the annotation around the paragraph in an Article (in the form of Image).

Process is like:

1. Image has many paragraphs, pictures etc.

2. I need to click on the paragraph .

3. The Annotation should be drawn around the paragraph.

Please advise.

Deepak Sah...

 

 

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, August 3, 2007 11:05:10 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Could you please describe this in more detail?  Please post some sample images that you would want to do this on, as well as some screenshots of how you'd want the annotations drawn based on where you click.
 
#3 Posted : Wednesday, September 5, 2007 4:30:18 AM(UTC)
deepaksah

Groups: Registered
Posts: 8


Hi ,

This is to draw an annotation in the form of Rectangle.

Suppose, i have the paragraph:

if i click any place in the paragraph, the annotation should be drawn around that paragrpph.

Please see the attached document.

 

Deepak ...

 
#4 Posted : Thursday, September 6, 2007 4:36:41 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Please reattach your files.

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB.  If it is larger, please send an email to support@leadtools.com or  give us your email address and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.
 
If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.

 
#5 Posted : Sunday, September 16, 2007 9:50:34 PM(UTC)
deepaksah

Groups: Registered
Posts: 8


Hi Greg,

My Questiom is simple as below:

if i click on the paragraph, the annotation should be drawn around it.

Is it Possible.

Deepak Sah...

 

 
#6 Posted : Tuesday, September 18, 2007 4:16:11 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Yes it is possible, but you will have to write that algorithm yourself because we don't have a function that does that..  You will need to create some kind of searching algorithm that expands from the point and returns the rectangle that surrounds the paragraph.

Ideally your image would be black and white.  You will have to start from the point you clicked at and keep increasing the size of the rectangle until it finds the indentation of the text near the top left, the next indentation or blank space below and then the end of the line on the right edge.  Since the indentations are likely the key, you will probably want to find your left boundry first, then search up and down to find out where your top and bottom should be, then find out your right edge and fine tune the top and bottom after that to make sure you're not cutting off any letters like 'y' that could possibly go below the line.
 
#7 Posted : Wednesday, September 26, 2007 3:43:14 AM(UTC)
deepaksah

Groups: Registered
Posts: 8


Hi.

Please advise for below:

"finds the indentation of the text near the top left"

how can we do this.

Deepak sah...

 

 
#8 Posted : Wednesday, September 26, 2007 10:54:25 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


I've attached a series of images for you to look at.

1. Click on the image and create a small starter rectangle
2. Search left to find the edge, looking for the leftmost black pixels.
3. Search up to find the tab.  You should be able to find this by noticing that there's a gap in the pixels on the left edge.  Most likely to find this you'll have to go past the tab into the next paragraph and back down a little bit.
4. Search down and find the line of text that is just before another tab or large blank gap (could be multi-line gab between paragraphs or the bottom of the page)
5. Finally, search for the right ege by looking for the rightmost black pixels.  Now you can create an annotation based on this rectangle.
File Attachment(s):
steps.zip (12kb) downloaded 27 time(s).
 
#9 Posted : Wednesday, September 26, 2007 11:51:54 PM(UTC)
deepaksah

Groups: Registered
Posts: 8


Just to confirm it......
Can we draw the Annotation as in the attached image (Annotation no. 6)?

Is it possible to get the code for the same?  :)

Deepak Sah.....

File Attachment(s):
Annotation.zip (38kb) downloaded 26 time(s).
 
#10 Posted : Thursday, September 27, 2007 6:18:54 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Yes, you should be able to do this as well.  It would be similar to the approach I mentioned in my previous post except that you won't need to look for indents, just blank space on all four sides, which should actually be easier, especially since the text is justified.

I don't have code to do this, but the approach is as I described, just extend the bounds of your rectangle out and check for any foreground colors.  As soon as you get no foreground colors at a reasonable buffer (so that you're stopping at the true end rather than between lines of text), then you move onto the next edge.

You could determine the colors in one of two ways:
1. loop through all of the pixels that occur in between the two endpoints.
2. create a region the size of that line using the Set combine mode.  Then create another regoin using AddColorToRegion or AddColor[Rgb or Hsv]RangeToRegion using the And combine mode.  Finally, use CalculateRegionArea to count the number of pixels that are in that line.
 
#11 Posted : Thursday, October 4, 2007 6:00:55 AM(UTC)
deepaksah

Groups: Registered
Posts: 8


Hi Greg,

It is very slow... when we go to make the Annotations.

With this,

How would we work with different block type.. like Headings, Sub-Heading, IMAGES and all.....

Do we need to write the different algorithm for these???

Please advise.

Deepak Sah....
 
#12 Posted : Friday, October 5, 2007 6:24:57 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


On way to increase speed would be to increase a step size.  Rather than jumping 1 pixel at a time and evaluating the line you could jump ever 2 or 3 etc.

You shouldn't have to change it much based on text size, font, , images, etc.  All you should really have to do is change what actually defines the blank space.  For example, when your font size is small, the amount of blank space you have to find to determine you're on the edge would be much less than a title heading, the space between two words might be the same distance that can define an edge for the main text.  Images should actually be easier than text in my opinion.

All of these things, such as the step and how large the border has to be could be input as parameters and therefore you wouldn't actually have to change any code in the algorithm based on what you want to search for.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.118 seconds.