Computes the rotation angle, XY scaling, and XY translation of the transformed image with comparison to the reference image. These are the transformations that would have to be performed to the reference image to have it match the current image. This method is available in the Document/Medical Toolkits.
public static Leadtools.Imageprocessing.Core.TransformationParameters GetTransformationParameters(Leadtools.RasterImage image,Leadtools.LeadPoint[] referencePoints,Leadtools.LeadPoint[] transformedPoints)
Public Shared Function GetTransformationParameters( _ByVal image As Leadtools.RasterImage, _ByVal referencePoints() As Leadtools.LeadPoint, _ByVal transformedPoints() As Leadtools.LeadPoint _) As Leadtools.Imageprocessing.Core.TransformationParameters
public static Leadtools.Imageprocessing.Core.TransformationParameters GetTransformationParameters(Leadtools.RasterImage image,Leadtools.LeadPoint[] referencePoints,Leadtools.LeadPoint[] transformedPoints)
+ (nullable LTTransformationParameters *)getTransformationParameters:(LTRasterImage *)imagereferencePoints:(nullable NSArray<NSValue *> *)referencePoints /*LeadPoint*/transformedPoints:(nullable NSArray<NSValue *> *)transformedPoints /*LeadPoint*/error:(NSError **)error
public static TransformationParameters getTransformationParameters(RasterImage image,LeadPoint[] referencePoints,LeadPoint[] transformedPoints)
function Leadtools.ImageProcessing.Core.CoreUtilities.GetTransformationParameters(image ,referencePoints ,transformedPoints)
public:static Leadtools.Imageprocessing.Core.TransformationParameters GetTransformationParameters(Leadtools.RasterImage^ image,Leadtools.array<LeadPoint>^ referencePoints,Leadtools.array<LeadPoint>^ transformedPoints)
image
RasterImage object that references the transformed image.
referencePoints
Pointer to an array of reference points. These points represent the center of mass points for the registration marks in the reference image. You have to provide this information.
transformedPoints
Pointer to an array of transformed points. These points are the center of mass points in the image. You have to provide this information.
For more information, refer to Detecting Registration Marks.
This example computes the translation parameters. The example makes the assumption that you have saved the position of the registration marks of the reference image in a file. You should modify this example and replace the manual assignment of the rmData with your own code to load the reference registration mark data before testing this example.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CorePublic Sub GetTransformationParametersExample()Dim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "RGSRef.cmp"))' Prepare the commandDim rmData(2) As SearchRegistrationMarksCommandData' Mark1rmData(0) = New SearchRegistrationMarksCommandDatarmData(0).Rectangle = New LeadRect(680, 20, 941 - 680, 218 - 20)Dim pt0(0) As LeadPointrmData(0).MarkDetectedPoints = pt0rmData(0).Width = 31rmData(0).Height = 29rmData(0).Type = RegistrationMarkCommandType.TShapermData(0).MinimumScale = 90rmData(0).MaximumScale = 110rmData(0).SearchMarkCount = 1' Mark2rmData(1) = New SearchRegistrationMarksCommandDatarmData(1).Rectangle = New LeadRect(665, 790, 899 - 665, 961 - 790)Dim pt1(0) As LeadPointrmData(1).MarkDetectedPoints = pt1rmData(1).Width = 31rmData(1).Height = 29rmData(1).Type = RegistrationMarkCommandType.TShapermData(1).MinimumScale = 90rmData(1).MaximumScale = 110rmData(1).SearchMarkCount = 1' Mark3rmData(2) = New SearchRegistrationMarksCommandDatarmData(2).Rectangle = New LeadRect(7, 1073, 298 - 7, 1246 - 1073)Dim pt2(0) As LeadPointrmData(2).MarkDetectedPoints = pt2rmData(2).Width = 31rmData(2).Height = 29rmData(2).Type = RegistrationMarkCommandType.TShapermData(2).MinimumScale = 90rmData(2).MaximumScale = 110rmData(2).SearchMarkCount = 1Dim command1 As New SearchRegistrationMarksCommand(rmData)command1.Run(leadImage)If ((rmData(2).MarkDetectedCount <> 1) OrElse (rmData(1).MarkDetectedCount <> 1) OrElse (rmData(0).MarkDetectedCount <> 1)) ThenReturnEnd IfDim original() As LeadPoint = _{ _New LeadPoint(81400, 11300), _New LeadPoint(78600, 87400), _New LeadPoint(14300, 115400) _}Dim detected() As LeadPoint = _{ _rmData(0).MarkDetectedPoints(0), _rmData(1).MarkDetectedPoints(0), _rmData(2).MarkDetectedPoints(0) _}' Find center of mass for detected registration marks in the transformed imageDim transformed() As LeadPoint = CoreUtilities.GetRegistrationMarksCenterMass(leadImage, detected)' Find transformation parametersDim parameters As TransformationParameters = CoreUtilities.GetTransformationParameters(leadImage, original, transformed)' Apply transformatin parameters to correct the imageDim applyCommand As New ApplyTransformationParametersCommand(parameters.XTranslation, parameters.YTranslation, _parameters.Angle, parameters.XScale, _parameters.YScale, ApplyTransformationParametersCommandFlags.Normal)applyCommand.Run(leadImage)End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;public void GetTransformationParametersExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "RGSRef.cmp"));// Prepare the commandSearchRegistrationMarksCommandData[] rmData = new SearchRegistrationMarksCommandData[3];//Mark1rmData[0] = new SearchRegistrationMarksCommandData();rmData[0].Rectangle = new LeadRect(680, 20, 941 - 680, 218 - 20);rmData[0].MarkDetectedPoints = new LeadPoint[1];rmData[0].Width = 31;rmData[0].Height = 29;rmData[0].Type = RegistrationMarkCommandType.TShape;rmData[0].MinimumScale = 90;rmData[0].MaximumScale = 110;rmData[0].SearchMarkCount = 1;//Mark2rmData[1] = new SearchRegistrationMarksCommandData();rmData[1].Rectangle = new LeadRect(665, 790, 899 - 665, 961 - 790);rmData[1].MarkDetectedPoints = new LeadPoint[1];rmData[1].Width = 31;rmData[1].Height = 29;rmData[1].Type = RegistrationMarkCommandType.TShape;rmData[1].MinimumScale = 90;rmData[1].MaximumScale = 110;rmData[1].SearchMarkCount = 1;//Mark3rmData[2] = new SearchRegistrationMarksCommandData();rmData[2].Rectangle = new LeadRect(7, 1073, 298 - 7, 1246 - 1073);rmData[2].MarkDetectedPoints = new LeadPoint[1];rmData[2].Width = 31;rmData[2].Height = 29;rmData[2].Type = RegistrationMarkCommandType.TShape;rmData[2].MinimumScale = 90;rmData[2].MaximumScale = 110;rmData[2].SearchMarkCount = 1;SearchRegistrationMarksCommand command1 = new SearchRegistrationMarksCommand(rmData);command1.Run(image);if ((rmData[2].MarkDetectedCount != 1) || (rmData[1].MarkDetectedCount != 1) || (rmData[0].MarkDetectedCount != 1))return;LeadPoint[] original ={new LeadPoint(81400, 11300),new LeadPoint(78600, 87400),new LeadPoint(14300, 115400)};LeadPoint[] detected ={rmData[0].MarkDetectedPoints[0],rmData[1].MarkDetectedPoints[0],rmData[2].MarkDetectedPoints[0]};//Find center of mass for detected registration marks in the transformed imageLeadPoint[] transformed = CoreUtilities.GetRegistrationMarksCenterMass(image, detected);//Find transformation parametersTransformationParameters parameters = CoreUtilities.GetTransformationParameters(image, original, transformed);//Apply transformation parameters to correct the imageApplyTransformationParametersCommand applyCommand = new ApplyTransformationParametersCommand(parameters.XTranslation, parameters.YTranslation, parameters.Angle, parameters.XScale, parameters.YScale,ApplyTransformationParametersCommandFlags.Normal);applyCommand.Run(image);}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing.Core;public async Task GetTransformationParametersExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;// Load the imagestring srcFileName = @"Assets\Image1.cmp";StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));// Prepare the commandSearchRegistrationMarksCommandData[] rmData = new SearchRegistrationMarksCommandData[3];//Mark1rmData[0] = new SearchRegistrationMarksCommandData();rmData[0].Rectangle = LeadRectHelper.Create(680, 20, 941 - 680, 218 - 20);rmData[0].MarkDetectedPoints = new LeadPoint[1];rmData[0].Width = 31;rmData[0].Height = 29;rmData[0].Type = RegistrationMarkCommandType.TShape;rmData[0].MinimumScale = 90;rmData[0].MaximumScale = 110;rmData[0].SearchMarkCount = 1;//Mark2rmData[1] = new SearchRegistrationMarksCommandData();rmData[1].Rectangle = LeadRectHelper.Create(665, 790, 899 - 665, 961 - 790);rmData[1].MarkDetectedPoints = new LeadPoint[1];rmData[1].Width = 31;rmData[1].Height = 29;rmData[1].Type = RegistrationMarkCommandType.TShape;rmData[1].MinimumScale = 90;rmData[1].MaximumScale = 110;rmData[1].SearchMarkCount = 1;//Mark3rmData[2] = new SearchRegistrationMarksCommandData();rmData[2].Rectangle = LeadRectHelper.Create(7, 1073, 298 - 7, 1246 - 1073);rmData[2].MarkDetectedPoints = new LeadPoint[1];rmData[2].Width = 31;rmData[2].Height = 29;rmData[2].Type = RegistrationMarkCommandType.TShape;rmData[2].MinimumScale = 90;rmData[2].MaximumScale = 110;rmData[2].SearchMarkCount = 1;SearchRegistrationMarksCommand command1 = new SearchRegistrationMarksCommand(rmData);command1.Run(image);if ((rmData[2].MarkDetectedCount != 1) || (rmData[1].MarkDetectedCount != 1) || (rmData[0].MarkDetectedCount != 1))return;LeadPoint[] original ={LeadPointHelper.Create(81400, 11300),LeadPointHelper.Create(78600, 87400),LeadPointHelper.Create(14300, 115400)};LeadPoint[] detected ={rmData[0].MarkDetectedPoints[0],rmData[1].MarkDetectedPoints[0],rmData[2].MarkDetectedPoints[0]};//Find center of mass for detected registration marks in the transformed imageLeadPoint[] transformed = CoreUtilities.GetRegistrationMarksCenterMass(image, detected);//Find transformation parametersTransformationParameters parameters = CoreUtilities.GetTransformationParameters(image, original, transformed);//Apply transformation parameters to correct the imageApplyTransformationParametersCommand applyCommand = new ApplyTransformationParametersCommand(parameters.XTranslation, parameters.YTranslation, parameters.Angle, parameters.XScale, parameters.YScale,ApplyTransformationParametersCommandFlags.Normal);applyCommand.Run(image);}
Leadtools.ImageProcessing.Effects.CombineCommand
Leadtools.ImageProcessing.RotateCommand
Leadtools.ImageProcessing.SizeCommand
Leadtools.ImageProcessing.ResizeCommand
|
Products |
Support |
Feedback: GetTransformationParameters Method - Leadtools.ImageProcessing.Core |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.