Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Convert a "Colored Image" to "Black and White"

Posted on 2003-02-24
6
Medium Priority
?
2,916 Views
Last Modified: 2012-05-04
hi friends,
i have a requirement to convert a colored image into a Black and white image. the black and white image should have only two colors i.e 255,0,0,0 and 255,255,255,255.
255s and 0s are for BGR.
In the colored image wat appears like Blue to human eye has to be converted to white(255,255,255,255) and other colors to black(255,0,0,0).

Note: Blue does not mean (255,0,0,some_vale).It only means like blue to human eye.

Any help in this regard is widely appreciated.
I will appreciate any help that will help me closer to
the solution.
0
Comment
Question by:swargdwar
5 Comments
 
LVL 1

Accepted Solution

by:
shji1 earned 160 total points
ID: 8008660
Maybe it will help if you have a look at the Java Advanced Imagin package, at: http://java.sun.com/products/java-media/jai/
API at: http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/index.html

--Shaji
0
 

Author Comment

by:swargdwar
ID: 8009211
Can u tell about that particular class in that package.

thanks
0
 
LVL 2

Assisted Solution

by:TheSailor
TheSailor earned 160 total points
ID: 8032052
Ok, for a start, you will need to look at ImageFilters

Look at java.awt.image.ImageFilter

This will allow you to change your incoming pixels to outgoing pixels, which is what you want :-)

For getting pixels which LOOK like blue to the human eye, you can use different approches, which are different in effort.

You can make a (huge) table of colors you define as looking blue... very good but much effort. Then you could
iterate through the table and find your color.

OR

Define all the colors having a blue part much bigger than the other two parts as looking blue; not very exact but could be enough.

E.g.

int IsBlue( int r, int g, int b)
{
   //some color with very high blue
   if ( (b > r + 32) && (b > g + 32) )
     return 1;

   //almost grey, but blue-ish
   if (( r == g ) && (b > r) )
      return 1;

   //something else
   return 0;
}

For other ideas and possible solutions search for "Color perception" on google, maybe there is some other definition how to get to the blue-looking colors.

Cheers
0
 

Expert Comment

by:CleanupPing
ID: 9059119
swargdwar:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9671190
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between shji1 and TheSailor

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question