Hello,
Please help me to retreive annotation object's co-ordinates in pixels, current LEFT,TOP,WIDTH,HEIGHT properties are returning this in Inches. My ultimate idea is to mark specific regions in a document with Annotation & read this using OCR/OMR/Barcode. With this annotation objeject's retreived co-ordinates, I need to use in SETROI method.
I saw an option to convert Inches from a 200 DPI document using (where ann is a annotation object)
int LeftAreaInches = (int)ann.Left; int TopAreaInches = (int)ann.Top; int WidthAreaInches = (int)ann.Width; int heightAreaInches = (int)ann.Height;
int LeftAreaPixel;int TopAreaPixel;int WidthAreaPixel;int HeightAreaPixel;
//
LeftAreaPixel = LeftAreaInches * 200;
TopAreaPixel = TopAreaInches * 200;
WidthAreaPixel= WidthAreaInches * 200;
HeightAreaPixel= heightAreaInches * 200;
but I have serious issue of data loss when I convert Inch to int then to Pixel. Also I am having trouble to understand why SETROI only takes "int", is there is any other method which takes float which will give us more accuracy.
Please send me any sample code on this area.
My Environment
-----------------------
Demo V8 .Net
Tiff/tif document
Thanks,
Sub
getting "Annotation" objects Co-ordinates
Re: getting "Annotation" objects Co-ordinates
Hi,
Easy to do:
Let me know if you need further information.
Kind regards,
Loïc
Easy to do:
Code: Select all
private void button1_Click_1(object sender, EventArgs e)
{
GdPicture.Annotation MyAnnot = GdViewer1.GetAnnotationFromIdx(0);
int left_pix = (int)(MyAnnot.Left * GdViewer1.HorizontalResolution);
int top_pix = (int)(MyAnnot.Top * GdViewer1.HorizontalResolution);
int width_pix = (int)(MyAnnot.Width * GdViewer1.HorizontalResolution);
int height_pix = (int)(MyAnnot.Height * GdViewer1.HorizontalResolution);
GdViewer1.SetRectCoordinatesOnDocument(left_pix - width_pix / 2, top_pix - height_pix/2, width_pix, height_pix); //note: left & top are coordinates of the center point of the annot !
}
Kind regards,
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest