ok what is an IDE?
and i cant change it in the Compot.csproj because it dosent alow me to type in any of the spaces.
and i cant change it in the Compot.csproj because it dosent alow me to type in any of the spaces.
IDE = Integrated Development Environment.. its the program that you use to make the programs.. like Visual Studio C# 2005.Quote:
ok what is an IDE?
and i cant change it in the Compot.csproj because it dosent alow me to type in any of the spaces.
public static void saveUncompressedTiff(Bitmap bild)
{
ImageCodecInfo myImageCodecInfo;
System.Drawing.Imaging.Encoder myEncoder;
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters;
// Get an ImageCodecInfo object that represents the TIFFcodec.
myImageCodecInfo = GetEncoder(ImageFormat.Tiff);
// Create an Encoder object based on the GUID
// for the Compression parameter category.
myEncoder = System.Drawing.Imaging.Encoder.Compression;
// Create an EncoderParameters object.
// An EncoderParameters object has an array of EncoderParameter
// objects. In this case, there is only one
// EncoderParameter object in the array.
myEncoderParameters = new EncoderParameters(1);
// Save the bitmap as a TIFF file with no compression.
myEncoderParameter = new EncoderParameter(myEncoder, (long)System.Drawing.Imaging.EncoderValue.CompressionNone);
myEncoderParameters.Param[0] = myEncoderParameter;
bild.Save("tmp.tif", myImageCodecInfo, myEncoderParameters);
}
public static ImageCodecInfo GetEncoder(ImageFormat format)
{
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
foreach (ImageCodecInfo codec in codecs)
{
if (codec.FormatID == format.Guid)
{
return codec;
}
}
return null;
}
public static bool BottrapFound()
{
// Get the bmp we're gonna read
Bitmap bild = Tools.GetBitmap(MainWindow.BasisX + 486, MainWindow.BasisY + 26, 180, 15);
// Make it twice as big, MODI wont recognize anything otherwise
using (Graphics g = Graphics.FromImage((Image)bild))
g.DrawImage(bild, 0, 0, 360, 30);
// Since MODI seems only be able to read from disk...
// bild.Save("tmp.tif", ImageFormat.Tiff); -> compressed we need uncompressed
saveUncompressedTiff(bild);
System.Threading.Thread.Sleep(500);
// Initialize word(s) we're getting
string strText = "";
bool ReturnValue = false;
// Instantiate the MODI.Document object
MODI.Document md = new MODI.Document();
// The Create method grabs the picture from
// disk snd prepares for OCR.
md.Create(@"tmp.tif");
// Do the OCR.
md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
// Get the first (and only image)
MODI.Image image = (MODI.Image)md.Images[0];
// Get the layout.
MODI.Layout layout = image.Layout;
// Loop through the words.
for (int j = 0; j < layout.Words.Count; j++)
{
// Get this word.
MODI.Word word = (MODI.Word)layout.Words[j];
// Add a blank space to separate words.
if (strText.Length > 0)
{
strText += " ";
}
// Add the word.
strText += word.Text;
}
// Close the MODI.Document object.
md.Close(false);
switch(strText)
{
case "Moon Rabbit":
case "Tamias":
case "Megaloceros":
//MainWindow.AddToProtokoll(strText + " found!");
ReturnValue = true;
break;
default:
break;
}
return ReturnValue;
}