Craig - After a closer inspection of PDL::Transform and a refresher on my code, I don't think it would be good to implement this using PDL::Transform. Wrapping the conversion into a transform would make sense, but not implementing it as a PDL::Transform. HSV -> RGB involves a very confusing six-way branch with calculations from derived values. I only vaguely understand the logic myself; it's based on a writeup I read on wikipedia. You could do this using PDL, but the calculation that would either involve Perl-level loops or be awkwardly and inefficiently represented with conditional expressions like this:
my $result = ($a < $b) * ($a * 360) + ($a > $b) * ($b * 360); The conditionals and calculations would be even more complicated that what's shown here. That's an awful lot of temporaries, and five of every six calculations would be thrown away. However, it *would* make sense to wrap the current RGB->HSV in a transform, so that it could be easily composed with other transforms. David On Wed, Jan 11, 2012 at 10:50 AM, David Mertens <[email protected]>wrote: > Hmmm, perhaps I should finally read the docs on PDL::Transform. There are > *so* many parts of PDL about which I know little to nothing. > > > On Wed, Jan 11, 2012 at 10:46 AM, Craig DeForest < > [email protected]> wrote: > >> This type of conversion is a natch for a PDL::Transform subclass... >> >> >> On Jan 11, 2012, at 9:20 AM, Maggie X wrote: >> >> Sure, I can add them. Not sure I have committer status though :) Haven't >> worked on PDL proper yet. >> >> Maggie >> >> On Wed, Jan 11, 2012 at 11:06 AM, David Mertens <[email protected] >> > wrote: >> >>> Maggie - >>> >>> >>> On Tue, Jan 10, 2012 at 9:42 PM, Maggie X <[email protected]> wrote: >>> >>>> Hi David, >>>> >>>> Your code converts between HSV and RGB. But it's not that different to >>>> convert between HSL and RGB. >>>> >>> >>> Oh, sorry! All these nearly-identical acronyms get me confused. >>> >>> Chris suggested that I add the HSL and RGB conversion to PDL::ImageRGB. >>>> What do you think of putting the HSV and RGB conversion in PDL::ImageRGB? >>>> >>> >>> Having these generally available makes a lot of sense to me. Do you want >>> to add them, or shall I? >>> >>> Best, >>>> Maggie >>>> >>> >>> Regards, >>> David >>> >> >> _______________________________________________ >> Perldl mailing list >> [email protected] >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> >> >> > > > -- > Sent via my carrier pigeon. > -- Sent via my carrier pigeon.
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
