Skip to content
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

Generalized use case architecture #18

Open
jywarren opened this issue Aug 20, 2019 · 1 comment
Open

Generalized use case architecture #18

jywarren opened this issue Aug 20, 2019 · 1 comment

Comments

@jywarren
Copy link
Member

The initial demo at https://divy123.github.io/colorimetry/public/ is great. It's specific to the use case at publiclab/image-sequencer#979.

How can we generalize the code? Can we adapt it to run on pH strips?

https://duckduckgo.com/?q=ph+test+strip&atb=v121-6&ia=images&iax=images

image

Here is how pH strip comparisons work manually:

image

Maybe pH is too complex as a next step, since it has 4 patches. What about another test that just accepts a min color and a max color, and provides a linear scale between them. So the parameters could be:

color1 (hex)
color2 (hex)
minValue
maxValue
scale (string, "linear" by default for now, eventually maybe exponential, logarithmic, etc)

These could be passed into a constructor like:

// This outputs an object:
var colorimetry = new Colorimetry(color1, color2, minValue, maxValue, scale)

colorimetry.setupUI(); // generates the demo
var output = colorimetry.getValue(color3); // give it a hex value

Something like this for a very basic color comparison?

The initial demo as built would be more like:

colorimetry.compareColors(averageColor1, averageColor2);

Maybe it would need to be compartmentalized somehow, like we load an image into a generic object like:

var image = new ColorimetryImage('url'); // this loads the image into an internal sequencer
var region1 = image.getAverage(x1, y1, h1, w1);
var region2 = image.getAverage(x2, y2, h2, w2);
colorimetry.compareColors(averageColor1, averageColor2);

Or would the all be part of the same object?

I'm just brainstorming a good general-purpose architecture here. What do you think, @Divy123 ? Can this accommodate the original use case, but make it more generalizable to different kinds of colorimetry?

@jywarren
Copy link
Member Author

I could imagine a combination of 3 linear scales as in the first example being used to find a pH value, don't you think?

@jywarren jywarren changed the title Generalized use case Generalized use case architecture Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant