Repository navigation
fix(flatfield): keep a carrier edge in the reference out of the gain - #1315
Merged
marcinz606 merged 1 commit intoOct 9, 2026
Merged
Conversation
A flat-field reference that shows the dark carrier edge (an empty carrier shot as the flat) fed that black band into the gain blur. The blur read too dark next to the edge, so the gain overcorrected there: correcting the reference with itself left the source up to 12.6% bright over the bottom ~15% of the frame, which prints as a dark band (discussion marcinz606#1298). compute_gain now masks pixels below 0.2 of the 95th-percentile luminance out of a normalized convolution and takes the mean over the lit area only. The mask erosion treats outside the image as dark, so a partly lit carrier lip on the outermost row or column is masked too. Pixels too far from the lit area take the nearest valid blur value, so the gain stays bounded over a wide carrier. Both of the reporter's flats now self-correct to within about 2%. A reference with no dark border gives a gain within 1% of the previous one; profiles already baked keep their stored gain until they are baked again.
|
Sorry I'm late. I can confirm that it works perfectly! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A flat-field reference that shows part of the dark carrier fed that black band into the gain blur. The blur then read too dark near the band, so the gain overcorrected the frame next to it. With the reference from discussion #1298 corrected by itself, the bottom ~15% of the frame came out up to 12.6% too bright, which prints as a dark band.
compute_gainnow masks out pixels below 0.2 of the 95th-percentile luminance, blurs only the lit area (a normalized blur), and takes the mean over the lit area. The mask erosion treats outside the image as dark, so a partly lit carrier strip on the outermost row or column is masked too. Pixels too far from the lit area take the nearest valid value, so the gain stays bounded over a wide carrier. Both of the reporter's flats now self-correct to within about 2%. A reference with no carrier edge gives a gain within 1% of the old one. Profiles already baked keep their stored gain, so existing edits render the same until the profile is baked again.Tested against the reporter's flats from #1298; confirmation from @oCorvus welcome.