LEADTOOLS Support
Imaging
Imaging SDK Questions
Drawing some shapes in a image (Reply it as quickly as possible)
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, February 14, 2007 7:20:18 PM(UTC)
Groups: Registered
Posts: 27
hi,
Im using raster imaging tools. With the help of rasterimage and rasteriamgeviewer classes
im getting the image and displaying the image in raster image viewer. Actually the image
contains some spots. Im getting these spots info from a binary file, which contains
collection of rectangles to draw around these spots. After reading this info frm this file,
i want to draw these rectangles in the image.
Then coming to the drawing, After loading the image with the help of
rasterimage image = codecs.load(path), Can i draw these rectangles at the image level only.
Or can i achieve this task at the viewer level.And after drawing these rectangles around
these spots, i want to give flexibility for the user to move rectangles from one place to
other and changing the color of rectangles if the user selects a particular rectangle.Having
these requirements in mind wat may be the better approach to go with. wat are the methods
which supports drawing shapes in the image or at imageviewer.
Any help will be greatly appreicated.
Thank u.
#2
Posted
:
Sunday, February 18, 2007 7:15:38 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You can use create Rectangle annotation objects in the
locations you want. You can move them and change all their properties like you
want, and they remain separate from the image pixel.
If you want, you can 'burn' them or realize them to make
them permanently part of the image pixel data.
The Annotations features are part of LEADTOOLS
Document Imaging toolkits.
#3
Posted
:
Monday, February 19, 2007 11:45:28 PM(UTC)
Groups: Registered
Posts: 27
Hi,
Presently
im drawing the shapes in the Raster imageviewer using
container.graphics. Is it the correct approach to go.
Thank u .
#4
Posted
:
Wednesday, February 21, 2007 9:32:20 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
That is one way to do it, another way is by using the System.Windows.Forms.ControlPaint class. I think are each about as good, but our demos and sample code use the ControlPaint class. You can certainly drag and edit your rectangles, but this is not anything specific to LEADTOOLS. Any help with the ControlPaint class or Container.Graphics you would need to seek help from Microsoft.
Rehashing what Adnan said, LEADTOOLS' annotations can already do all of this for you automatically. The only code you would have to manage is the initial adding of the rectangle annotation objects. The drawing, moving, and etiting can all be done automatically. Annotations require a Document Imaging or higher toolkit in order to use Annotations. This would likely be the easiest way to accomplish your task. There are tutorials and sample codes in the help file as well as some sample projects that ship with the toolkit.
#5
Posted
:
Monday, February 26, 2007 2:59:59 AM(UTC)
Groups: Registered
Posts: 27
Hi,
Im using leadtools version 15, with c# dotnet.
To draw the shapes im using,
RasterImageGdiPlusGraphicsContainer container = rasterimageviewer.image.CreateGdiPlusGraphics();
I have three user controls, all these 3
controls will display the image. With different sizemodes. All these 3
controls have 3 seperate viewer controls. But im Loading the image only
once and im sending it to 3 user controls.So when i draw some thing on
the image. It will be automatically updated on all 3 usercontrols. If i
draw some shape in one user control, i don't want to update this change
in other user control. How can i achieve this task.
And the
other problem im facing, When the user clicks particular shape on
the image then i want to change the Color of the particular shape. If i
do like this it is overwriting the previous shape with some other
color. Which is not looking good. If i want to erase the previous shape
from the image. How can i achieve this task.
Thank u for any assistance.
#6
Posted
:
Wednesday, February 28, 2007 3:55:08 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
I believe that if you only do a simple assignment in C# that it will treat your images as pointers. Therefore, doing something like this:
viewer1.Image = codecs.load(...);
viewer2.Image = viewer1.Image;
viewer3.Image = viewer1.Image;
will end up using the SAME image or memory in all three viewers. Try using the Clone() method when assigning to see if this makes any difference:
viewer1.Image = codecs.load(...);
viewer2.Image = viewer1.Image.Clone();
viewer3.Image = viewer1.Image.Clone();
This should make sure that each viewer's image is taking up a different location in memory and therefore if you draw on one image, it shouldn't get drawn on the other two as well.
As for your second problem, I'm not sure exactly what you're trying to do. Could you please post a code snippet of what you're using to draw the shape and change its color as well as some screenshots of what your results are? Make sure that you zip the screenshots up and that you do not click the preview button before posting or the attachments will not appear.
#7
Posted
:
Thursday, March 1, 2007 3:43:33 AM(UTC)
Groups: Registered
Posts: 27
Hi,
Loading the same image in three windows i intenionally did this. So that when i draw some shapes on the image surface it will be automatically updated. then Im attaching code parts and screenshots of my application. In this according to my first screen shot. Im loading the tiff image into the the 3 controls, which displays the tiff image. Now after that im drawing some shapes on the image( circle). Now it draws these shapes in all the three windows. Im drawing these shapes information sent by other modules.
Now my problem is, I want to give flexibility for the user to move these shapes with the help of mouse moving i.e if the user clicks on a particular spot and if he wants to adjust the shape then this shape should move. For this particular requirement i can move the shape to the new position based on the mouse position. So after moving this shape i want to erase the previous shape. How can i acheive it. Since iam drawing these shapes on the image. So when i move the shapes, at the previous positions, it should contain the original image.
Code parts => spotshape.cs => class which supports drawing different shapes on the image.
and the text file contains the method which uses this class.
#8
Posted
:
Monday, March 5, 2007 5:50:43 AM(UTC)
Groups: Registered
Posts: 27
Adding one more point here, we have Raster Imaging PRO SDK v 15.0, if that helps. Now, let us know how to achieve what has been discussed so far using this.
#9
Posted
:
Tuesday, March 6, 2007 11:50:11 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
When you draw a shape using the CreateGdiPlusGraphics method
the shape will be part of the image data and you will not be able to move it. However,
if you used the annotations objects, you will be able to draw a circle around
the spots and move it (Circle) without harming the image.
LEADTOOLS Support
Imaging
Imaging SDK Questions
Drawing some shapes in a image (Reply it as quickly as possible)
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.