Documentation
¶
Index ¶
- Constants
- func CutTheWhite(img *image.Gray) *image.Gray
- func ExtractFeatures(img *image.Gray) (string, error)
- func FindLetterBoxes(img *image.Gray, maxLength int) []image.Rectangle
- func FindLetters(r io.Reader) ([]*image.Gray, error)
- func Grayscale(img image.Image) *image.Gray
- func MergeHorizontally(img1, img2 *image.Gray) (*image.Gray, error)
- func MonoChrome(img *image.Gray, threshold uint8) *image.Gray
- func SaveGrayToPNG(fileName string, img *image.Gray) error
- func Solve(r io.Reader) (string, error)
- func SolveFromImageFile(filepath string) (string, error)
- func SolveFromURL(url string) (string, error)
Constants ¶
const MaximumLetterLength = 33
MaximumLetterLength Define a constant MaximumLetterLength with a value of 33, representing the maximum width of a single letter.
const MinimumLetterLength = 14
MinimumLetterLength Define a constant MinimumLetterLength with a value of 14, representing the minimum width of the first letter. If the width of the first letter is less than this value, all letters will be replaced with blank letters.
const MonoWeight = 1
MonoWeight Define a constant MonoWeight with a value of 1, representing the threshold used to convert grayscale images to binary images.
Variables ¶
This section is empty.
Functions ¶
func CutTheWhite ¶
CutTheWhite removes the white border from a grayscale image by cropping it.
func ExtractFeatures ¶
ExtractFeatures extracts image features and returns a binary string.
func FindLetterBoxes ¶
FindLetterBoxes finds and segments characters in a captcha image. The maxLength parameter specifies the maximum allowed width of a single character.
func FindLetters ¶
FindLetters attempts to locate the letters in a captcha image and returns a slice of grayscale letter images. It takes an io.Reader as input, which should contain a valid captcha image. It returns a slice of grayscale letter images and an error if the letter extraction process fails.
func MergeHorizontally ¶
MergeHorizontally merges two grayscale images horizontally. It returns the merged image and an error if the input images are not compatible.
func MonoChrome ¶
MonoChrome generates a monochrome (binary) version of a grayscale image. The threshold parameter is used to determine which pixels are converted to black and which are converted to white.
func SaveGrayToPNG ¶
SaveGrayToPNG saves a grayscale image to a PNG file.
func SolveFromImageFile ¶ added in v1.0.1
SolveFromImageFile takes a file path of an image file as input, opens the file, and processes the data from the image file using the Solve function. It returns the processed result as a string and an error if any error occurs during the process.
func SolveFromURL ¶ added in v1.0.1
SolveFromURL takes a URL string as input, makes an HTTP request to the given URL, and processes the data from the URL using the Solve function. It returns the processed result as a string and an error if any error occurs during the process.
Types ¶
This section is empty.