GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / RemoveLines Method / RemoveLines(Int32,LineRemoveOrientation,Int32,Int32,Int32,Int32,Boolean) Method
GdPicture image identifier. Only 1 bit per pixel images with black and white palette are supported.
A member of LineRemoveOrientation enumeration specifying whether to remove horizontal or vertical lines.
Maximum Gap size in the line for it to be considered as a line. If set to 0, no gaps are allowed in the line. If set to -1, gaps calculation is irrelevant to the line equation. Default value is -1.
Maximum thickness of a line allowed at any area of the line. If the line is thicker than this value, the line will not be removed. Range from 1 to 50. Default value is 8.
Minimum Length allowed for the line to be removed. Only lines with a length equal to or bigger than this value will be removed. Range from 1 to Image Width if Horizontal, and from 1 to Image Height if Vertical Line. Default valus is 75.
Maximum Character Interception of the Line. If characters intercepting the line have a size of interception larger than this value, the line will not be removed. Range from 0 to MinLineLength / 2. Default value is 8.
Whether to reconnect characters that are broken upon the lines removal or keep the gaps where the line was. Default value is false.
Example





In This Topic
RemoveLines(Int32,LineRemoveOrientation,Int32,Int32,Int32,Int32,Boolean) Method
In This Topic
Performs line removal on a GdPicture image or on an area of a GdPicture image defined by SetROI() method.
Syntax
'Declaration
 
Public Overloads Function RemoveLines( _
   ByVal ImageID As Integer, _
   ByVal Orientation As LineRemoveOrientation, _
   ByVal MaxLineGap As Integer, _
   ByVal MaxLineThickness As Integer, _
   ByVal MinLineLength As Integer, _
   ByVal MaxInterception As Integer, _
   ByVal ReConnectBrokenCharacters As Boolean _
) As GdPictureStatus
public function RemoveLines( 
    ImageID: Integer;
    Orientation: LineRemoveOrientation;
    MaxLineGap: Integer;
    MaxLineThickness: Integer;
    MinLineLength: Integer;
    MaxInterception: Integer;
    ReConnectBrokenCharacters: Boolean
): GdPictureStatus; 
public function RemoveLines( 
   ImageID : int,
   Orientation : LineRemoveOrientation,
   MaxLineGap : int,
   MaxLineThickness : int,
   MinLineLength : int,
   MaxInterception : int,
   ReConnectBrokenCharacters : boolean
) : GdPictureStatus;

Parameters

ImageID
GdPicture image identifier. Only 1 bit per pixel images with black and white palette are supported.
Orientation
A member of LineRemoveOrientation enumeration specifying whether to remove horizontal or vertical lines.
MaxLineGap
Maximum Gap size in the line for it to be considered as a line. If set to 0, no gaps are allowed in the line. If set to -1, gaps calculation is irrelevant to the line equation. Default value is -1.
MaxLineThickness
Maximum thickness of a line allowed at any area of the line. If the line is thicker than this value, the line will not be removed. Range from 1 to 50. Default value is 8.
MinLineLength
Minimum Length allowed for the line to be removed. Only lines with a length equal to or bigger than this value will be removed. Range from 1 to Image Width if Horizontal, and from 1 to Image Height if Vertical Line. Default valus is 75.
MaxInterception
Maximum Character Interception of the Line. If characters intercepting the line have a size of interception larger than this value, the line will not be removed. Range from 0 to MinLineLength / 2. Default value is 8.
ReConnectBrokenCharacters
Whether to reconnect characters that are broken upon the lines removal or keep the gaps where the line was. Default value is false.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

You can use the method to remove both vertical and horizontal lines at the same time by using a bitwise OR between LineRemoveOrientation.Horizontal and LineRemoveOrientation.Vertical

If you are using the RemoveLines method to increase your OCR result accuracy, set ReConnectBrokenCharacters to True.

If MaxLineGap is set to -1, gaps calculation is irrelevant to the line equation, thus some removed lines will have gaps. If you do not want gaps at all, set it to 0.

This method is used in the "Document Clean Up" Demo. Please check appendix "Learning GdPicture.NET" > "Sample Guide Overview" for more information.

This method requires the Image Documents component to run.

Example
Removing lines from a black and white tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // LoadInMemory parameter is set to true in order to be able to update the input file.
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);
 
    // Remove vertical and horizontal lines using default parameters.
    gdpictureImaging.RemoveLines(imageID, LineRemoveOrientation.Horizontal | LineRemoveOrientation.Vertical, -1, 8, 75, 8, false);
    gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also