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 ?
Asked
Active
Viewed 154 times
2
-
there's something called a binary image out there. Any better algorithms to convert an RGB image to a Binary image ? – Sai Nikhil Jul 24 '13 at 13:04
-
1Are 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?" – Jim Mischel Jul 24 '13 at 13:42
-
Basically, if I were taught how to do the later, then I can do the former, using Tesseract-OCR. – Sai Nikhil Jul 24 '13 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 Jul 24 '13 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? – Jim Mischel Jul 24 '13 at 19:26
-
@beaker: am basically an source fan. I hope openCV can do this, please confirm this, I'll go with. If Leptonica also can do this, then its even better, as I need not even combine and mess two open source packages (namely openCV and Tesseract), as Tesseract internally has Leptonica in it :D . All I need is a confirmation (as I don't want to waste much of my time ;)), no need to give the source code even. B) – Sai Nikhil Jul 25 '13 at 11:23
-
@beaker : sorry! that should be **open**source – Sai Nikhil Jul 25 '13 at 13:12
-
Here's a starting point using OpenCV: http://stackoverflow.com/questions/4747920/opencv-rgb-value-for-cvpoint-in-cvmat – beaker Jul 25 '13 at 15:19
1 Answers
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.

Sai Nikhil
- 1,237
- 2
- 15
- 39