Closed richardtallent-erm closed 1 year ago
Do you know the signatures for these methods?
I added the blend method to the Image class
#region Blend
/// <summary>
/// Blends this image with the given <paramref name="imageToBlendWith"/>
/// </summary>
/// <param name="imageToBlendWith"><see cref="Image"/></param>
/// <param name="x">origin [UL corner] of <paramref name="imageToBlendWith"/> relative to the origin of <see cref="Image"/> can be is smaller 0</param>
/// <param name="y">origin [UL corner] of <paramref name="imageToBlendWith"/> relative to the origin of <see cref="Image"/> can be is smaller 0</param>
/// <param name="fraction"></param>
/// <returns></returns>
public Image Blend(Image imageToBlendWith, int x, int y, float fraction)
{
if (imageToBlendWith == null)
throw new ArgumentNullException(nameof(imageToBlendWith));
var result = LeptonicaApi.Native.pixBlend(_handle, imageToBlendWith.Handle, x, y, fraction);
return result == IntPtr.Zero ? null : new Image(result);
}
#endregion
The other method I can't find in the Leptonica headers
Ah! Looks like it's called pixContrastTRC
(though the Leptonica docs call it pixEnhanceContrast
)
Thanks!
I've been using
System.Drawing
to pre-process images before sending them to TesseractOCR:I'd love to be rid of System.Drawing for good, and I believe Leptonica supports these operations using the
pixLinearTRC
andpixBlend
(with a "blend to black" option?), but I'm not seeing a way to call these throughTesseractOCR.Pix.Image
.I could duplicate all the efforts you've gone through to import Leptonica here but then I'll have to potentially deal with conflicting versions, and Tesseract is my only use case for image processing like this.
Could you by chance expose these operations and their flags?