p-v-o-s / infragram-js

A web application for producing NDVI and other composites from DIY multispectral cameras
http://infragram.org
GNU General Public License v2.0
25 stars 11 forks source link

Generate "presets" like NDVI, NGB by populating infragrammar fields and running infragrammar function #14

Closed dwblair closed 10 years ago

dwblair commented 11 years ago

As per @jywarren 's idea: "It'd also be interesting/nice if each of the presets actually just ran an Infragrammar expression, and populated the Infragrammar fields so you could see how they are built. Presets could also be a dropdown menu instead of a button group."

I'm starting to feel my way around Javascript, and I gave this a shot for "NGB" in a branch I called "ngb":

https://github.com/Pioneer-Valley-Open-Science/infragram-js/tree/ngb

-- anyone care to try it out and see if it works for them? Please excuse my ugly javascript.

(Also -- is creating branches in this manner a good option re: testing out new code?)

jywarren commented 11 years ago

yes, it is - and if you want to pull a variety of branches onto infragram.org/static/sandbox-branches/foo/ or something we can give things a spin real quick too. Or just pull it into the dev channel at /sandbox-dev/ for folks to test out. I'd do it myself but again... need to go to bed :-P

On Wed, Aug 21, 2013 at 10:49 PM, dwblair notifications@github.com wrote:

As per @jywarren https://github.com/jywarren 's idea: "It'd also be interesting/nice if each of the presets actually just ran an Infragrammar expression, and populated the Infragrammar fields so you could see how they are built. Presets could also be a dropdown menu instead of a button group."

I'm starting to feel my way around Javascript, and I gave this a shot for "NGB" in a branch I called "ngb":

https://github.com/Pioneer-Valley-Open-Science/infragram-js/tree/ngb

-- anyone care to try it out and see if it works for them? Please excuse my ugly javascript.

(Also -- is creating branches in this manner a good option re: testing out new code?)

— Reply to this email directly or view it on GitHubhttps://github.com/Pioneer-Valley-Open-Science/infragram-js/issues/14 .

bgamari commented 11 years ago

While I see the utility of the infragrammar functionality, I can't help but think it's not quite the right level of abstraction for a scientific imaging analysis platform. Namely, I really can't figure out a consistent way to expose both convenient colormapping (e.g. mapping from RGB space to some scalar space, e.g. NDVI, and then mapping that scalar back to RGB space) and the flexibility of infragrammar. While this can lead to some very nice looking pictures, I think a large fraction of the (semi-)quantitative applications of the tool will primarily want colormapping due to ease of interpretation.

On a slightly related note, one thing I've been interested in trying is to implement an SVD-based transform to project an image into its eigenspace. I've noticed that Ned has used similar methods and it seems like it might be a more reproducible way arrive at informative colorspace remappings. One of the Javascript CV libraries that Don mentioned earlier has some linear algebra routines that will be handy for this.

jywarren commented 11 years ago

In the sense that colormapping would have to span multiple infragrammatical input boxes, and it's hard to spread a single expression amongst R,G, and B, i agree. But the big threshold is between deriving meaning with the image data and generating an output representation of that meaning. Is Infragrammar good at deriving meaning, but not at generating output?

What you could choose the colorspace you input your R,G,B terms into, for example HSV, in which it'd be quite easy to make a colormap?

On Wed, Aug 21, 2013 at 11:35 PM, Ben Gamari notifications@github.comwrote:

While I see the utility of the infragrammar functionality, I can't help but think it's not quite the right level of abstraction for a scientific imaging analysis platform. Namely, I really can't figure out a consistent way to expose both convenient colormapping (e.g. mapping from RGB space to some scalar space, e.g. NDVI, and then mapping that scalar back to RGB space) and the flexibility of infragrammar. While this can lead to some very nice looking pictures, I think a large fraction of the (semi-)quantitative applications of the tool will primarily want colormapping due to ease of interpretation.

On a slightly related note, one thing I've been interested in trying is to implement an SVD-based transform to project an image into its eigenspace. I've noticed that Ned has used similar methods and it seems like it might be a more reproducible way arrive at informative colorspace remappings. One of the Javascript CV libraries that Don mentioned earlier has some linear algebra routines that will be handy for this.

— Reply to this email directly or view it on GitHubhttps://github.com/Pioneer-Valley-Open-Science/infragram-js/issues/14#issuecomment-23066440 .

dwblair commented 11 years ago

Ben -- the SVD-based methods sound really intriguing -- and it'd be nice to have some linear algebra routines to play with. Shall we create a branch / new repo to start playing around with those CV libraries?

Jeff -- the HSV idea sounds cool ...

Both -- I think I'm starting to get the hang of this 'branching' thing. I pulled the 'ngb' branch into http://infragram.org/static/sandbox-dev/ if you wanna check it out ...

bgamari commented 11 years ago

I was first going to do some exploratory work in Python first. Python has a more mature set of tools for this sort of thing and is much easier to play around with. Until we know exactly what methods might be useful I'd say it's not worth investing the time into a web-based implementation..

dwblair commented 11 years ago

Ah, that's cool too! and I think pretty much anything you work up in python can be hooked into into the infragram-flask app ...

jywarren commented 10 years ago

ok, NIR preset is now an infragrammar expression in my repo. To do this to NDVI, especially colormapped NDVI, will be harder. One possibility is to make colormapping a post-processing step, where we'd have a dropdown of different LUTs (look up tables) available. This might be a lot simpler than continuing to mess with HSV, but that depends on how your brain works :-P

jywarren commented 10 years ago

OK, i've abstracted out the "colorify" function so you can now call update() with mode = "colorify" which will manually run the colorify function (with the current colormap) on any monochrome image. for testing, i've put the new button next to the Monochrome Infragrammar input, so it can only be used with that. Webgl code also not implemented yet.

I'm doing something wrong though -- it works when i manually run jsHandleOnClickColorify() but i can't get the #colorify button to run that command... maybe i'm munging the handler code?

https://github.com/jywarren/infragram-js/commit/19bcc25fe8a3ffbe344065c1dc4b8fa321877c6a