I'm working on the classifying object in the image.
I'm using Marvin Image Processing Framework, and I'm successfully segmenting object, but I want to insert text on the image
This is the output of my image segmentation, and I want to draw text above the object by condition.
For example, I write function that calculate average diagonal of each rectangle, and I insert "bolt" if rectangle's diagonal is larger than average.
However, I couldn't find any method to insert text with using Marvin Image Processing Framework.
This is part of my code:
public Recognition() {
MarvinImage input = MarvinImageIO.loadImage("Parts1.jpg");
MarvinImage copy = input.clone();
filterBlue(copy);
MarvinImage bin = MarvinColorModelConverter.rgbToBinary(copy, 127);
morphologicalClosing(bin.clone(), bin, MarvinMath.getTrueMatrix(30, 30));
copy = MarvinColorModelConverter.binaryToRgb(bin);
MarvinSegment[] marvSeg = floodfillSegmentation(copy);
calculateAvg(marvSeg);
for(int i = 1; i < marvSeg.length; i++)
{
MarvinSegment segment = marvSeg[i];
input.drawRect(segment.x1, segment.y1, segment.width, segment.height, Color.ORANGE);
input.drawRect(segment.x1+1, segment.y1+1, segment.width, segment.height, Color.ORANGE);
if (calcDiag(segment.width, segment.height) > recDiagonalAverage)
{
//draw string "bolt" if current diagonal is larger than average
}
}
MarvinImageIO.saveImage(input, "output.jpg");
}
If I don't have any method to insert with Marvin Image Processing Framework, How can I insert text with these code?