Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/05/10 12:02
Read: times


 
#176414 - Standard interpolation
Responding to: ???'s previous message
The index into a color table is not a good way to slowly change between two colors, since the index is just a number - it doesn't really relate to the physical properties of the color.

Decide on a start color and an end color as RGB values.

Start: R = 255, G = 0 B = 0.
End: R = 170, G = 90, B = 10.

Decide how many steps to go from first color to second color. There is no use to have many steps if you have very few instensity levels available for each primary color - you are already using PWM so you can't use PWM to interplate between the PWM steps.

Let's say you want 4 steps.

That means:

Step 0: 255 0 0
Step 1: 233 22 2
Step 2: 212 45 5
Step 3: 191 67 7
Step 4: 170 90 10

But you have only 5 levels available for each primary, meaning 0, 64, 128, 192, 255.

So you have to find the alternatives with the least errros.

Step 0: 255 0 0 is a perfect match
Step 1: 233 22 2 -> 255 0 0 (the step was too small compared to available intensities)
Step 2: 212 45 5 -> 192 64 0
Step 3: 191 67 7 -> 192 64 0
Step 4: 170 90 10 -> 192 64 0

As you can see - the interpolation into steps is only meaningful if the start and end colors have a large change in the color channels, in relation to the available number of steps for the primary colors. In my example, the color would jump instantly from a start color with perfect match to an end color with a quite bad match. You really should try to get your PWM solution to support more steps than 5/primary channel. Of course, this means that you can't store a color as an 8-bit value.

Another thing here is that the above is an example of interpolation in RGB space. That is ok if the start and end color only changes one color channel at a time. But when two or all three color channels are changing between start and end color, then the RGB interpolation isn't so beautiful. It interpolates in a color cube. Moving from one strong color to another strong color can then result in intermediate gray colors, or at least colors with very little saturation.

It is then better to convert the start and end colors into a HSV cone shape. Now you can interpolate an angle, allowing you to keep up the saturation while just changing the hue or value. See illustration 2b in:
http://en.wikipedia.org/wiki/HSL_and_HSV


List of 120 messages in thread
TopicAuthorDate
IRF640 noob test            01/01/70 00:00      
   Gate current            01/01/70 00:00      
   "empirical" learning...            01/01/70 00:00      
      read the material...            01/01/70 00:00      
         I believe he is using a MOSFET here            01/01/70 00:00      
            kit            01/01/70 00:00      
               It is DC output            01/01/70 00:00      
               POOF BOOM            01/01/70 00:00      
   what about this circuit?            01/01/70 00:00      
   IRFZ48N and a circuit, this one can fit?            01/01/70 00:00      
      A little bit easier link            01/01/70 00:00      
         Thanks Per            01/01/70 00:00      
            The longest road from a to b            01/01/70 00:00      
               The problem is...            01/01/70 00:00      
                  Sorry            01/01/70 00:00      
                     Hope, you will find the time...            01/01/70 00:00      
                        RGB Controller            01/01/70 00:00      
                           do you need it that bright            01/01/70 00:00      
                              Bar and some info            01/01/70 00:00      
                                 sure you can            01/01/70 00:00      
                                    Hard to adjust intensity by changing voltage            01/01/70 00:00      
                           Simple scheme...            01/01/70 00:00      
                              Very nice!            01/01/70 00:00      
                                 HC32 and not KTC32            01/01/70 00:00      
                                 Answers...            01/01/70 00:00      
                                    maybe another CI?            01/01/70 00:00      
                                       Yes most hc is ok            01/01/70 00:00      
                                          Same HCs to switch ULN2803?            01/01/70 00:00      
                                       Logic Level MOSFET            01/01/70 00:00      
                     you can - wth a caveat            01/01/70 00:00      
   Can I ask a color question?            01/01/70 00:00      
      Start a new thread            01/01/70 00:00      
         Interpolate in RGB or HSV but not in your tabulated index.            01/01/70 00:00      
            linear interpolations...            01/01/70 00:00      
               Standard interpolation            01/01/70 00:00      
                  that depends            01/01/70 00:00      
         right subject            01/01/70 00:00      
      your premises are wrong            01/01/70 00:00      
      If you answer a question...            01/01/70 00:00      
         Just tests, no MOSFETs yet...            01/01/70 00:00      
            The ULN2803 will ruin your colors!            01/01/70 00:00      
               when doing color            01/01/70 00:00      
               miss the point... the point is the color generation...            01/01/70 00:00      
                  Help with what?            01/01/70 00:00      
                  already answered            01/01/70 00:00      
                  Have you seen my link?            01/01/70 00:00      
                     Yes, but dont helps...            01/01/70 00:00      
                        as usual            01/01/70 00:00      
                           not "SPECIFIC, SPECIFIC, SPECIFIC"            01/01/70 00:00      
                              Use another look-up table...            01/01/70 00:00      
                                 Thats it!            01/01/70 00:00      
                                    Copy from a professional solution...            01/01/70 00:00      
                                       Youtube has some nice videos...            01/01/70 00:00      
                              you've got it wrong and what are you doing            01/01/70 00:00      
                                 I care Erik!            01/01/70 00:00      
                                    why are you "going through steps"?            01/01/70 00:00      
                                       Kai videos?            01/01/70 00:00      
                                          Already been told            01/01/70 00:00      
                                             HSV            01/01/70 00:00      
                                                Now I'm confused            01/01/70 00:00      
                                                   Still never telling what you do want            01/01/70 00:00      
                                                      you are going for an intensity ratio ...            01/01/70 00:00      
                                                      I see no contradiction...            01/01/70 00:00      
                                                         I think it was incrementing of the index that was the proble            01/01/70 00:00      
                                                            Chico, are you getting it            01/01/70 00:00      
                                                               Words            01/01/70 00:00      
                                                                  He should have enough information now...            01/01/70 00:00      
                                                                     that is often the problem ...            01/01/70 00:00      
                                                                        Words fail me...            01/01/70 00:00      
                                                                  How to add            01/01/70 00:00      
                                                                     You don't have paletted device so stop thinking about index            01/01/70 00:00      
                                                                        only 125 colors            01/01/70 00:00      
                                                                           Smooth? Sudden? This make no sense!            01/01/70 00:00      
                                                                              I'm tired from guessing, Chico...            01/01/70 00:00      
                                                                           So you haven't read what we have posted?            01/01/70 00:00      
                                                         Thats it Kai...            01/01/70 00:00      
                                                            place my 125 unchangeable colors in a nice sequence in this            01/01/70 00:00      
                                                               Lacks words for me!            01/01/70 00:00      
                                                                  You need more levels.            01/01/70 00:00      
                                                                  See previous suggestions!            01/01/70 00:00      
                                                            only 32 words            01/01/70 00:00      
                                                            what is "nice sequence"? and for what purpose?            01/01/70 00:00      
                                                            A Color Sequence            01/01/70 00:00      
                                                               Gives color jumps            01/01/70 00:00      
                                                                  Missing backslash in previous post            01/01/70 00:00      
                                                                  Look at the example cited earlier            01/01/70 00:00      
                                                                     not a good one            01/01/70 00:00      
                                                                        Starting point?            01/01/70 00:00      
                                                                           my thought is            01/01/70 00:00      
                                                                              Did I get you?            01/01/70 00:00      
                                                                                 sort of            01/01/70 00:00      
                                                                                    Thanks!            01/01/70 00:00      
                                                                                    You are so full of yourself...            01/01/70 00:00      
                                                                                       "web safe" colors available in standard VGA color palette            01/01/70 00:00      
                                                                                          right, you compensate for this by ...            01/01/70 00:00      
                                                                                             Note that candela hides the eyes spectral response            01/01/70 00:00      
                                                                                                true, and            01/01/70 00:00      
                                                                                                   But he doesn't want his solution to be better - just differe            01/01/70 00:00      
                                                                                                      I give up suggesting better and simpler ...            01/01/70 00:00      
                                                                                       with "binary weighing" he gets 32738 colors            01/01/70 00:00      
                                                                                          Number of colors            01/01/70 00:00      
                                                                                             for a LED sign: none            01/01/70 00:00      
                                                                                             Solve modulation first, then bother about constant-intensity            01/01/70 00:00      
                                                                                                not if you do as I suggested            01/01/70 00:00      
                                                                                                   You'll see a lot if slow-stepping changes            01/01/70 00:00      
                                                                                       How naive I was...            01/01/70 00:00      
                                                                                          I do not know, but ...            01/01/70 00:00      
                                                                                             I still say...            01/01/70 00:00      
                                                                                          Everything depends on needs - simplification often ok            01/01/70 00:00      
                                                                                             Gamma            01/01/70 00:00      
                                                                                             If I were Chico...            01/01/70 00:00      
                                                                     Another Color Sequence...            01/01/70 00:00      
                                                                        Yet another sequence...            01/01/70 00:00      
                                                                           another (better) approach            01/01/70 00:00      
                                                               Oops....Sawtooth File Deleted            01/01/70 00:00      
                                                                  On its way...            01/01/70 00:00      
                                                                     Received and RePosted            01/01/70 00:00      
                                                                        RE: wake up the cat            01/01/70 00:00      
                                                                           Walking the RGB cube as described earlier            01/01/70 00:00      
                                                                              the way to do it            01/01/70 00:00      

Back to Subject List