public static Bitmap WordPosition(Bitmap origImg, Segmentation segmentation, WordPosition wordPosition, Color colour) { Bitmap img = origImg.DeepCopy(); WordPositionInPlace(img, segmentation, wordPosition, colour); return img; }
public static Bitmap WordPosition(Bitmap img, Segmentation segmentation, WordPosition wordPosition) { return WordPosition(img, segmentation, wordPosition, DrawDefaults.DEFAULT_COLOUR); }
public static void WordPositionInPlace(Bitmap img, Segmentation segmentation, WordPosition wordPosition) { WordPositionInPlace(img, segmentation, wordPosition, DrawDefaults.DEFAULT_COLOUR); }
public static void WordPositionInPlace(Bitmap img, Segmentation segmentation, WordPosition wordPosition, Color colour) { //Validation: Check that the image dimensions & segmentation dimensions match if (img.Width != segmentation.Width || img.Height != segmentation.Height) { throw new ArgumentException("Bitmap dimensions do not match Segmentation dimensions"); } //Lock the image for write so we can alter it BitmapData imgData = img.LockBits(new Rectangle(0, 0, img.Width, img.Height), ImageLockMode.WriteOnly, img.PixelFormat); //Draw on the Word Position IntPoint start = getCentrePoint(segmentation, wordPosition.StartRow, wordPosition.StartCol); IntPoint end = getCentrePoint(segmentation, wordPosition.EndRow, wordPosition.EndCol); Drawing.Line(imgData, start, end, colour); img.UnlockBits(imgData); }
public bool Equals(WordPosition wordPosition) { return StartCol == wordPosition.StartCol && StartRow == wordPosition.StartRow && EndCol == wordPosition.EndCol && EndRow == wordPosition.EndRow; }