/// <summary> /// Determines the scew angle and if confidence is high enough returns the descewed image as the result, otherwise returns clone of original image. /// </summary> /// <remarks> /// This binarizes if necessary and finds the skew angle. If the /// angle is large enough and there is sufficient confidence, /// it returns a deskewed image; otherwise, it returns a clone. /// </remarks> /// <param name="sweep">linear sweep parameters</param> /// <param name="redSearch">The reduction factor used by the binary search, can be 1, 2, or 4.</param> /// <param name="thresh">The threshold value used for binarizing the image.</param> /// <param name="scew">The scew angle and confidence</param> /// <returns>Returns deskewed image if confidence was high enough, otherwise returns clone of original pix.</returns> public Pix Deskew(ScewSweep sweep, int redSearch, int thresh, out Scew scew) { float pAngle, pConf; var resultPixHandle = Interop.LeptonicaApi.Native.pixDeskewGeneral(handle, sweep.Reduction, sweep.Range, sweep.Delta, redSearch, thresh, out pAngle, out pConf); if (resultPixHandle == IntPtr.Zero) { throw new TesseractException("Failed to deskew image."); } scew = new Scew(pAngle, pConf); return(new Pix(resultPixHandle)); }
/// <summary> /// Determines the scew angle and if confidence is high enough returns the descewed image as the result, otherwise returns clone of original image. /// </summary> /// <remarks> /// This binarizes if necessary and finds the skew angle. If the /// angle is large enough and there is sufficient confidence, /// it returns a deskewed image; otherwise, it returns a clone. /// </remarks> /// <param name="scew">The scew angle and confidence</param> /// <returns>Returns deskewed image if confidence was high enough, otherwise returns clone of original pix.</returns> public Pix Deskew(out Scew scew) { return(Deskew(DefaultBinarySearchReduction, out scew)); }
/// <summary> /// Determines the scew angle and if confidence is high enough returns the descewed image as the result, otherwise returns clone of original image. /// </summary> /// <remarks> /// This binarizes if necessary and finds the skew angle. If the /// angle is large enough and there is sufficient confidence, /// it returns a deskewed image; otherwise, it returns a clone. /// </remarks> /// <param name="redSearch">The reduction factor used by the binary search, can be 1, 2, or 4.</param> /// <param name="scew">The scew angle and confidence</param> /// <returns>Returns deskewed image if confidence was high enough, otherwise returns clone of original pix.</returns> public Pix Deskew(int redSearch, out Scew scew) { return(Deskew(ScewSweep.Default, redSearch, DefaultBinaryThreshold, out scew)); }
public bool Equals(Scew other) { return(this.confidence == other.confidence && this.angle == other.angle); }