L_IsRegMarkBitmap

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_IsRegMarkBitmap (pBitmap, uType, uMinScale, uMaxScale, uWidth, uHeight, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle to be searched */

L_UINT uType;

/* registration marks type */

L_UINT uMinScale;

/* minimum scaling factor of marks to be detected */

L_UINT uMaxScale;

/* maximum scaling factor of marks to be detected */

L_UINT uWidth;

/* registration marks width */

L_UINT uHeight;

/* registration marks height */

L_UINT32 uFlags;

/* flags */

Determines if the object inside the bitmap is a registration mark or not.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap to be searched for registration mark.

uType

Value that specifies the type of registration mark for which to look. Possible values are:

 

Value

Meaning

 

RGS_T

[0x0000] T-shape registration mark.

 

Currently, only one registration mark is defined (T-shape). See the Comments for more information. More shapes will be added in the future.

uMinScale

Minimum scaling factor of mark to be detected. This is a percentage. It must not exceed uMaxScale, or an error will be returned.

uMaxScale

Maximum scaling factor of mark to be detected. This is a percentage. It must not be lower than uMinScale, or an error will be returned.

uWidth

The width of the registration mark (in pixels).

uHeight

The height of the registration mark (in pixels).

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The object is a registration mark.

0

The object is not registrations mark.

< 0

An error occurred. Refer to Return Codes.

Comments

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function verifies whether the object inside the bitmap is a registration mark. The object must be white and the background be black. Objects that are not white will not be detected. The bitmap must have only one object inside it in order to work properly.

Currently, there is only one uType 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 condition on line lengths since you provide the values for uWidth, uHeight, uMaxScale, and uMinScale.

image\T_Shape_Fig.gif

Do not use this function to search for registration marks inside a bitmap. Use L_SearchRegMarksBitmap instead.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

If you simply want to automatically straighten a bitmap, use the L_DeskewBitmap function.

This function 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 in the Document and Medical Imaging toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_CombineBitmap, L_RotateBitmap, L_SizeBitmap, L_ResizeBitmap, L_GetTransformationParameters, L_SearchRegMarksBitmap, L_GetMarksCenterMassBitmap, L_SizeBitmapInterpolate, L_AutoZoneBitmap

Topics:

Raster Image Functions: Document Imaging

 

Detecting Registration Marks

Example

This example loads a bitmap and determines if the object is a registration mark

#if defined (LEADTOOLS_V16_OR_LATER)
 L_INT IsRegMarkBitmapExample(L_VOID)
{
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */
   L_INT nRet; 
   /* Load the bitmap, keeping the bits per pixel of the file */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS)
      return nRet;
   /* check */
   nRet = L_IsRegMarkBitmap (&LeadBitmap, RGS_T, 90, 110, 31, 29, 0); 
   if(nRet == SUCCESS) 
   {
      //it is a registration mark
   }
   else if(nRet <0 )
   {
      return nRet;
   }
   //free bitmap 
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}
#else
 L_INT IsRegMarkBitmapExample(L_VOID)
{
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */
   L_INT nRet; 
   /* Load the bitmap, keeping the bits per pixel of the file */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS)
      return nRet;
   /* check */
   nRet = L_IsRegMarkBitmap (&LeadBitmap, RGS_T, 90, 110, 31, 29); 
   if(nRet == SUCCESS) 
   {
      //it is a registration mark
   }
   else if(nRet <0 )
   {
      return nRet;
   }
   //free bitmap 
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}
#endif // LEADTOOLS_V16_OR_LATER