PICTools Programmer's Reference
CLEAN

CLEAN: OP_CLEAN

 
Copy Code
typedef struct {
   DWORD                 Reserved0;
   BYTE PICHUGE*         YMap;
   BYTE PICHUGE*         CbCrMap;
   BYTE PICHUGE*         PixelMask;
   BYTE PICHUGE*         LookupTables;
   BYTE PICHUGE*         RedeyeRectangleList;
   BYTE PICHUGE*         Reserved6;
   BYTE PICHUGE*         Reserved7;
   BYTE PICHUGE*         Reserved8;
   PICFLAGS              PicFlags;
   PICFLAGS              PicFlags2;
   LONG                  Subcode;
   LONG                  Stride;
   LONG                  RectX;
   LONG                  RectY;
   LONG                  RectWidth;
   LONG                  RectHeight;
   LONG                  ThreshAdjust;
   LONG                  FiltAdjust;
   LONG                  IterAdjust;
   LONG                  Method;
   LONG                  Darkness;
   LONG                  Alignment;
   LONG                  Brightness;
   LONG                  Contrast;
   DOUBLE                Gamma;
   LONG                  Angle;
   BITMAPINFOHEADER      BiOut;
   LONG                  AutoClip;
   LONG                  AutoShift;
   THUMBNAIL             Thumbnail;
   DOUBLE                PctClippingLow;
   DOUBLE                PctClippingHigh;
   DWORD                 CurveType;
   DWORD                 LookupTablesSize;
   double                ContrastFixedPoint;
   LONG                  RedeyeRectListLength;
   LONG                  NumRedeyeRectsFound;
} CLEAN;

Fields:

Name Description

Reserved0

YMap

CbCrMap

Reserved.

PixelMask

Parameter is used with Speck Removal (Subcode = 0). This parameter points to a 1bpp pixel mask for the rectangle specified by RectX/RectY/RectWidth/RectHeight specifying pixels that are allowed to change during scratch or speck removal.

LookupTables

Parameter is used with Histogram Modification (Subcode = 2). This parameter is set to point to a block of memory of sufficient size to hold the lookup tables generated and/or used by this subcode. The correct size must be set in LookupTablesSize. Set LookupTables nonzero to request that Method 0, 1, or 2 return the lookup table generated. For Method 4 or 5, LookupTables must be nonzero.

RedeyeRectangleList

This points to an array of size RedeyeRectangleListLength REDEYE_RECTANGLE elements (see pic.h and this section).  These elements are filled in by Automatic Red Eyes Detection and Removal (Subcode = 18) according to the red eyes found and corrected in the input image.  For Rectangle List Red Eyes Removal (Subcode = 17), these elements are filled in by you according to the red eyes you want removed from the image.

Reserved6

Reserved7

Reserved8

These fields are not currently used and must be set to 0.

PicFlags

May set PF_NoDibPad to force zero Stride.

PicFlags2

Set PF2_DarkSpeck to remove dark scratches or spots (Subcode = 0).  Set PF2_ ComputeContrastFixedPoint to request that OP_CLEAN compute the fixed point for manual contrast adjustment (Subcode = 2, Method = 0). Set PF2_UseContrastFixedPoint to request that OP_CLEAN use the fixed point, either the one it computes (PF2_ ComputeContrastFixedPoint is set) or the one supplied in ContrastFixedPoint (PF2_ ComputeContrastFixedPoint is clear).

Subcode

Method

Set as indicated by the following table:

Subcode

Method

Operation

0

0

Remove Specks and scratches from Region Specified.

1

0

Remove streaks from image.

1

Do not remove RGB bright streaks.

2

Remove only narrow RGB streaks.

4

Remove all but wide RGB streaks.

8

Leave bright narrow streaks alone.

10

Combines method 2 and method 8 filters.

12

Combines method 4 and method 8 filters.

2

0

Manual setting of Brightness, Contrast, Gamma.

1

AutoLevels.

2

AutoContrast.

3

Equalize (for internal use only).

4

Load three tables.

5

Load one table.

6

1

Orientation - Flip Image.

2

Rotation Right 90 degrees.

3

Rotate Right 90 degrees and flip.

4

Rotate Right 180 degrees.

5

Rotate Right 180 degrees and flip (Mirror).

6

Rotate Right 270 degrees.

7

Rotate Right 270 degrees and flip.

8

0

De-skew Image.

16

0

Precise Region Red Eye Removal.

1

Imprecise Region Red Eye Removal.

2

Imprecise Region Red Eye Removal on Rudy Face.

17

0

Rectangle List Red Eyes Removal.

18

0

Automatic Red Eyes Detection and Removal.

32

1

Sharpen Filter 1.

2

Sharpen Filter 2.

3

Sharpen Filter 3.

8

Unsharp Mask Filter 1.

9

Unsharp Mask Filter 2.

10

Unsharp Mask Filter 3.

16

Noise Reduction Filter 1.

17

Noise Reduction Filter 2.

18

Noise Reduction Filter 3.

19

Noise Reduction Filter 4.

Stride

Set to the image line width in bytes including padding at the end of the line width. If the stride is left 0 and PF_NoDibPad is not set in PicFlags, the stride will be calculated  [ (((Width *BitCount)+31)&(~31))/8 ] to be long word aligned. Deskew assumes padding.

RectX

Parameter is used with Speck Removal (Subcode = 0), Automatic Red Eyes Detection and Removal (Subcode = 18), and Redeye Removal (Subcode = 16). Set to upper left horizontal pixel offset location of area. Setting the Q_REVERSE flag in the PUT Qflags parameter indicates that the image is bottom up and the coordinates offsets will be applied accordingly.

RectY

Parameter is used with Speck Removal (Subcode = 0), Automatic Red Eyes Detection and Removal (Subcode = 18), and Redeye Removal (Subcode = 16). Set to upper left vertical pixel offset location of area. Setting the Q_REVERSE flag in the PUT Qflags parameter indicates that the image is bottom up and the coordinates offsets will be applied accordingly.

RectWidth

Parameter is used with Speck Removal (Subcode = 0), Automatic Red Eyes Detection and Removal (Subcode = 18), and Redeye Removal (Subcode = 16). This is set to the area width in pixels and the value must be greater than 0 or RectX, RectY, and RectHeight must be 0  for Speck Removal, Automatic Red Eyes Detection and Removal, or Redeye Removal. Otherwise if all of these fields are 0, the entire image is used.  For De-skew, see the table in RectHeight.

RectHeight

Parameter is used with Speck Removal (Subcode = 0), De-Skew (Subcode=8) and Redeye Removal (Subcode = 16). This is set to the area height in pixels and the value must be greater than 0 or RectX, RectY, and RectWidth must be 0  for Speck Removal, Automatic Red Eyes Detection and Removal, or Redeye Removal. Otherwise if all of these fields are 0, the entire image is used. 

The RectWidth and RectHeight for De-Skewing an image has additional aspects as indicated by the following table (See Angle):

RectWidth = 0

RectHeight = 0

The dimensions of the new image will be set so that the scale is unchanged from the original (this does NOT mean the size will be the same as the original).

RectWidth ≠ 0

RectHeight = 0

The width of the output image will be abs(RectWidth). The height of the output image will be calculated to preserve aspect ratio.

RectWidth = 0

RectHeight ≠ 0

The height of the output image will be abs(RectHeight). The width of the output image will be calculated to preserve aspect ratio.

RectWidth ≠ 0

RectHeight ≠ 0

The width and height of the output image will be

abs(RectWidth) and abs(RectHeight), respectively.

ThreshAdjust

Parameter is used with Speck Removal (Subcode = 0). Set between -255 and 255 and applies for method = 0 only. The default value is 0. This parameter controls how bright a pixel must be in the enclosed region before it is considered a speck.

FiltAdjust

Parameter is used with Speck Removal (Subcode = 0). Set between -6 and 2 where 0 is the default value. Pixels near (not inside) the speck are filtered to make a smooth transition. This parameter controls where the filter boundary begins relative to the speck.

IterAdjust

Parameter is used with Speck Removal (Subcode = 0). Set between -5 and 100 where 0 is the default value. This parameter controls how much smoothing is applied to pixels in the speck.

Darkness

Parameter is used with Redeye Removal (Subcode = 16), Automatic Red Eyes Detection and Removal (Subcode = 18), and Rectangle Red Eyes Removal (Subcode = 17). This parameter controls both the darkness and glare reflection of the eye. The last two bits will render the eyeshade light (0x3), normal (0x0) or dark (0x1). The next two higher bits minimize the glare from no change (0x00), slightly reduced (0x10) to reduced glare (0x20). The bits can be logically or'd together to give both a dark eye and minimum glare.

Alignment

Parameter is used with Redeye Removal (Subcode = 16) and should be set to 1 for JPEG data. It has no affect on BGR color data.

Brightness

Parameter is used for Histogram Modification and Brightness, Contrast and Gamma Correction (Subcode = 2). The parameter value is set from -100 to +100 with 0 as the neutral default value.

Contrast

Parameter is used for Histogram Modification and Brightness, Contrast and Gamma Correction (Subcode = 2). The parameter value is set from -100 to +100 with 0 as the neutral default value.

Gamma

Parameter is used for Histogram Modification and Brightness, Contrast and Gamma Correction (Subcode = 2). The parameter value is set from 0.1 to 10 with 1 as the neutral default value. The smaller numbers give a brighter overall image.

Angle

Parameter is used for De-Skewing (Subcode = 8) an image. Set the value from -450 to +450 where 1 is equivalent to one 10th of a degree. The default value of 0 will allow the algorithm to determine the angle rotation necessary for de-skewing the image. A consequence of de-skewing an image is that the output image size will change. See the above description table on RectWidth and RectHeight for image size control.

BiOut

Parameter is used for Histogram Modification and Brightness/Contrast/Gamma (Subcode = 2), Orientation (Subcode = 6) and De-Skew (Subcode = 8). The new image dimensions will be returned in this Bitmap header structure after a successful completion of the OP_CLEAN operation.

AutoClip

AutoShift

Reserved.

Thumbnail

Parameter is used with Redeye Removal (Subcode = 16) and should be set to a value specifying the size of the thumbnail to be embedded in the output JPEG/EXIF file.

PctClippingLow

PctClippingHigh

Parameters are used for Histogram Modification (Subcode = 2). The parameter values are real numbers from 0.0 to 100.0 with 0 as the default value. Each denotes the percent of pixels to be clipped at the low and high ends, respectively, when computing the adjustments for AutoLevels or AutoContrast.

CurveType

Parameter is used for Histogram Modification (Subcode = 2, Method = 0 only). The parameter value is set to either CT_Linear (default) or CT_Arctan to specify that the curve generated by Method 0 is a straight line or an arctan function, respectively. CT_Linear will clip the smallest and largest pixel values found in the image to the smallest and largest output values, respectively. CT_Arctan prevents this clipping.

LookupTablesSize

Parameter is used with Histogram Modification (Subcode = 2). The parameter value is the size in bytes of the block of memory pointed to by LookupTables. For Method 0 or 2 or 5, LookupTablesSize must be at least 256 bytes to hold one table. For Method 1 or 4, LookupTablesSize must be at least 768 bytes to hold three tables. As a special case for Method 1 or 4, a smaller LookupTablesSize of only 256 is acceptable for 8bpp grayscale images.

ContrastFixedPoint

Parameter is used with Histogram Modification (Subcode = 2). The parameter value is the fixed point for manual contrast adjustment (Method 0). The fixed point, which is a floating point value such as the image mean, is roughly the input image value that remains unchanged in the output image when only contrast is adjusted. The value is used only if PF2_ComputeContrastFixedPoint is clear and PF2_UseContrastFixedPoint is set and CurveType is CT_Linear. After REQ_EXEC, OP_CLEAN returns in this field the actual fixed point used, either the same one that was input if PF2_ComputeContrastFixedPoint is clear or the one it calculated if PF2_ComputeContrastFixedPoint is set, thereby making the calculated value available for subsequent calls.

RedeyeRectListLength

Set for Automatic Red Eyes Detection and Removal (Subcode = 18) and Rectangle List Red Eyes Removal (Subcode = 17) to the number of available REDEYE_RECTANGLE elements in the array pointed to by RedeyeRectangleList.

NumRedeyeRectsFound

Set by Automatic Red Eyes Detection and Removal (Subcode = 18) to the number of red eyes that were found and corrected.  This is also the number of RedeyeRectangleList elements, but only up to a maximum of RedeyeRectListLength elements, set by Automatic Red Eyes Detection and Removal to describe the location and size of the detected red eyes and the confidence of detection.  If NumRedeyeRectsFound > RedeyeRectListLength after REQ_EXEC returns RES_DONE, then Status will report a warning of ERR_REDEYE_RECT_LIST_TOO_SHORT and the additional red eyes detected will be corrected, but they aren't returned in RedeyeRectangleList.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback