I am working on OCR project for my local language named Amharic and I want to detect and remove underline from the document image....I have the following code but it can only work for a single word image....so can anyone tell me how to do it using projection profile for the whole text document?

```
class UnderLineRemoval
{
    public static Bitmap removeUnderline(Bitmap bm)
    {
        //declarations
        List<int> rowSum = new List<int>();
        int count = 0;
        int roi = bm.Height / 2;
        Color pixelColor;

        //perform  horizontal projections for points below roi
        for (int y = roi; y < bm.Height; y++)
        {
            for (int x = 0; x < bm.Width; x++)
            {
                pixelColor = bm.GetPixel(x, y);

                if (pixelColor.R == 0 && pixelColor.G == 0 && pixelColor.B == 0)
                    count++;
            }
            rowSum.Add(count);
            count = 0;
        }

        // check if the sums are greater than 70% of the image width
        for (int i = 0; i < rowSum.Count; i++)
        {
            if (rowSum[i] > bm.Width * 0.7)
            {
                break;
            }
            roi++;
        }

        // return if no underline are detected
        if (roi == bm.Height )
            return bm;

        // crop image if underline are detected
        Rectangle cropRect = new Rectangle(0, 0, bm.Width, bm.Height - ((bm.Height )-(roi - 2)));

        if (cropRect.Height ==0 && cropRect.Y == 0)
            return bm;

        bm = bm.Clone(cropRect, bm.PixelFormat);

        return bm;
    }
}

```