Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I am using following code that is working for mostly images but i have some special kinds of images which have italic text and tiff extension. in that case code is not working.
Code::
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4
    {
    public partial class Form1 : Form
        {
        string extractedText = string.Empty;
        string getFileName;

        public Form1()
            {
            InitializeComponent();
            }

        private void button2_Click(object sender, EventArgs e)
            {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {

                getFileName = openFileDialog1.FileName;

                Image targetImage = Image.FromFile(getFileName);

                targetImage = fitInPBox(targetImage);

                pBox.Image = targetImage;

                }
            }
        //This function fit the browsed image in picture box
        private Image fitInPBox(Image img)
            {
            Bitmap image = new Bitmap(img, new Size(pBox.Size.Width, pBox.Size.Height));

            return (Image)image;
            }

        private void button1_Click(object sender, EventArgs e)
            {
            richTextBox1.Text = string.Empty;
            MODI.Document doc = new MODI.Document();
            doc.Create(getFileName);
            doc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
            MODI.Image img = (MODI.Image)doc.Images[0];
            MODI.Layout layout = img.Layout;

            for (int i = 0; i < layout.Words.Count; i++)
                {
                MODI.Word word = (MODI.Word)layout.Words[i];

                if (extractedText.Length > 0)
                    {
                    extractedText += " ";
                    }

                extractedText += word.Text;
                richTextBox1.Text = extractedText;
                }
            }

        private void Form1_Load(object sender, EventArgs e)
            {

            }
        }
    }




Special Image URL

Please help me..
Thanks in advance

[edit]Code block added, code formatted, Link converted to a proper link - OriginalGriff[/edit]
Posted
Updated 4-Feb-12 3:40am
v2
Comments
Amir Mahfoozi 4-Feb-12 9:47am    
It seems that it is a serious problem that you ask it in many places :
http://www.c-sharpcorner.com/Forums/Thread/160196/extract-text-from-tif-images-in-which-text-are-in-italic-fon.aspx

1 solution

You need to talk to whoever provides your OCR library and ask them for help, you may be hitting a limit of that library.

You certainly can't expect help if you don't tell us what libraries you are using.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900