2

Let's say I chose a particular weird RGB value for text and let's assume that this does not interfere with the other parts of the image (I mean no other portion of my image which is not my interest does not have this RGB value), Is it possible for me to perform a suitable transformation on the image such that I achieve this ?

8
  • there's something called a binary image out there. Any better algorithms to convert an RGB image to a Binary image ?
    – Sai Nikhil
    Commented Jul 24, 2013 at 13:04
  • 1
    Are you asking how to locate text in the image so that you can change its color? Or are you asking how to locate pixels that have that "weird RGB value?" Commented Jul 24, 2013 at 13:42
  • Basically, if I were taught how to do the later, then I can do the former, using Tesseract-OCR.
    – Sai Nikhil
    Commented Jul 24, 2013 at 15:44
  • Sure, just loop through all of the pixels in the image. If the value of a pixel equals your "weird RGB value", set it to your desired foreground value. If not, set it to your desired background value. Knowing what language/libraries you're using to process the images would help. For instance, this would be a one-liner in Matlab.
    – beaker
    Commented Jul 24, 2013 at 16:17
  • Your question is unclear. You ask if it's possible to achieve something, but you don't say specifically what it is. Do you have an image in which the text rendered with a unique RGB value that does not occur anywhere else in the image? If so, what do you want to do? Locate the (x,y) coordinates of each text pixel? Commented Jul 24, 2013 at 19:26

1 Answer 1

1

Read the image with standard official library (for example libpng for png, libjpeg for jpeg etc.,) and modify the values of row_pointers returned and write them back to a new file.

Simple Kids Stuff :)

Will put up the link for source code soon.

Not the answer you're looking for? Browse other questions tagged or ask your own question.