←Select platform

IsRegistrationMark Method

Summary
Determines if the object inside the image is a registration mark or not. This method is available in the Document/Medical Toolkits.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public static bool IsRegistrationMark( 
   RasterImage image, 
   RegistrationMarkCommandType type, 
   int minScale, 
   int maxScale, 
   int width, 
   int height 
) 
+ (BOOL)isRegistrationMark:(LTRasterImage *)image\ 
                      type:(LTRegistrationMarkCommandType)type 
                  minScale:(NSInteger)minScale 
                  maxScale:(NSInteger)maxScale 
                     width:(NSInteger)width 
                    height:(NSInteger)height 
                     error:(NSError **)error 
public static boolean isRegistrationMark( 
   RasterImage image, 
   RegistrationMarkCommandType type, 
   int minScale, 
   int maxScale, 
   int width, 
   int height 
); 
public: 
static bool IsRegistrationMark(  
   RasterImage^ image, 
   RegistrationMarkCommandType type, 
   int minScale, 
   int maxScale, 
   int width, 
   int height 
)  
def IsRegistrationMark(self,image,type,minScale,maxScale,width,height): 

Parameters

image
RasterImage object that references the image to be searched for registration mark.

type
Value that specifies the type of registration mark for which to look. Currently, only one registration mark is defined (T-shape). See the Comments for more information. More shapes will be added in the future.

minScale
Minimum scaling factor of mark to be detected. This is a percentage. It must not exceed maxScale, or an error will be returned. This parameter accepts only positive values.

maxScale
Maximum scaling factor of mark to be detected. This is a percentage. It must not be lower than minScale, or an error will be returned. This parameter accepts only positive values.

width
The width of the registration mark (in pixels). This parameter accepts only positive values.

height
The height of the registration mark (in pixels). This parameter accepts only positive values.

Return Value

Boolean value indicating weather that specific object is registration mark or not.

Remarks
  • This method verifies whether the object inside the image is a registration mark. The object must be white and the background be black. Objects that are not white will not be detected. The image must have only one object inside it in order to work properly.
  • Currently, there is only one type defined, a T-shaped figure as shown in the following figure. This type is a "T" rotated by 90 degrees counter clockwise. The P4 point must be on the center point of Line P1P2 (that is, the distance from P1 to P4 equals the distance from P2 to P4). The line width should be greater than 2 pixels(preferably 3 pixels). There are no conditions on line lengths since you provide the values for width, height, maxScale, and minScale.

    t-shape-fig.jpg
  • Do not use this command to search for registration marks inside the image. Use SearchRegistrationMarksCommand instead.

  • If you simply want to automatically straighten the image, use the DeskewCommand.
  • This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
  • This method does not support signed data images.

For more information, refer to Detecting Registration Marks.

Example

This example determines if the object is a registration mark.

C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
 
 
public void IsRegistrationMarkExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "RGSRef.cmp")); 
 
   // Prepare the command 
   bool IsRegMark = CoreUtilities.IsRegistrationMark(image, RegistrationMarkCommandType.TShape, 90, 110, 31, 29); 
   MessageBox.Show(IsRegMark ? "It's Registration Mark" : "Not a Registration Mark"); 
 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import static org.junit.Assert.assertTrue; 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.core.*; 
 
 
public void isRegistrationMarkExample() { 
 
      final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
 
      // Load an image 
      RasterCodecs codecs = new RasterCodecs(); 
      codecs.setThrowExceptionsOnInvalidImages(true); 
      RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "rgsref.cmp")); 
 
      // Prepare the command 
      boolean IsRegMark = CoreUtilities.isRegistrationMark(image, RegistrationMarkCommandType.T_SHAPE, 90, 110, 
                  31, 29); 
      System.out.println(IsRegMark ? "It's Registration Mark" : "Not a Registration Mark"); 
 
      codecs.save(image, combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"), RasterImageFormat.JPEG, 0); 
 
      assertTrue(new File(combine(LEAD_VARS_IMAGES_DIR, "Result.jpg")).exists()); 
      System.out.println("Image successfully saved to " + combine(LEAD_VARS_IMAGES_DIR, "Result.jpg")); 
 
} 
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.Core Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.