?
Solved

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

Posted on 2003-02-24
6
Medium Priority
?
2,906 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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