From db0e3ccb5f1f840eaab786d46b89557391fef60c Mon Sep 17 00:00:00 2001 From: Leo Shatz Date: Thu, 18 Jan 2024 22:08:59 +0200 Subject: [PATCH] Enhance contrast for very low contrast images. This adjustment prevents the frames from being displayed as all-white, which is a visually unpleasant artifact commonly encountered in very dark frames without visible stars. By slightly increasing the maximum value when the difference between min and max values is minimal, we improve the visibility of image details while avoiding the all-white display issue. Signed-off-by: Leo Shatz --- guider.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guider.cpp b/guider.cpp index c9487ed56..0a7effc79 100644 --- a/guider.cpp +++ b/guider.cpp @@ -441,6 +441,15 @@ bool Guider::PaintHelper(wxAutoBufferedPaintDCBase& dc, wxMemoryDC& memDC) { int blevel = m_pCurrentImage->FiltMin; int wlevel = m_pCurrentImage->FiltMax; + + // Enhance contrast for very low contrast images. This adjustment prevents the frames + // from being displayed as all-white, which is a visually unpleasant artifact commonly + // encountered in dark frames. By slightly increasing the maximum value + // when the difference between min and max values is minimal, we improve the visibility + // of image details while avoiding the all-white display issue. + if ((m_pCurrentImage->BitsPerPixel > 8) && (wlevel < 4096 && (wlevel - blevel) < 16)) + wlevel += 16; + m_pCurrentImage->CopyToImage(&m_displayedImage, blevel, wlevel, pFrame->Stretch_gamma); }