VintaSoft Annotation .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft Annotation .NET Plug-in Discussions
AnnotationDataController annotationDataController = new AnnotationDataController(new ImageCollection { new VintasoftImage(ocrImagePathTextBox.Text, true) });
AnnotationViewController annotationViewController = new AnnotationViewController(annotationDataController);
Rect bb = ...; // Let this be the position and size of the bb in Pixels.
RectangleAnnotationData annotationData = new RectangleAnnotationData();
annotationData.Location = new System.Drawing.PointF(
(float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(bb.X, UnitOfMeasure.Pixels, annotationDataController.Images[0].Resolution.Horizontal),
(float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(bb.Y, UnitOfMeasure.Pixels, С„nnotationDataController.Images[0].Resolution.Vertical));
annotationData.Size = new System.Drawing.SizeF(
(float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(bb.Width, UnitOfMeasure.Pixels, annotationDataController.Images[0].Resolution.Horizontal),
(float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(bb.Height, UnitOfMeasure.Pixels, annotationDataController.Images[0].Resolution.Vertical));
annotationData.FillBrush = new AnnotationSolidBrush(System.Drawing.Color.Transparent);
annotationDataController.GetAnnotations(0).Add(annotationData);
annotationViewController.BurnAnnotationCollectionOnImage(0);
AnnotationViewer.Images = annotationDataController.Images;
The annotation is allways on the wrong position. The bb values i retrieve are correct. I've tested those with an graphic programm and added some manually. It seems that the x and y values are allways too small....
annotationData.Location = new System.Drawing.PointF(
(float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(bb.X + bb.Width / 2, UnitOfMeasure.Pixels, annotationDataController.Images[0].Resolution.Horizontal),
(float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(bb.Y + bb.Height / 2, UnitOfMeasure.Pixels, annotationDataController.Images[0].Resolution.Vertical));
...
Please update your code and let me know if you will have any question or problem.