Take the following steps to start a project and to add some code that combines two images with a region:
In the "Solution Explorer" window, right-click on the "References" folder, and select "Add Reference…" from the context menu. In the "Add Reference" dialog box, select the ".NET" tab and browse to Leadtools For .NET "<LEADTOOLS_INSTALLDIR>\Bin\DotNet4\Win32 " folder and select the following DLLs:
Click the Select button and then press the OK button to add the above DLLs to the application.
Property | Value |
Dock | Fill |
Switch to Form1 code view (right-click Form1 in the solution explorer then select View Code ) and add the following lines at the beginning of the file:
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Controls.WinForms
Imports Leadtools.ImageProcessing
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls.WinForms;
using Leadtools.ImageProcessing;
Add an event handler to the Form1 Load event and add the following code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' intitialize a new RasterCodecs object
Dim codecs As New RasterCodecs()
' load the main image into our viewer
RasterImageViewer1.Image = codecs.Load("C:\Users\Public\Documents\LEADTOOLS Images\Sample1.cmp")
' load the temporary image
Dim tempImage As RasterImage = codecs.Load("C:\Users\Public\Documents\LEADTOOLS Images\Sample2.cmp")
' add a region to the image
tempImage.AddRectangleToRegion(Nothing, New LeadRect(100, 100, 200, 200), RasterRegionCombineMode.Set)
' combine
Dim combine As New CombineFastCommand()
combine.DestinationImage = RasterImageViewer1.Image
combine.DestinationRectangle = New LeadRect(0, 0, tempImage.ImageWidth, tempImage.ImageHeight)
combine.SourcePoint = LeadPoint.Empty
combine.Flags = CombineFastCommandFlags.OperationAverage
combine.Run(tempImage)
tempImage.Dispose()
End Sub
private void Form1_Load(object sender, System.EventArgs e)
{
// intitialize a new RasterCodecs object
RasterCodecs codecs = new RasterCodecs();
// load the main image into our viewer
rasterImageViewer1.Image = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\Sample1.cmp");
// load the temporary image
using(RasterImage tempImage = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\Sample2.cmp"))
{
// add a region to the image
tempImage.AddRectangleToRegion(null, new Rectangle(100, 100, 200, 200), RasterRegionCombineMode.Set);
// combine
CombineFastCommand combine = new CombineFastCommand();
combine.DestinationImage = rasterImageViewer1.Image;
combine.DestinationRectangle = new Rectangle(0, 0, tempImage.ImageWidth, tempImage.ImageHeight);
combine.SourcePoint = Point.Empty;
combine.Flags = CombineFastCommandFlags.OperationAverage;
combine.Run(tempImage);
}
}
Products |
Support |
Feedback: Combining Images With Regions |
Introduction |
Help Version 19.0.2017.6.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.