GithubHelp home page GithubHelp logo

Comments (2)

tayden avatar tayden commented on June 21, 2024

Hi @joanlyq,

The intensity ratio algorithm is not really supported in the released version. It was something we played around with early on, but we found that simple thresholding was effective enough.

The ThresholdAlgorithm is pretty simple, and just classifies a pixel in the image as "glint" if any of the band pixel values are greater than the threshold passed in. e.g. if using the thresholds (0.9, 0.8, 0.7), you'll get a mask back that specifies glint for any pixel where the Red band value is greater than 0.9, or the Green band is greater than 0.8, or the Blue band is greater than 0.7. (Note: as a preprocessing step, the pixel values are normalized to fall between 0 and 1).

The IntensityRatioAlgorithm on the other hand is more complex. For each pixel it tries to estimate how much of the pixel is composed of specular and diffuse reflectance. It does this by calculating something the authors call "intensity ratio" of each pixel (intensity ratio = max(R,G,B)/(max(R,G,B)-min(R,G,B)). Then, using a user estimation of the proportion of the image that can confidently be said to have no glint, it finds a intensity ratio value for a pixel that represents purely diffuse reflection. Knowing this intensity ratio value for a purely diffuse pixel, it estimates the component of specular reflection in all of the remaining pixels. Finally, a threshold on the amount of specular reflection that is acceptable for a single pixel is used to mask out the pixels that are too-glinty.

The issue, with the intensity ratio method is that the idea depends on the assumption that the image is of mostly uniform colour, except for areas of glint. Failing that, the idea that the calculated intensity ratio corresponds to the proportion of specular and diffuse reflection in each pixel doesn't really hold up. To overcome that limitation, the authors suggest segmenting different areas of the image first by coloured regions and running the algorithm multiple times for each region.

In the end, using the intensity ratio algorithm adds quite a bit of processing overhead to do it properly and it was ultimately abandoned in favour of the naive-yet-effective approach of the ThresholdAlgorithm.

from glintmaskgenerator.

joanlyq avatar joanlyq commented on June 21, 2024

Hey Taylor, thx for the detailed explanation. It makes sense. I've also tried some other DL glint detector and they all have their own trouble. I totally agree, anything that is effective is good, no need to be complicated. Cheers!

from glintmaskgenerator.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.