LEADTOOLS Support
Medical
Medical SDK Questions
How to fast rotate image with cropping corners (no resize)?
#1
Posted
:
Tuesday, July 24, 2018 8:11:14 AM(UTC)
Groups: Registered
Posts: 1
I am using LT 17.5.0.4.
DotNet framework 4 with C#.
My application receive images from external video control (NOT LT) at 30 frames per seconds.
I am rotating each incoming image before displaying it in RasterImageViewer using
Code:RasterImageViewer.RotateAngle = 10;
This way is fast enough; but this resize (on display only) the image. I want to crop the image instead.
So, I use following code:
Code:internal void Rotate(RasterImage rasterImage, int angle)
{
RotateCommand rotateCommand = new RotateCommand();
rotateCommand.Angle = angle * 100;
rotateCommand.FillColor = new RasterColor();
rotateCommand.Flags = RotateCommandFlags.Bicubic;
rotateCommand.Run(rasterImage);
}
This fulfills my requirement. This crops the image properly. But it slows down the performance.
When changing actual pixel data in second code snippet, Flags must be "RotateCommandFlags.Bicubic" to maintain the quality. In first code snippet, this is not needed because pixel data is not changed at all.
Please suggest the way to FAST rotate the image without resizing it.
#2
Posted
:
Tuesday, July 24, 2018 8:50:14 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello,
As with any form of image processing, it is always a trade-off between quality and speed. Unfortunately, there is no way to rotate an image at the speeds you are looking for if you also want to preserve the quality of the image. I believe the reason rotating the viewer works as quickly as it does is because it uses your graphics card for the rendering on screen, unfortunately I don't believe we have a method for using IP commands on the graphics card, so you will be limited by your CPU processing speed. My suggestion would be to just not interpolate the image if you are wanting real time performance, if you will be rendering and exporting a video the quality vs speed consideration will be different.
Thanks,
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Medical
Medical SDK Questions
How to fast rotate image with cropping corners (no resize)?
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.