View Single Post
  #2   Spotlight this post!  
Unread 07-04-2012, 16:52
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: incorrect subtraction in get color pixel value

I suspect that the math is being done with an unsigned 8 bit integer. In that system, 0 - 1 is equal to 255. Strange, and that is why integers are a bit of a risky tradeoff. To check this, do the math as normal, then add or subtract 256 to the number to get it back into the range of 0 to 255. That is the result that you will get with unsigned numbers.

Greg McKaskle
Reply With Quote