Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2004

Tip: Looking for answers? Try searching our database.

Formula help

Thread view: 
Maverick - 12 Apr 2004 21:17 GMT
hi
i was wondering would anyone know how to implement this formula for
converting RGB to YCrCb in java

Y  =   0.299 R + 0.587 G + 0.114 B
Cb = - 0.169 R - 0.331 G + 0.500 B
Cr =   0.500 R - 0.419 G - 0.081 B

If anyone knows how to do this or has done it in the past could you
please let me know. thanks
Eric Sosman - 12 Apr 2004 21:33 GMT
> hi
> i was wondering would anyone know how to implement this formula for
[quoted text clipped - 6 lines]
> If anyone knows how to do this or has done it in the past could you
> please let me know. thanks

   Insert asterisks `*' to indicate multiplications,
and end each statement with a semicolon `;'.

Signature

Eric.Sosman@sun.com

Roedy Green - 12 Apr 2004 22:55 GMT
> Y  =   0.299 R + 0.587 G + 0.114 B
>Cb = - 0.169 R - 0.331 G + 0.500 B
>Cr =   0.500 R - 0.419 G - 0.081 B

I am puzzled by your question since the answer requires only the most
rudimentary knowledge of Java.  If you could not do this, you could
not do the many more difficult things that need to go around it.  So
perhaps I misinterpreted your question.

double y =   0.299 * r + 0.587 * g  + 0.114 * b;
double cb = - 0.169 * r  - 0.331 * g + 0.500 * b;
double cr =   0.500 * r - 0.419 * g  - 0.081 * b;
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Maverick - 13 Apr 2004 11:45 GMT
> > Y  =   0.299 R + 0.587 G + 0.114 B
> >Cb = - 0.169 R - 0.331 G + 0.500 B
[quoted text clipped - 8 lines]
> double cb = - 0.169 * r  - 0.331 * g + 0.500 * b;
> double cr =   0.500 * r - 0.419 * g  - 0.081 * b;

Thanks for that i am trying to convert to YCrCb using that fornula and
using 2-arrays and then be able to display the Cb part of the image.
from there i want to be able to change some of the pixels within the
cb . thats what im trying to do sorry i didnt specify the question
correctly if you have any input to how you would code this i would be
very grateful.
Roedy Green - 14 Apr 2004 05:01 GMT
>Thanks for that i am trying to convert to YCrCb using that fornula and
>using 2-arrays and then be able to display the Cb part of the image.
>from there i want to be able to change some of the pixels within the
>cb . thats what im trying to do sorry i didnt specify the question
>correctly if you have any input to how you would code this i would be
>very grateful.

Write a java.awt.image.ColorModel.  Look at the source for some
examples.  Once you have that, the methods of Image will do what you
need.

see http://mindprod.com/jgloss/image.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.