change on histogram for extern value dot affect the definition #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
A problem comes out, during the emva test, with the logarithmic histogram when we had "dead pixel" or "defect pixel", the histogram became useless. The graph lose is resolution and the model doesn't fit the distribution anymore. Here an image generated with nine defects pixels when generated the emva test.
Zoom on the distribution.
The origine of this came form$y_{max}$ and $y_{min}$ of the image $y$ ). Resulting in this situation the Q(number of bins) and W(binwidth) will change. The model who is determinate with the mean and the standard deviation of the distribution appears to be inaccurate due to the presence of extremes values.
emva1288/emva1288/process/routines.py
in theHistogram1288
function. When the image contains defects pixels, that change the maximum and/or minimum values(The standard already put a$Q_{max}$ at 256 bins so when the image has extremes values like the first picture, the binwidth change and became larger reducing a low resolution for the histogram like the second picture show.
This pull request has for goal to have the same resolution than if the camera doesn't have defect pixel, regain a model who fit the distribution and without losing the values of the defect pixel.
Solution
For this case, nine defects pixels are simulated for a camera in
camera.py
. To do that a value of 255 is affected at nine pixels in the DSNU. It's simple to simulate defect pixel in the DSNU because is a kind of nonuniformity and is an addition of the dark signal who is directly adding to the image of electrons.This simulation gives a logarithmic histogram DSNU represented the two first picture.
Starting with the fact of the model resulting from the distribution need to be a normal distribution and 99.9999426697% of the values in a normal distribution are cover by five sigmas. So all values outside the deviation of five sigmas must be a defect pixel (extremes outliers).
To compute the distribution and not the useless outliers, the mean of the image$y$ and the standard deviation are calculated.
The region cover by 5 sigmas will be called core. This core has a new minimum and maximum who doesn't include the extremes outliers. A mean and a new sigma are calculated for the model who comes later. In the case where they have no outliers, nothing will change, because the core will cover all the image.
To change the resolution only a new binwidth is required. The covered region needs to be the same(with the outliers) so the$Q$ will upgrade and probably by over the $Q_{max}$ .
The result of this implementation:
Zoom on the distribution.
Zoom on the defects pixels.
It's hard to see the outliers with the modification because the resolution increases, but they are still there at different values of deviation of the mean with a number of pixels of one.
Conclusion
More complex code, increase the time to process but not very significative. In result, the histogram with a better definition and a model who can be used.
Change to the 1288 EMVA Standard Compliant
These changes require some modifications in the 1288 EMVA Standard Compliant. Based on the release 3.1 of December 30 2016, this are the suggested changes:
Section 4.3.1 Logarithmic Histograms.
Section 8.4 Defect Pixel Characterization