Luminous Pro LED Ring Light Plus - SA LED-RLPS - ring of light
Light domjavascript
Because they both solve very different requirement sets, choosing between the DOM options isn’t too difficult. In situations where you want your component to easily interact, and be fully available to its parent node and DOM tree, Light DOM is the best option. In situations where you want your component isolated from everything going on around it, then the Shadow DOM is best.
In contrast to the Light DOM, the Shadow DOM is meant for isolation. This is so because in the Shadow DOM there are no interactions with the parent DOM tree. All global parent CSS or JS is not accessible inside of it, and it lives in its own separate DOM tree invisible to the parent DOM tree in the Light DOM.
Light dommeaning
A more valid way to check whether an image has a low or high contrast is to plot the image histogram. Let’s plot the histogram for the above images
Clearly, on global enhancement, the details present on the face of the statue are lost. While these are preserved in the local enhancement. So you need to be careful when selecting these methods.
Light domexample
For example, say you build a web component that has two child elements, a button and a span. In the Light DOM, using the JS syntax you’re already used to for accessing them would work here just fine. Also, all the global CSS and JS is affecting them as well.
So, for the high contrast, the image histogram should span the entire dynamic range as shown above by the right histogram. In the next blogs, we will learn different methods to do this.
Clearly, from the left image histogram, we can see that the image intensity values are located in a narrow range. Because it’s hard to distinguish nearly the same intensity values (See below figure, 150 and 148 are hard to distinguish as compared to 50 and 200), thus the left image has low contrast.
Light DOMslots
When building web components, some might actually be surprised to know that there is a choice of DOM available to you. Each option represents a different solution that answers a different set of needs. Neither is better than the other, only more appropriate to use in one situation versus another. These two DOMs are shadow and light.
Litlight DOM
A real life example can be of a sunny and a foggy day. On a sunny day, everything looks clear to us, thus has a high contrast, as compared to a foggy day, where everything looks nearly of the same intensity (dull, washed-out grey look).
Clearly, the left image has a low contrast because it is difficult to identify the details present in the image as compared to the right image.
There is another naive approach where we subtract the max and min intensity values and based on this difference we judge the image contrast. I will not recommend following this as this may get affected by the outliers (we will discuss in the next blogs). So, always plot the histogram to check.
Not all technology decisions need too much deep thought for the most optimal choice. It just takes an open mind, understanding of your use cases, and what is available to you. Having two options in how you build your Web Components is great because it gives you the flexibility to build out your application to the best of your ability.
Light DOMLWC
In short, the Light DOM is the one you’re already familiar with in the JS world. Your web component becomes part of its parent DOM tree and the child elements inside of it are visible as well.
In the next blog, we will discuss the methods used to transform a low contrast image into a high contrast image. Hope you enjoy reading.
Light DOMvs ShadowDOM
The right histogram increases this gap between the intensity values and Whoo! the details in the image are now much more perceivable to us and thus yields a high contrast image.
According to Wikipedia, Contrast is the difference in luminance or color that makes an object distinguishable from other objects within the same field of view.
When performing Contrast enhancement, you must first decide whether you want to do global or local contrast enhancement. Global means increasing the contrast of the whole image, While in local we divide the image into small regions and perform contrast enhancement on these regions independently. Don’t Worry, we will discuss these in detail in the next blogs.
Low contrast images can result from Poor illumination, lack of dynamic range in the imaging sensor or even wrong setting of lens aperture during image acquisition etc.
If you have any doubt/suggestion please feel free to ask and I will do my best to help or improve myself. Good-bye until next time.