public static int boxaaSizeRange(this Boxaa baa, out int pminw, out int pminh, out int pmaxw, out int pmaxh) { if (null == baa) { throw new ArgumentNullException("baa cannot be null."); } return(Native.DllImports.boxaaSizeRange((HandleRef)baa, out pminw, out pminh, out pmaxw, out pmaxh)); }
public static int boxaaRemoveBoxa(this Boxaa baa, int index) { if (null == baa) { throw new ArgumentNullException("baa cannot be null"); } return(Native.DllImports.boxaaRemoveBoxa((HandleRef)baa, index)); }
public static int boxaaGetBoxCount(this Boxaa baa) { if (null == baa) { throw new ArgumentNullException("baa cannot be null"); } return(Native.DllImports.boxaaGetBoxCount((HandleRef)baa)); }
public static int boxaaExtendArrayToSize(this Boxaa baa, int size) { if (null == baa) { throw new ArgumentNullException("baa cannot be null"); } return(Native.DllImports.boxaaExtendArrayToSize((HandleRef)baa, size)); }
// Boxaa array extension public static int boxaaAddBoxa(this Boxaa baa, Boxa ba, int copyflag) { if (null == baa || null == ba) { throw new ArgumentNullException("baa, ba cannot be null"); } return(Native.DllImports.boxaaAddBoxa((HandleRef)baa, (HandleRef)ba, copyflag)); }
public static int boxaaExtendWithInit(this Boxaa baa, int maxindex, Boxa boxa) { if (null == baa || null == boxa) { throw new ArgumentNullException("baa, boxa cannot be null"); } return(Native.DllImports.boxaaExtendWithInit((HandleRef)baa, maxindex, (HandleRef)boxa)); }
public static int boxaaInsertBoxa(this Boxaa baa, int index, Boxa boxa) { if (null == baa || null == boxa) { throw new ArgumentNullException("baa, boxa cannot be null"); } return(Native.DllImports.boxaaInsertBoxa((HandleRef)baa, index, (HandleRef)boxa)); }
public static int boxaaAddBox(this Boxaa baa, int index, Box box, int accessflag) { if (null == baa || null == box) { throw new ArgumentNullException("baa, box cannot be null"); } return(Native.DllImports.boxaaAddBox((HandleRef)baa, index, (HandleRef)box, accessflag)); }
public static int boxaaJoin(this Boxaa baad, Boxaa baas, int istart, int iend) { if (null == baad || null == baas) { throw new ArgumentNullException("baad, baas cannot be null"); } return(Native.DllImports.boxaJoin((HandleRef)baad, (HandleRef)baas, istart, iend)); }
public static int boxaaWriteStream(IntPtr fp, Boxaa baa) { if (IntPtr.Zero == fp || null == baa) { throw new ArgumentNullException("fp, baa cannot be null"); } return(Native.DllImports.boxaaWriteStream(fp, (HandleRef)baa)); }
public static int boxaaAlignBox(this Boxaa baa, Box box, int delta, out int pindex) { if (null == baa || null == box) { throw new ArgumentNullException("baa, box cannot be null."); } return(Native.DllImports.boxaaAlignBox((HandleRef)baa, (HandleRef)box, delta, out pindex)); }
public static void boxaaDestroy(this Boxaa pbaa) { if (null == pbaa) { throw new ArgumentNullException("pbaa cannot be null"); } var pointer = (IntPtr)pbaa; Native.DllImports.boxaaDestroy(ref pointer); }
public static int boxaaWriteMem(IntPtr pdata, IntPtr psize, Boxaa baa) { if (IntPtr.Zero == pdata || IntPtr.Zero == psize || null == baa) { throw new ArgumentNullException("pdata, psize, baa cannot be null"); } return(Native.DllImports.boxaaWriteMem(pdata, psize, (HandleRef)baa)); }
public static int boxaaWrite(string filename, Boxaa baa) { if (string.IsNullOrWhiteSpace(filename)) { throw new ArgumentNullException("filename cannot be null"); } if (null == baa) { throw new ArgumentNullException("baa cannot be null"); } return(Native.DllImports.boxaaWrite(filename, (HandleRef)baa)); }
/// <summary> /// pixFindWordAndCharacterBoxes() /// </summary> /// <param name="pixs">2, 4, 8 or 32 bpp; colormap OK; typ. 300 ppi</param> /// <param name="boxs">[optional] region to select in pixs</param> /// <param name="thresh">binarization threshold (typ. 100 - 150)</param> /// <param name="pboxaw">return the word boxes</param> /// <param name="pboxaac">return the character boxes</param> /// <param name="debugdir">[optional] for debug images; use NULL to skip</param> /// <returns>0 if OK, 1 on error</returns> /// <![CDATA[ /// * Notes: ///(1) If %boxs == NULL, the entire input image is used. ///(2) Having an input pix that is not 1bpp is necessary to reduce /// touching characters by using a low binarization threshold. /// Suggested thresholds are between 100 and 150. ///(3) The coordinates in the output boxes are global, with respect /// to the input image. /// ]]> public static int pixFindWordAndCharacterBoxes(this Pix pixs, Box boxs, int thresh, out Boxa pboxaw, out Boxaa pboxaac, string debugdir) { if (null == pixs) { throw new ArgumentNullException("pixs cannot be null."); } IntPtr pboxawPtr, pboxaacPtr; var result = Native.DllImports.pixFindWordAndCharacterBoxes((HandleRef)pixs, (HandleRef)boxs, thresh, out pboxawPtr, out pboxaacPtr, debugdir); pboxaw = new Boxa(pboxawPtr); pboxaac = new Boxaa(pboxaacPtr); return(result); }
//Other Boxaa functions public static int boxaaGetExtent(this Boxaa baa, out int pw, out int ph, out Box pbox, out Boxa pboxa) { if (null == baa) { throw new ArgumentNullException("baa cannot be null."); } IntPtr pboxPtr, pboxaPtr; var result = Native.DllImports.boxaaGetExtent((HandleRef)baa, out pw, out ph, out pboxPtr, out pboxaPtr); pbox = new Box(pboxPtr); pboxa = new Boxa(pboxaPtr); return(result); }
public static Boxaa boxaaSelectRange(this Boxaa baas, int first, int last, int copyflag) { if (null == baas) { throw new ArgumentNullException("baas cannot be null."); } var pointer = Native.DllImports.boxaaSelectRange((HandleRef)baas, first, last, copyflag); if (IntPtr.Zero == pointer) { return(null); } else { return(new Boxaa(pointer)); } }
public static Box boxaaGetBox(this Boxaa baa, int iboxa, int ibox, int accessflag) { if (null == baa) { throw new ArgumentNullException("baa cannot be null"); } var pointer = Native.DllImports.boxaaGetBox((HandleRef)baa, iboxa, ibox, accessflag); if (IntPtr.Zero == pointer) { return(null); } else { return(new Box(pointer)); } }
public static Boxaa boxaaTranspose(this Boxaa baas) { if (null == baas) { throw new ArgumentNullException("baas cannot be null."); } var pointer = Native.DllImports.boxaaTranspose((HandleRef)baas); if (IntPtr.Zero == pointer) { return(null); } else { return(new Boxaa(pointer)); } }
public static Boxa boxaaFlattenAligned(this Boxaa baa, int num, Box fillerbox, AccessAndStorageFlags copyflag) { if (null == baa || null == fillerbox) { throw new ArgumentNullException("baa, fillerbox cannot be null."); } var pointer = Native.DllImports.boxaaFlattenAligned((HandleRef)baa, num, (HandleRef)fillerbox, (int)copyflag); if (IntPtr.Zero == pointer) { return(null); } else { return(new Boxa(pointer)); } }
public static Pix boxaaDisplay(this Pix pixs, Boxaa baa, int linewba, int linewb, uint colorba, uint colorb, int w, int h) { if (null == pixs || null == baa) { throw new ArgumentNullException("pixs, baa cannot be null."); } var pointer = Native.DllImports.boxaaDisplay((HandleRef)pixs, (HandleRef)baa, linewba, linewb, colorba, colorb, w, h); if (IntPtr.Zero == pointer) { return(null); } else { return(new Pix(pointer)); } }
public static Pixa pixaDisplayBoxaa(this Pixa pixas, Boxaa baa, int colorflag, int width) { if (null == pixas || null == baa) { throw new ArgumentNullException("pixas, baa cannot be null."); } var pointer = Native.DllImports.pixaDisplayBoxaa((HandleRef)pixas, (HandleRef)baa, colorflag, width); if (IntPtr.Zero == pointer) { return(null); } else { return(new Pixa(pointer)); } }
public static Boxa boxaaFlattenToBoxa(this Boxaa baa, out Numa pnaindex, AccessAndStorageFlags copyflag) { if (null == baa) { throw new ArgumentNullException("baa cannot be null."); } IntPtr pnaindexPtr; var pointer = Native.DllImports.boxaaFlattenToBoxa((HandleRef)baa, out pnaindexPtr, (int)copyflag); pnaindex = new Numa(pnaindexPtr); if (IntPtr.Zero == pointer) { return(null); } else { return(new Boxa(pointer)); } }
public static int pixConvertToPdfDataSegmented(this Pix pixs, int res, int type, int thresh, Boxaa boxa, int quality, float scalefactor, string title, out IntPtr pdata, IntPtr pnbytes) { if (null == pixs) { throw new ArgumentNullException("pixs cannot be null."); } return(Native.DllImports.pixConvertToPdfDataSegmented((HandleRef)pixs, res, type, thresh, (HandleRef)boxa, quality, scalefactor, title, out pdata, pnbytes)); }
public static int convertToPdfDataSegmented(string filein, int res, int type, int thresh, Boxaa boxa, int quality, float scalefactor, string title, out IntPtr pdata, IntPtr pnbytes) { if (string.IsNullOrWhiteSpace(filein)) { throw new ArgumentNullException("filein cannot be null."); } if (!System.IO.File.Exists(filein)) { throw new System.IO.FileNotFoundException("filein does not exist."); } return(Native.DllImports.convertToPdfDataSegmented(filein, res, type, thresh, (HandleRef)boxa, quality, scalefactor, title, out pdata, pnbytes)); }
// 5. Segmented multi-page, multi-image converter public static int convertSegmentedFilesToPdf(string dirname, string substr, int res, int type, int thresh, Boxaa baa, int quality, float scalefactor, string title, string fileout) { if (string.IsNullOrWhiteSpace(dirname)) { throw new ArgumentNullException("dirname cannot be null."); } if (!System.IO.Directory.Exists(dirname)) { throw new System.IO.DirectoryNotFoundException("dirname does not exist."); } return(Native.DllImports.convertSegmentedFilesToPdf(dirname, substr, res, type, thresh, (HandleRef)baa, quality, scalefactor, title, fileout)); }
// 6. Segmented single page, multi-image converters public static int convertToPdfSegmented(string filein, int res, PdfFormattedEncodingTypes type, int thresh, Boxaa boxa, int quality, float scalefactor, string title, string fileout) { if (string.IsNullOrWhiteSpace(filein)) { throw new ArgumentNullException("filein cannot be null."); } if (!System.IO.File.Exists(filein)) { throw new System.IO.FileNotFoundException("filein does not exist."); } return(Native.DllImports.convertToPdfSegmented(filein, res, (int)type, thresh, (HandleRef)boxa, quality, scalefactor, title, fileout)); }
public static int pixConvertToPdfSegmented(this Pix pixs, int res, PdfFormattedEncodingTypes type, int thresh, Boxaa boxa, int quality, float scalefactor, string title, string fileout) { if (null == pixs) { throw new ArgumentNullException("pixs cannot be null."); } return(Native.DllImports.pixConvertToPdfSegmented((HandleRef)pixs, res, (int)type, thresh, (HandleRef)boxa, quality, scalefactor, title, fileout)); }
// Postprocessing public static Sarray recogExtractNumbers(this L_Recog recog, HandleRef boxas, float scorethresh, int spacethresh, out Boxaa pbaa, out Numaa pnaa) { throw new NotImplementedException(); }
public static Pixa showExtractNumbers(this Pix pixs, Sarray sa, Boxaa baa, Numaa naa, out Pix ppixdb) { throw new NotImplementedException(); }