Hi, I decided to use tessnet2 library for my windows mobile project. Unfortunetly while I am trying to compile it, it throws an error:
The best overloaded method match for 'tessnet2.Tesseract.GetThresholdedImage(System.Drawing.Bitmap, System.Drawing.Rectangle)' has some invalid arguments
The type 'System.Drawing.Rectangle' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
The type 'System.Drawing.Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Argument '1': cannot convert from 'System.Drawing.Bitmap [c:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Drawing.dll]' to 'System.Drawing.Bitmap []'
Argument '2': cannot convert from 'System.Drawing.Rectangle [c:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Drawing.dll]' to 'System.Drawing.Rectangle []'
The best overloaded method match for 'tessnet2.Tesseract.DoOCR(System.Drawing.Bitmap, System.Drawing.Rectangle)' has some invalid arguments
ok, I know. Add reference to the assembly. The problem is, that I did it. I add reference by 'Add Reference' in Solution Explorer (System.Drawing), and I even have it declared as 'using System.Drawing'. Intellisense works without any problem. When i write 'rect' it automaticlly shows me the list with 'Rectangle' structure on top.
What is the problem? The assembly is added, even intellisense sees it, why compilator doesn't? :/
here is the code:
using System;
using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;
namespace MPT2 { public partial class Form1 : Form { Ocr ocr;
public Form1()
{
InitializeComponent();
DoIT();
}
public void DoIT()
{
ocr = new Ocr();
using (Bitmap bmp = new Bitmap("no_smoking.jpg"))
{
tessnet2.Tesseract tessocr = new tessnet2.Tesseract();
tessocr.Init(null, "eng", false);
tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save("elo.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
Console.WriteLine("dsadasdasd");
ocr.DoOCRNormal(bmp, "eng");
}
}
}
public class Ocr
{
public void DumpResult(List<tessnet2.Word> result)
{
foreach (tessnet2.Word word in result)
{
Console.WriteLine("{0} {1}", word.Confidence, word.Text);
}
}
public List<tessnet2.Word> DoOCRNormal(Bitmap image, string lang)
{
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.Init(null, lang, false);
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
DumpResult(result);
return result;
}
}
}
It actually the same as on this site .
help please ;/
PS. I am using Windows Mobile SDK 6 standart
.