GAMMA SETTINGS QUESTION

The place for all your solar software; capture, stacking, post processing, ancillaries etc. It's all up for discussion here!
Post Reply
User avatar
Valery
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 4059
Joined: Sun Nov 18, 2012 3:13 pm
Has thanked: 156 times
Been thanked: 893 times

GAMMA SETTINGS QUESTION

Post by Valery »

Mark T. writes:

"I have been doing some experimentation with my PGR cameras lately, and are able to image in their native 10, 12 or 14bit output (depends on camera), i'm finding I can expose way up to >90% of the histogram with no issues in post processing or stacking. If I do this in 8 bit mode I find I have to keep the histogram down at 70% - same experience as you Marty!

I do totally get your logic and reasoning Valery and 'gamma exploration' is on my list of things to try on those long summer days!"

-------------------------------------------------------------------------------------------------------------------------------------------------------------

I think we still have misunderstanding.

"I can expose way up to >90% of the histogram with no issues in post processing or stacking. If I do this in 8 bit mode I find I have to keep the histogram down at 70%"

If we keep gamma neutral (gamma off) then when we use an exposure that histogram right end is at 90% of full brightness range, this does not mean that the histogram is 90% full because the black now is not 0, it now has 100 or more value (if we use 8 bits or 256 brightness levels) !!! For best brightness dynamic range representation we need to fill the histogram in the way when black is 0 and maximally bright area is 255 !!! Only in this case the histogram can be called as fullfilled. We can't reach this keeping gamma neutral. We need to stretch the histogram from 0 to at least 240 using gamma, exposure and gain settings. Of course better to not use gain. But this is not always possible as we want to use as short exposures as possible to freeze seeing. Usually we need to use gain at the level when we keep dynamic range of 8 bits, but if necessary 7 or even 6bits - all depends of camera sensitivity, image scale (surface brightess) and necessity of shortest exposures.


Valery
Last edited by Valery on Sat Mar 09, 2019 4:10 pm, edited 1 time in total.


"Solar H alpha activity is the most dynamic and compelling thing you can see in a telescope, so spend accordingly." (c) Bob Yoesle.

Largest full size 185 - 356mm Dielectric Energy Rejection Filters (D-ERF) by ARIES Instruments.
Astrophil
Almost There...
Almost There...
Posts: 903
Joined: Thu Dec 20, 2018 2:00 am
Been thanked: 581 times

Re: GAMMA SETTINGS QUESTION

Post by Astrophil »

Here is some additional info pertaining to dynamic range and gamma. Dynamic range is hardware limited however what we see and image as perceived dynamic range is effected by gamma settings and bit depth. I have found it better or at least easier to image when gamma is adjusted to show a wider histogram and biased toward the blacks.

Phil

From FLIR knowledge base.


How do I increase the dynamic range of my camera?
KB Number: 10264
Last Revision Date: 2/10/2016
For the sake of this article, dynamic range is defined as the difference between the maximum and minimum amounts of light that a sensor can measure. This is bounded on the upper end by the sensor’s full well depth (the maximum charge, measured in electrons, that any pixel can contain) and at the lower end by the camera’s read noise. It is measured in a number of different ways, but one simple method is to examine the number of different levels of grey that can be distinguished. The greater the dynamic range of a camera, the more grey levels that will be distinguishable in the resulting image.

A common way to measure dynamic range is to present the camera with an image of a target that is completely black on one half and the other half completely saturates the sensor. A series of neutral density filters that reduce the target image transmission by 50% are placed between the target and the camera. The number of filters required to make the dark portion of the target indistinguishable from the light portion indicates the number of bits of dynamic range of the camera.

Improving a Camera's Dynamic Range

As a camera's dynamic range is bounded on one side by the sensor's full well depth and on the other by the read noise, there are only a few things that a user can do to improve the camera's true dynamic range.

Adjust camera parameters to increase dynamic range (brightness and gain). The brightness setting or black level of the camera is effectively the minimum value that any pixel will return. Minimizing the brightness level maximizes the number of levels of intensity available to the sensor to represent the incoming light and thus helps increase dynamic range. In addition to raising the pixel intensities, increasing the camera's gain raises the read noise level. Thus, using the minimal amount of gain that will still allow the A/D to saturate will help maximize the camera's dynamic range.

Adjusting gamma to improve perceived dynamic range. Cameras that implement gamma functionality allow the user to apply a non-linear response curve. Although changing the gamma does not change the camera's dynamic range, it does change the way the full range of bits is mapped down to 8bpp. This allows the user to map pixels, either near saturation or with very little signal, non-linearly across the grey levels. This changes the user’s perception of the camera’s dynamic range and allows them to see more details in both the brightest and darkest parts of the image. Experience indicates that this is more effective in the darker portions of the image than in the lighter portions. When adjusting the gamma, a user may notice a grayish film in the resulting image (i.e. image appears washed out). This is generally a result of the gamma being set too high.

Adjusting bits per pixel to improve perceived dynamic range. Many cameras support video modes that provide greater than 8 bits per pixel. While the video mode is generally labeled as 16 bits per pixel (Y16), these images usually have between 9 and 12 bits of useful data. Although using these higher bit depth images does not improve the actual dynamic range, they do provide more resolution across the entire image. This can be useful in cases where users would like to apply custom 'gamma' algorithms.

Filtering the light hitting the sensor. If the camera is black and white, you can add an IR filter, similar to those shipped with color cameras. Refer to Section 2.4 of the Dragonfly Technical Reference for information about the IR filter included with color versions of the camera. Customers have also had success with a polarization filter.

Increasing the ambient lighting of the scene. Removing spot lighting and increasing the ambient lighting of the scene will reduce specularities and other saturated portions of the image, allow for the most image detail possible.


xn44
Almost There...
Almost There...
Posts: 1160
Joined: Tue Jan 03, 2012 3:32 pm
Location: Begues, Barcelona, Spain

Re: GAMMA SETTINGS QUESTION

Post by xn44 »

It's very interesting. I learn a lot from you.
Thanks.


User avatar
marktownley
Librarian
Librarian
Posts: 42120
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Has thanked: 20229 times
Been thanked: 10111 times
Contact:

Re: GAMMA SETTINGS QUESTION

Post by marktownley »

I get what you're saying Valery if i'm imaging a closeup mid disk Valery, however when I image and it includes the solar limb I find by dropping the gamma it just kills limb detail - spicules and proms...


Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!
bart1805
Almost There...
Almost There...
Posts: 636
Joined: Mon Feb 06, 2017 9:04 pm
Location: The Netherlands
Been thanked: 1 time

Re: GAMMA SETTINGS QUESTION

Post by bart1805 »

marktownley wrote: Sun Mar 10, 2019 9:53 pm I get what you're saying Valery if i'm imaging a closeup mid disk Valery, however when I image and it includes the solar limb I find by dropping the gamma it just kills limb detail - spicules and proms...
That is exactly what I was thinking. When the image includes the solar limb it is totally different when imaging mid disk. But I will certainly try what happens if I apply more Gamma when imaging mid disk.


User avatar
marktownley
Librarian
Librarian
Posts: 42120
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Has thanked: 20229 times
Been thanked: 10111 times
Contact:

Re: GAMMA SETTINGS QUESTION

Post by marktownley »

Any tips for limb shots Valery?


Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!
User avatar
Valery
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 4059
Joined: Sun Nov 18, 2012 3:13 pm
Has thanked: 156 times
Been thanked: 893 times

Re: GAMMA SETTINGS QUESTION

Post by Valery »

marktownley wrote: Tue Mar 12, 2019 4:45 pm Any tips for limb shots Valery?
No special tips. I just set brightness, exposure and gamma so, that I see maximum details here include spiculaes. If needed I use 16bit recording mode. Then several "curves" tweaking again, for maximum details and shades visibility.


"Solar H alpha activity is the most dynamic and compelling thing you can see in a telescope, so spend accordingly." (c) Bob Yoesle.

Largest full size 185 - 356mm Dielectric Energy Rejection Filters (D-ERF) by ARIES Instruments.
Bruce G
Ohhhhhh My!
Ohhhhhh My!
Posts: 177
Joined: Mon Jul 16, 2018 8:18 pm
Has thanked: 128 times
Been thanked: 121 times

Re: GAMMA SETTINGS QUESTION

Post by Bruce G »

The FLIR KB note makes some good points

"Thus, using the minimal amount of gain that will still allow the A/D to saturate will help maximize the camera's dynamic range."
This is the point that Valery was making. You want to use that whole histogram. BUT, once data values are clipped, they are permanently lost. I suggest that you use a logarithmic histogram presentation so that you can see the low histogram count data at the top end of the histogram so that you don't clip data. If the histogram is adjusted to avoid clipping, the bulk of the data will fall off near 90%, leaving a tail up to the higher numbers. FLIR notes: "using the minimal amount of gain that will still allow the A/D to saturate will help maximize the camera's dynamic range." but in saying that, they mean that just the very tip top peaks of white should be saturating. Anything that you want to retain detail in the final image must never saturate the A/D.

The bit about keeping your histogram lower to avoid clipping in post-processing might work, but is counterproductive. You really need to get the maximum out of your camera at data acquisition time and then pay attention to what you are doing in post processing. Sharpening, for example, can easily pop data values up to the point where they clip. You need to be aware of the effects of your post-processing actions and always keep an eye on your histogram throughout the post-processing.

"Although changing the gamma does not change the camera's dynamic range, it does change the way the full range of bits is mapped down to 8bpp."
Gamma is a _software_ modification. Its action is applied _after_ the A/D converter. Anything that can be done with Gamma can be duplicated using Curves in Photoshop. There is no way to increase the dynamic range of your camera (stretch the histogram) using Gamma. What gamma does do is affect your perception of the gray levels (which is useful), but it does not fundamentally affect your data in the way that Gain does. Gain and Brightness, or Offset, occur prior to the A/D converter and do fundamentally affect the camera dynamic range.

Gamma also changes how the data is mapped to 8 bits. But if you are running your cameras at 8 bits and trying to capture the solar disc and prominences in the same frame, then you are only hurting yourself. Eight bit resolution is perfectly fine for DSOs, but will eat your lunch in solar work. Or at least it will force you to dance with the gamma mapping when it is not necessary. But even if you record the disc and prominences separately, if you record in 8-bit acquisition you are still heavily quantizing the low levels, which you need for detail in the prominences. I don't know why anyone would throw that data away. You can always trim a 14-bit image back to 8 bits if you want, but you can never recover that detail if you record in 8-bit to start with. And remember, whenever you readjust the histogram, whatever additional gray levels you give to one range of values must be stolen from another range of values (thus flattening the contrast somewhere else in the image. There is no free lunch. It'a best to leave the gray level reassignment to Photoshop or a similar post-processing program where you have much more control over which pixels you are playing with. This gives you far more control than Gamma ever possibly can.

ZWO, in their latest driver release, dropped the Gamma control. It really does not affect the acquisition if you are recording at the full camera bit depth, so there is no use for it in the camera driver.

What I would really like to see is a logarithmic amplifier in front of the A/D converter. Then Gamma could be made to work the way that most people envision it. And if there are any cameras out there that have a nonlinear amplifier prior to the A/D, I would appreciate hearing about them.


User avatar
marktownley
Librarian
Librarian
Posts: 42120
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Has thanked: 20229 times
Been thanked: 10111 times
Contact:

Re: GAMMA SETTINGS QUESTION

Post by marktownley »

I will give the logarithmic histogram a go thanks Bruce.


Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!
User avatar
MalVeauX
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 1853
Joined: Tue May 09, 2017 7:58 pm
Location: Florida
Has thanked: 1142 times
Been thanked: 1329 times

Re: GAMMA SETTINGS QUESTION

Post by MalVeauX »

Any chance we mortals could get a screen shot of the histogram as it's being referred to? That would be super helpful to visualize.

Very best,


User avatar
Valery
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 4059
Joined: Sun Nov 18, 2012 3:13 pm
Has thanked: 156 times
Been thanked: 893 times

Re: GAMMA SETTINGS QUESTION

Post by Valery »

marktownley wrote: Thu Mar 14, 2019 8:40 pm I will give the logarithmic histogram a go thanks Bruce.
When I recording the sun, I use an 8bits mode and then camera and FC convert it and writes in a 16bit ser files. So, even if I stretch the histogram to about 90%, at the final 16bit file I have enough spare bits to process an image with no cut at the upper end of the historgam.


Valery
Last edited by Valery on Tue Mar 19, 2019 1:49 pm, edited 1 time in total.


"Solar H alpha activity is the most dynamic and compelling thing you can see in a telescope, so spend accordingly." (c) Bob Yoesle.

Largest full size 185 - 356mm Dielectric Energy Rejection Filters (D-ERF) by ARIES Instruments.
Bruce G
Ohhhhhh My!
Ohhhhhh My!
Posts: 177
Joined: Mon Jul 16, 2018 8:18 pm
Has thanked: 128 times
Been thanked: 121 times

Re: GAMMA SETTINGS QUESTION

Post by Bruce G »

Matry,

Sorry it took so long to get back to this. I had to wait for the Sun in order to grab some screen shots. We're actually lucky. I haven't seen much of the Sun for weeks.

The images below were made using SharpCap. Obviously, there will be differences with other acquisition programs, but the concepts should be the same regardless. The seeing would have been good, had it not been for an overall haze in the sky.

In some of the screen captures, there is a second image to the right of the SharpCap camera image labeled "Adjusted". This image is not part of the SharpCap display. I created it in Photoshop to give you an impression of what a gamma adjusted image would look like. ZWO has removed the gamma adjustment from their driver, so SharpCap displays the raw camera images. What you see in the left, unadjusted image, is what the image sensor is seeing and it wouldn't matter what you set gamma to, you cannot alter that basic scenario (though you can alter it with gain and brightness/offset). This applies to all cameras that I know of. You cannot change the output of the _sensor_ in any way using gamma. SharpCap does allow you to adjust your screen appearance to something that looks a gamma adjusted image, which helps immensely in focusing, but the adjusted screen image is not output to a file, only the raw data. I could have made the SharpCap screen image look like my adjusted image, but that would have confused the histogram discussion.

What's in the histogram
The image below shows the histogram that was displayed by SharpCap for a full disk image with black space background. Starting at the left, the first thing to note is that the histogram does not go to zero. That is because of the hazy seeing conditions. The camera never saw a full black value. Normally, you would expect the left edge of the histogram to be at, or very near zero.

The large lump represents pretty much everything that isn't the Sun itself, mostly empty space. Just to the right of it though, is where the prominences live. This is a part of the curve that should get a lot of attention if you're interested in recording proms. To the right of that, taking up a good portion of the brightness range of the image is the brighter parts of prominences, outer portions of the Sun and, in this case, a lot of atmospheric haze. Normally this portion of the histogram should not have this much activity.

As the counts in the histogram begin to climb again, we are getting into the brightness range of the chromosphere. To the right of that is most of the solar disk, though some of the darker areas will be found down in the area that I labeled chromosphere.

Finally, at the extreme right of the histogram you see a few counts going to the highest values. You can do what you want, but I am extremely reluctant to allow these points to clip. Clipped data are lost forever, and there is no indication of where these points occur in the image. But often they are found in active regions and I'm willing to sacrifice just a bit of dynamic range in my camera to avoid clipping those points. If you do choose to push your histogram all the way to the right and clip off that tail, be sure that you check every time that you do an operation like sharpening that can increase pixel values, as you are already dangerously close to clipping not just a few points, but a whole bunch of values in your data. I would rather breathe easier with a bit more headroom. Note that my histogram main data group tops out about 95%. This is nowhere near the 80% being discussed earlier. You really do want to push the top of the histogram as far as you think you can go without compromising the data.

Histo annotated.jpg
Histo annotated.jpg (418.08 KiB) Viewed 6721 times


Linear histogram vs. Log histogram
The two screen captures below differ only in the presentation of the histogram (though some time has also passed). If you see any differences in the images, that is the result of something else. The first image shows a logarithmic histogram for a full disk image, like we were just looking at. The second image shows the histogram with a linear scale. In the linear version, I find it difficult to see some of the details I like to see. For one thing, you can see a very clear end to the upper data values. As discussed above, this clear indication of where the bulk of your data values reside is very helpful in adjusting gain and exposure. In addition, I find a dip in the position of the histogram maximum to be highly correlated to my optimum etalon adjustment. That's because as the contrast improves with etalon adjustment, a good number of data points have darker values, which pushes the counts at the top end of the histogram down.

Histo log with inset.jpg
Histo log with inset.jpg (717.97 KiB) Viewed 6721 times
Histo lin with inset.jpg
Histo lin with inset.jpg (702.32 KiB) Viewed 6721 times


The next two images show logarithmic and linear histograms for a capture with a 5x Powermate installed so that we see only a portion of the Sun's surface. In this case, there is very little difference between choosing linear or logarithmic. The logarithmic will emphasize low count features and those may be of interest. If so, then the advantage would go to the logarithmic display again. Basically, I just always keep my histogram set to logarithmic. I think it gives me a better appreciation of where my meaningful data lie.
Histo log full sun.jpg
Histo log full sun.jpg (930.34 KiB) Viewed 6721 times
Histo lin full sun.jpg
Histo lin full sun.jpg (926.72 KiB) Viewed 6721 times


8-bit vs. 16 bit
The histograms so far have all been 16-bit histograms. Below is a histogram for the same camera setup and the same full disk image as before, with the only difference being that the camera has been set to 8-bit acquisition. You can immediately see the chunky appearance of the 8-bit data. In 8-bit acquisition, the A/D converter can output a maximum of 256 different values, nothing more. The second image shows an expanded view of the bottom of the histogram. For any given vertical column of the histogram, all brightness values in the image from the left edge of the bar to the right edge of the bar will be assigned the same output value from the A/D converter. Refer back to the annotated image to see where the proms live and compare it to this diagram. Do you really really want to throw away that much information in such a delicate part of your image? Similarly, in a low contrast scenario, like the two images just above, subsequent contrast stretching will be smoother by utilizing the full bit depth of the camera's image sensor. If you do want to decimate (bin values), you can always do it in post.
Histo 8 bit with inset.jpg
Histo 8 bit with inset.jpg (694.27 KiB) Viewed 6721 times
Histo 8 bit quantization.jpg
Histo 8 bit quantization.jpg (197.03 KiB) Viewed 6721 times


My main point here was to support the assertions that I made in my original post. I'm sure others do it differently and I hope we hear from them as to why they do things the way that they do. Please keep in mind that my strength is neither optics nor astronomy. What I do have familiarity with is data acquisition, data analysis, and image processing.
Last edited by Bruce G on Tue Mar 19, 2019 1:37 pm, edited 2 times in total.


User avatar
Montana
Librarian
Librarian
Posts: 34526
Joined: Mon Oct 17, 2011 5:25 pm
Location: Cheshire, UK
Has thanked: 17521 times
Been thanked: 8763 times

Re: GAMMA SETTINGS QUESTION

Post by Montana »

Thank you Bruce, that really made everything clear to me :bow2

Alexandra


Bruce G
Ohhhhhh My!
Ohhhhhh My!
Posts: 177
Joined: Mon Jul 16, 2018 8:18 pm
Has thanked: 128 times
Been thanked: 121 times

Re: GAMMA SETTINGS QUESTION

Post by Bruce G »

Thanks Alexandra.

Today I wanted to show what happens with a camera that does have a gamma adjustment. The seeing conditions had deteriorated from yesterday and it was difficult to get a stable display that I could use to show small changes. In some cases I had to wait a significant time between shots and conditions are not identical which shows in the images. The view to the north, of course, was completely clear. Hopefully, the examples will still be useful. The camera that I used is a QHY163M. It has a much larger image sensor, with smaller pixels, than my ZWO camera but has a considerably slower frame rate as a result.
2019_03_19 seeing1.jpg
2019_03_19 seeing1.jpg (1.09 MiB) Viewed 6654 times


Before going further, I want to introduce a convention for the purpose of discussion. I have found that talking about a "high" gamma value or a "low" gamma value can be confusing because some cameras use them reversed from one another. My QHY camera has gamma going one way and when my ZWO camera had a gamma control, its values went the other way. I am going to call the two variations "positive" and "negative" gamma. A positive gamma has a convex (positive) curvature and displaces data in the positive direction. A negative gamma has a concave (negative) curvature and displaces data in the negative direction. The effect of the gamma curve can be easily replicated in Photoshop. In addition, Photoshop lets us see before and after displays, so it's easier to talk about the results. To replicate a gamma curve in Photoshop (or similar program), simply use the Curves tool.

Here is an image (not from today) for discussion. This will be rudimentary for most of you, but I include it for newcomers and to provide a basis for further discussion if applicable. The image was acquired with a neutral gamma and the dynamic range of the camera was fairly well exploited in the camera setup. Some detail in the solar disk is visible and there is clearly activity at the limb as well. A Photoshop Curves tool is shown, but no adjustments have been made. Input values are on the x-axis and output values are on the y-axis.
Gamma curve neutral1.jpg
Gamma curve neutral1.jpg (211.04 KiB) Viewed 6665 times

If a positive gamma is applied, the middle of the curve is pulled toward the upper left of the plot, resulting in an increase in value for all data points. Those on the left side, the darker values, are raised up by more than the points on the right and the character of features near the Sun's limb becomes much more clearly visible. Note the histogram in the upper right of the display. This is Photoshop's histogram window and it shows you the effect of the modification you are about to make. This display very clearly shows how the output histogram will differ from the input. Gray is "before", white is "after". The fact that the whole curve has been pushed upward is evident. However, since the uppermost value in the histogram must stay fixed and everything from the lowest value has moved upward, that means that the histogram has been compressed overall, though the darker values have benefited in the process. Note how much narrower and taller the peak representing the solar disk data has become. It's not possible to see in the display, but the peak at the lower end has gotten smaller. Note also that it has widened. That is what provides more detail in the image for the darker values.
Gamma curve positive1.jpg
Gamma curve positive1.jpg (199.56 KiB) Viewed 6665 times

If a negative gamma is applied, the opposite happens. The middle of the curve is pulled toward the lower right. All data values in the image are decreased. In the before/after display, the bright image values, on the right, are lowered most and the histogram is pushed to the left. The bright peak has become wider and shorter, the dark peak has become narrower and taller. Again, since the lowest value in the histogram (zero) must remain fixed, the overall effect is compression of the entire histogram, though in this case more detail becomes visible in the solar disk at a cost to the prominences and chromosphere.
Gamma curve negative1.jpg
Gamma curve negative1.jpg (216.74 KiB) Viewed 6665 times

Once the data have been reassigned to new values, the effect cannot be completely undone. If you compress the values that used to be in several histogram bars into a single histogram bar, you can't then unpack the single bar and restore the original data values by any subsequent operation on the data alone. I applied a strong positive curve to the negative gamma image, just above, with the result shown below. Despite pushing the high end very strongly, the prominence detail has been permanently lost, which can be seen by comparing to the neutral and positive gamma images.
Negative gamma followed by positive.jpg
Negative gamma followed by positive.jpg (526.44 KiB) Viewed 6665 times

While the above effects were achieved by using Photoshop, the same effects can be applied to the data through the use of a gamma curve during acquisition. The examples below were acquired today. The first image is simply the initial camera setup, attempting to maximize the use of the camera dynamic range, as I discussed in my earlier post.
Histo neutral gamma1.jpg
Histo neutral gamma1.jpg (874.44 KiB) Viewed 6664 times

Note the Display Histogram Stretch in the lower right corner. This is the control that allows you to modify the screen appearance like a gamma control that I mentioned in my earlier post. Applying a concave curve stretches the histogram in the brighter values, providing detail in the bright areas, as would a negative gamma. Sorry about turning the Sun. This is one of the images that I took after a long period of cloud cover and I ended up having to move the whole setup because the Sun got behind one of the power lines.
Histo neutral gamma SharpCap adjust1.jpg
Histo neutral gamma SharpCap adjust1.jpg (907.35 KiB) Viewed 6660 times

When a negative gamma is applied (in this case, increasing the gamma value to 2, its maximum value), the histogram is pushed downward, spreading out the value range for the brighter data and compressing it for data values on the dark end.


ACK! I somehow overwrote this image. I'm going to have to do it again and edit this later. Maybe I'll get better skies and be able to replace all of today's images. Ahem. Moving on then...

When I first did this test, I expected to compensate for some of the lowering of the upper end of the histogram by applying a bit more gain. But that didn't work. Simply looking at it with respect to image values, the small number of points at the top of the histogram don't get reduced all that much by the gamma adjustment. When a higher gain is applied, they're still big numbers and they get pushed off the end and clipped. From the technical perspective, remember that the gain is applied prior to the A/D converter. If you have properly set your gain/exposure combination to maximize the camera dynamic range, then the full range of the A/D converter is being utilized. Any increase in gain surely must clip more data.

Since these are only the very brightest values and there are very few of them, you may be willing to allow more of them to clip. Those bright spots might even represent noise, so who cares. You simply need to be aware of what you're doing and make it a conscious decision if you choose to clip data. If it's an image for documentation, just don't do it. If it's an art image, you're on your own.


When a positive gamma is applied during acquisition (for this camera, a value less than 1.0), the histogram is pushed upward, sacrificing the bright data to provide detail in the darker areas. Alas, there is simply nothing in that range to see in today's image.
Histo gamma 0.66_1.jpg
Histo gamma 0.66_1.jpg (927.29 KiB) Viewed 6657 times

Note how the histogram has started to become ragged on the left. That's because this is a 16-bit histogram and the camera is putting out 12-bit data. When the values are stretched far enough you begin to see the gaps between digital values. In these very dark portions of the image it's not a big issue.

The QHY camera driver has a brightness control that permits negative values. That means that I could potentially recover the portion of the histogram that was lost by pushing the data values upward with a positive gamma. But I found the control to be very fussy to work with and it didn't seem to help. Once again, considering the situation from the technical side helps clarify things. The brightness is an offset voltage that is applied to the analog signal prior to the A/D converter. So if the lowest values that the analog voltage ever achieves are greater than zero, it makes sense apply a negative offset and give your amplifier more room to work. Because of the poor seeing, I couldn't evaluate whether there was any true offset to be eliminated. Image-wise, particularly for artistic images, we're really trying to make a nice solid black to allow faint detail to be seen. Clipping a few points to black through an offset could help the appearance. I'll have to play with that some time when I have some clear skies.

That's all I have for the moment. The next time I see the Sun I'll try to get some images to fix my boo boo and maybe get better ones overall.

Bruce G
Last edited by Bruce G on Wed Mar 20, 2019 5:10 pm, edited 3 times in total.


User avatar
MAURITS
Way More Fun to Share It!!
Way More Fun to Share It!!
Posts: 8431
Joined: Tue Nov 27, 2018 4:37 pm
Location: Belgium
Has thanked: 2406 times
Been thanked: 4737 times
Contact:

Re: GAMMA SETTINGS QUESTION

Post by MAURITS »

VERY NICE EXPLANATION Bruce.


Regards,
Maurits

Vista del Cielo Observatory

www.vistadelcielo.be
User avatar
marktownley
Librarian
Librarian
Posts: 42120
Joined: Tue Oct 18, 2011 5:27 pm
Location: Brierley Hills, UK
Has thanked: 20229 times
Been thanked: 10111 times
Contact:

Re: GAMMA SETTINGS QUESTION

Post by marktownley »

Yes, excellent discussion, one for the library at some point...


Image
http://brierleyhillsolar.blogspot.co.uk/
Solar images, a collection of all the most up to date live solar data on the web, imaging & processing tutorials - please take a look!
Post Reply