-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channel selectors #5
Comments
We should avoid writing a custom DSL if possible. I think we can do a lot with standard options
If the constructs become complex enough to warrant a DSL, s-expressions +1. But let's shoot for standard command line options first. Related question, are we planning on exposing raw gamma and sigmoidal functions at the command line? The current interface is built entirely around the atmospheric correction function and doesn't expose the lower-level functions. Are we planning on adding those? Replacing the atmoshperic correction with low level constructs? Separate subcommand? Let's talk through the interface... |
👍 I like that optional channel parameter style, @perrygeo.
Yes (is what I’ve been assuming). In fact, I think the simple atmospheric correction may be more high-level than what we want to expose by version 1.0. Maybe it belongs as a wrapper function outside I think it makes sense to pitch
Rationale: Arithmetic functions aren’t at the conceptual level of color, and you might as well do them on raw numpy arrays. Conversely, for something as messy as atmospheric correction (for non-satellite readers: e.g., e.g.), So on reflection (heh), I think it was unwise of me to put I’d defer to a stronger vision – this is just what I have in mind today. |
@celoyd What about repurposing the Another wrinkle is that we developed the landsat training set based on the a, b, c parameters for atmospheric correction. If we are shifting gears on rio color, we may need to change our approach to the training data as well. |
@celoyd what about order of operations? My understanding is that imagemagick performs them from left to right. In our pxm-sources it looks like we always apply the gamma before sigmoidal contrast. Can we assume that we'll always do gamma correction first in |
Also, the Do we need to add modulate in additional to gamma and sigmoidal contrast? |
No. I’ve tried to do that as a convention in pxm-sources, but different order would be important for other applications. I definitely favor left-to-right. |
Hrm, so We could
|
So I'm moving forward with option 2 - which is to accept ordered arguments rather than options. It results in a sort of mini-DSL that requires a bit of parsing and validation but will ultimately be much more flexible. Here's the working idea:
|
@virginiayung and I want a syntax and mechanism for
rio color
to apply given operations only to selected channels. For comparison, ImageMagick’sconvert
works like this:convert input.tif -channel G -gamma 1.5 -channel B -gamma 0.5 -sigmoidal-contrast 3,50% -channel RGB output.tif
Which is something like this in pseudocode:
Implicitly, R is passed through. It amounts to a simple system for creating blocks of operations.
I don’t love the
convert
syntax (for example, it’s easy to forget to switch back to RGB at the end) but it seems to mostly work. I wonder about something maybe more like this:rio color 'G(gamma 1.6) B(gamma 0.5, sigmoid 3 50)' input.tif output.tif
Or maybe full s-expressions, or…?
The text was updated successfully, but these errors were encountered: