←Select platform

StitchCommand Class

Summary

Provides a method to stitch together a list of RasterImages with a given set of stitching options.

Syntax
C#
C++/CLI
Python
public class StitchCommand : RasterCommand 
public: 
   ref class StitchCommand : RasterCommand 
class StitchCommand(RasterCommand): 
Remarks

StitchCommand does not support merging images with different scales, orientations, and rotations. However, stitching results on images that are at the same scale, orientation, and rotation, can be optimized with StitchImageType, StitchMethodType, and/or StitchSideMatchingType.

Stitch Function - Before

Stitch Function - Before

Stitch Function - After

Stitch Function - After

View additional platform support for this Stitch function.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Effects; 
 
 
public void StitchCommandExample() 
{ 
 
   IList<RasterImage> Images = new List<RasterImage>(); 
   RasterCodecs codecs = new RasterCodecs(); 
 
   // Load images 
   for (int i = 1; i <= 4; i++) 
   { 
 
      codecs.ThrowExceptionsOnInvalidImages = true; 
      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, $"cannon{i}.jpg")); 
      Images.Add(image); 
   } 
 
   // The first image to stitch together 
   var firstImage = Images.First(); 
 
   try 
   { 
      var toStitchImages = Images.Skip(1).ToList(); 
      try 
      { 
         // Create new Stitch Command and run on the provided images with the given parameters 
         // If successful, the firstImage will be updated to a stitched image 
         new StitchCommand 
         { 
            ImageType = StitchImageType.Picture, 
            ToStitchImages = toStitchImages, 
            MethodType = StitchMethodType.Exhaustive, 
            SideMatchingType = StitchSideMatchingType.KeepLeft, 
            MinimumOverlap = 0.0 
         }.Run(firstImage); 
 
         codecs.Save(firstImage, Path.Combine(LEAD_VARS.ImagesDir, "cannonStitched.jpg"), RasterImageFormat.Jpeg411, 24); 
         firstImage.Dispose(); 
         codecs.Dispose(); 
         Images.Clear(); 
      } 
      catch (Exception e) 
      { 
         Assert.Fail(e.Message); 
         Console.WriteLine(e); 
      } 
   } 
   catch (Exception e) 
   { 
      Console.WriteLine(e); 
      Assert.Fail(e.Message); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Effects Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.