mercredi 24 juin 2020

Using Else and If statement but doesn't work in C# [closed]

Currently trying to make an OCR in C#, the OCR will convert any image to a text and I want to put it in a string and use an If statement to declare something if the text is equals to a word like Sample but it doesn't seem to work even if the text is equal to Sample the code does not recognize it and continues to the else statement I don't know why sorry I newbie here,

private void button2_Click(object sender, EventArgs e)
    {
        TesseractEngine engine = new TesseractEngine("./tessdata", "eng", EngineMode.Default);
        Page page = engine.Process(img, PageSegMode.Auto);
        
        string ocr = page.GetText();

        if (ocr == "Sample")
        {
            richTextBox1.Text = "GREEN";
        }
        else
        {
            richTextBox1.Text = "RED";
        }

    }

Aucun commentaire:

Enregistrer un commentaire