Highest readability Text on picture based on the colors of the picture

Hey, i am programming a Plugin for ImageJ. I have a subtitle and the color of the subtitle must have the highest readability. I have to analyze the colors of the picture and then i have to colorize the subtitle. I am not allowed to use a contour. Is it possible to compare the pixels of the picture with the pixel of the subtitle in the near? Or how would you do it?

Thanks for your help :slight_smile:

If you’re creating a subtitle within Fiji, you use the Text tool and define a bounding box.

You could use that bounding box to extract the histogram of that region in the image and use a metric from that, for example the mode, in order to make a decision.

Wouldn’t a simpler approach be to have a single color background box behind your text and keep the text the same color?

Best

Oli

Hey, thanks for your answer. Its for my university and i have to programm a new plugin. I am not allowed to use macros or anything. My Plugin should work with every picture. So a single color Background isnt an option :confused: