C# C Webrequest上载文件并继续
如何将简单图像上载到www.newocr.com,从下面的组合框中选择一种语言,单击“上载”按钮,在“OCR”按钮之后,最终从源代码中获取字符串,该源代码将字符串存储到id中 都是程序化的。有什么帮助吗?请点击以下链接: 这可以帮助您:: 试试这个:C# C Webrequest上载文件并继续,c#,file,upload,webrequest,C#,File,Upload,Webrequest,如何将简单图像上载到www.newocr.com,从下面的组合框中选择一种语言,单击“上载”按钮,在“OCR”按钮之后,最终从源代码中获取字符串,该源代码将字符串存储到id中 都是程序化的。有什么帮助吗?请点击以下链接: 这可以帮助您:: 试试这个: Bitmap BWImage = new Bitmap(fileName); // Lock destination bitmap in memory System.Drawing.Imaging.BitmapData BWLockImage =
Bitmap BWImage = new Bitmap(fileName);
// Lock destination bitmap in memory
System.Drawing.Imaging.BitmapData BWLockImage = BWImage.LockBits(new Rectangle(0, 0, BWImage.Width, BWImage.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed);
// Copy image data to binary array
int imageSize = BWLockImage.Stride * BWLockImage.Height;
byte[] BWImageBuffer = new byte[imageSize];
Marshal.Copy(BWLockImage.Scan0, BWImageBuffer, 0, imageSize);
DoOCR(BWLockImage, BWImageBuffer, tmpPosRect, false);
// Do the OCR with this function
public string DoOCR(System.Drawing.Imaging.BitmapData BWLockImage, byte[] BWImageBuffer, Rectangle iAusschnitt, bool isNumber)
{
Bitmap tmpImage = Bildausschnitt1bpp(BWLockImage, BWImageBuffer, iAusschnitt);
string file = Path.GetTempFileName();
string tmpResult = "";
try
{
tmpImage.Save(file, ImageFormat.Tiff);
_MODIDocument.Create(file);
// Modi parameter erstellen
_MODIDocument.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, false, false);
MODI.IImage myImage = (MODI.IImage)_MODIDocument.Images[0]; //first page in file
MODI.ILayout myLayout = (MODI.ILayout)myImage.Layout;
tmpResult = myLayout.Text;
}
catch
{
if (_MODIDocument != null)
{
_MODIDocument.Close(false); //Closes the document and deallocates the memory.
_MODIDocument = null;
}
// Bild freigeben
tmpImage.Dispose();
tmpImage = null;
// Garbage Collector ausführen
GC.Collect();
// Bilddatei löschen
File.Delete(file);
}
return tmpResult;
}
事实上,我想申请那个网站。如果有人知道,就在这里写代码,我正在做一个项目,这是我最后仍然需要做的事情。所以,让我知道。我看到了网站:www.newocr.com有一个特定的语言字符识别,这使我可以更容易地从图像中获取字符串,但我被困在了web请求中。请有人需要帮我做这个网站的请求。首先在这个网站上传你的ocr图像,然后选择你的语言,第三次点击上传图像按钮,然后检查你的结果,通过firefox篡改数据,但是我应该如何在c中实现这一点?有任何帮助吗?我在这方面非常迟钝,我真的需要网络请求这个网站,对我来说是非常重要的。。。