What steps should I follow to transform SRM into L*a*b* values using the E-308 algorithm?

I'm grappling with the application of ASTM E-308 to SRM measurements in beer. The project I'm working on necessitates a reliable conversion from SRM to RGB (or sRGB) through the Lab* route. It's clear that each site I visit for beer recipe creation has its own unique SRM to RGB conversion method, given the complexity of the task. To address this issue, I am considering developing an open-source JavaScript library to tackle this challenge.

My approach involves using an algorithm outlined here:

This algorithm is believed to be a simplified version of the E-308 algorithm. However, I'm facing difficulty when referencing the spreadsheet provided in the linked post (). Selecting a XYZ vector based on the observer angle specified in the spreadsheet (such as a 10-degree observer angle) raises questions. For instance, if I opt for a 10-degree observer angle, should the corresponding XYZ vector be (82.82, 3.48, 61.86)? Is this calculation correct?

Additoinally, choosing an illuminant spectrum adds another layer of complexity. If I choose illuminant C (presumed to have a color temperature of 6774K), how do I determine and incorporate the appropriate components into the spectrum? How are these components calculated in the first place?

While I have some understanding of color theory, what I truly aim for is a streamlined process where I can input certain criteria like observer angle, illuminant color temperature, as well as the SRM value, and obtain the corresponding Lab* value.

Answer №1

This particular issue requires an answer that may not align with the usual format of Stack Overflow.

ASTM E308 is a detailed and lengthy standard spanning around 50 pages, primarily focusing on converting spectral distribution to CIE XYZ tristimulus values. It also delves into conversions to CIE Lab and CIE Luv.

The spreadsheet mentioned in your query does not fully adhere to ASTM E308 and takes liberties by utilizing the integration method for 5 nm measurement intervals without including a table of tristimulus weighting factors necessary in case of bandpass corrected spectral data. While suitable for practical purposes, it's crucial to note that precision demands strict adherence to ASTM E308.

The complexity of the spreadsheet arises from its utilization of the Augmented SRM computation involving eigen-vectors for numerous beers.

Should you be inclined towards applying the ASBC method, this should be your course of action:

  • Determine the beer transmission spectral distribution based on the given SRM and path length using the provided equation

  • Convert the spectral distribution to CIE XYZ tristimulus values using the integration method for the CIE 1964 10 Degree Standard Observer and Illuminant C
  • Further convert the CIE XYZ tristimulus values to CIE Lab
  • Additionally, convert them to sRGB
  • And finally, enjoy the beer :)

If Python is within your reading spectrum, a Colab notebook has been crafted which employs Colour to compute beer color across various SRM values and path lengths:

(Python code snippet here)

A suggestion is made regarding the ease of implementing Colour within a container through Flask in the backend, which can then be accessed via Javascript. Moreover, an advanced 3D visualizer is available if exploring that avenue appeals to you.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

React web app experiencing an issue with MUI Drawer opening flawlessly but failing to close

Recently, I encountered an issue with my React app. I have a Navbar component that displays a Sidebar component when the screen is small, using Material UI for the Drawer functionality. The problem arises when clicking the hamburger icon to open the drawe ...

Adjust the content size to 100% based on the quantity of items in a row

I've been having a hard time creating an image gallery that adjusts its size automatically (width: 100%) based on the number of items it contains. For example, take a look at this gallery: http://codepen.io/anon/pen/eNMOEz .item { width: 75px; h ...

How can I upload a folder with subfolders and keep the structure intact?

I'm working on a form that allows me to upload a folder containing both files and subfolders with more files inside. I managed to upload the folder successfully, but when I check my directory, all the files are in one folder without the subfolders. My ...

retrieving data from a different controller in AngularJS

Having an issue with passing data from rootScope.reslogin2 to scope.user. It's not displaying as expected, here is my JavaScript file: app.controller("logincont", ['$scope','$http','md5','$window','$rootS ...

confrontation arising between two PHP scripts due to conflicting functionalities within the MetaSlider plugin

Seeking assistance with the WordPress plugin metaslider, specifically involving two code snippets. The first one implements the "ken burns effect" while the second disables the "pause on action" feature. Strangely, the "pause on action" seems to interfere ...

Using Symfony 4.3 to submit a form via Ajax and store data in a database

As a beginner in the world of Ajax, I am currently trying to use Ajax to submit a register form with Symfony but seem to be facing some challenges in understanding the process: Within my Controller: /** * @Route("/inscription", name="security_re ...

Encountered a problem when trying to import the function "createToken" into a Node.js middleware

I have developed a model called users in which I included a method named generateToken for generating web tokens. This model is being used with the Sequelize ORM. module.exports = (sequelize, Sequelize) => { const Tutorial = sequelize.define("u ...

Triggering the AJAX function in the main window

My HTML webpage has a hyperlink that, when clicked, opens the same page in another window with a hash value appended to the URL using window.open. For example, the URL could look like this: http://mywebsite.com#hash=value The webpage contains a JavaScript ...

Stripping CSS prefixes upon file initialization

When developing my application, I have a process in place where I load CSS files on the back-end using Express.JS and then transmit them to the front-end. However, before sending the CSS code to the front-end, I need to: Identify the user's browser; ...

Masking input text to allow numbers only using either javascript or jquery

I have experience with javascript and jquery. My goal is to create a masking template for <input type="text"> This template should only accept numbers and automatically format the input with dashes after every two numbers typed. The desi ...

Ways to separate a string based on changing values in Javascript

Given this unmodifiable string: "AAACCDEEB" I am looking to split it into an array whenever the value changes. In this scenario, I would end up with 5 arrays like so: [['A','A','A'], ['C','C'], [ ...

Having trouble starting the server? [Trying to launch a basic HTML application using npm install -g serve]

I am in the process of creating a PWA, but I haven't reached that stage yet. Currently, I have only created an index.html file and an empty app.js. To serve my project locally, I installed serve globally using npm install -g serve When I run the co ...

Issue with Dynamic Image Path in Require Function: Unable to locate the relative module

I've been struggling with an error in VueJs require function for the past two days. I'm attempting to pass a prop to the Home component and then display the image. Home.vue <template> <BlogPost :post="welcomeScreen"/> <B ...

The Javascript executor in Selenium is delivering a null value

My JavaScript code is causing some issues when executed with Selenium's JavascriptExecutor. Strangely, the code returns null through Selenium but a value in Firefox developer console. function temp(){ var attribute = jQuery(jQuery("[name='q& ...

What is the method to create all possible combinations from the keys of a JSON object?

How can I generate object B that includes all combinations of object A using a key-value pair? { "x": "data-x", "y": "data-y", "z": "data-z" } The desired output should look like this: { ...

Utilize jQuery to manipulate a subset of an array, resulting in the creation of a new array through the use of

I have a string formatted like this: ItemName1:Rate1:Tax1_ItemName2:Rate2:Tax2:_ItemName3:Rate3:Tax3_ItemName4:Rate4:Tax4 (and so on, up to item 25). My task is to take an index provided by the user (for example, 2), retrieve the item at that index when ...

Interfacing shared memory between a C++ and JavaScript program

Is it feasible to have shared memory that both a C++ program and a JavaScript program can access simultaneously? The goal is for the C++ program to write to memory while the JS program reads from the same location. ...

Execute JavaScript script once when route changes

I'm currently working on a system where I want to ensure that my animation-based JavaScript code only runs once after the route changes. The issue I'm facing is that when switching between pages and returning to the about page, the scripts are ca ...

Tips for implementing a jQuery mouseleave function for multiple div elements sharing the same id

I am facing an issue with my website where multiple divs share the same id. I need to implement a mouseleave function for all of these divs that have this specific id. Within my $(document).ready function, I currently have the following code... $('#m ...

I want the navigation bar to appear only upon scrolling, but when I refresh the page it is already visible, and then vanishes as I start scrolling

I'm working on a project where I want the navigation bar to only appear after scrolling a certain distance down the page. However, I've noticed that when I refresh the browser, the navigation bar appears immediately and then disappears once I sta ...