?
Solved

Greyscale or not

Posted on 2001-08-29
6
Medium Priority
?
158 Views
Last Modified: 2010-04-06
hi .. everyone ...
i have a problem here about the algorithm
for classifiying an image into grayscale
image and not. And if there is Delphi
source code please tell me ok ...

Regards,
Billy
0
Comment
Question by:Bilce
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6439498
Now what IS the problem?
A picture is grayscale if for all pixels the R, G and B values are the same.
Making a colored picture grayscale is calculating the brightness of the pixel. A formula which i do not know.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6439502
That is for each pixel R, G and B value of this pixel has to be the same.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 6439731
to convert from color to greyscale:

brightness = (R + G + B) / 3

set R, G, and B to the value in brightness

0
Technology Partners: 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!

 
LVL 6

Accepted Solution

by:
edey earned 150 total points
ID: 6441695
Actually you'd prob. want to at least weight your rgb values, something like this:

brightness := round(sqrt((r*r+g*g+b*b)/3));

Better yet you'd convert to HSV, extract the V & convert back to RGB.  This results in much better contrast & picture quality.  I believe this is because we aren't equaly sensitive to all three primary colours. Here's a pretty good approximation I found at Earl Glynn's site: http://www.efg2.com (great site BTW):

brightness :=((r Shl 5)+(g Shl 6)+(b*12)) Div 108;


GL
Mike
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 6444614
Thanks edey for that HSV formula.  I used it and did notice an improvement.
0
 
LVL 6

Expert Comment

by:edey
ID: 6444764
Excellent, Glad to be of service :)

Gl
Mike
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 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