Java RGB to HSB Conversion: An Introduction

  • Thread starter Thread starter internet user
  • Start date Start date
  • Tags Tags
    Introduction
AI Thread Summary
The discussion centers on the differences between RGB and HSB color models and the process of converting between them, particularly in Java programming. RGB (Red, Green, Blue) is an additive color model, while HSB (Hue, Saturation, Brightness) represents colors in a way that aligns more closely with human perception. A key point raised is that conversions between RGB and HSB cannot be exact due to the nature of the models; for instance, when saturation (S) is zero in HSB, the hue (H) becomes irrelevant, as all shades of grey are represented by the same value. This indicates that there are more RGB values than HSB values for any given bit depth, complicating the conversion process. A Java code example for conversion is referenced, highlighting practical implementation.
internet user
Messages
1
Reaction score
0
I came across HSB for the first time when I was reading a guide on Java. What is the difference between the two, and how do you convert from RGB to HSB (and vice versa)?
 
Technology news on Phys.org
Q: How do I do this thing?
A: Like this: public class DoThisThing extends Applet{

Hmmm...

It occurs to me that such conversions can't be exact. in HSB, if S=0, then H becomes irrelevant. No matter what value is in H, the exact same shade of grey is defined. Because there is no RGB equivalent to this, there are more RGB values then HSB values for any given bit depth.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top