AllskyTeam / allsky

A Raspberry Pi operated Wireless Allsky Camera
MIT License
1.19k stars 180 forks source link

Dark Frame question #637

Closed maserowik closed 3 years ago

maserowik commented 3 years ago

So this is more of a question on the dark frame option. Currently on the pi there is dark images from -13 to 31. the number go from -13 to 31 in one step settings i have the dark frame option select in the config.sh.

# Set to "true" if you want to enable dark frame subtraction on your night-time images.
# You must first create dark frames - see the README.md file for instructions./

DARK_FRAME_SUBTRACTION="true"

I read the README.md but still a confused but it. So since I have 46 dark images the software will try all 46 and see which one is the best are removing hot pixels. Mike

EricClaeys commented 3 years ago

@maserowik No, the software will get the current sensor temperature from the temperature.txt file then find the closes file in darks/* to that temperature. For example, current temp in temperature.txt is 21. You have 3 darks: 17.jpg, 20.jpg, and 23.jpg. The software will first look for an exact match with 21.jpg, but since it's not found it will pick 20.jpg because it's only 1 degree off from the current temp of 21. It never looks in the files - it simply looks at the names of the files. Unless something is really weird with the camera, or your darks are pretty old, the closest dark frame will give the best results. Assuming the dark and the light have the same settings, like exposure time, binning, gain, etc. And they should, since when darks are initially taken they use the max night exposure and all the other night settings.

Does this answer your question?

FYI, the Pi you're letting me use has the fixed version of darkCapture.sh and darkSubtract.sh that correctly implements this.

techd51 commented 3 years ago

I'm having issues with Dark Frames also, I have a good selection of Dark Frames from 16-51, that I had taken during the day with the lens cover on as well as a rag over the unit. I viewed all my dark frame files and I can see the hot pixels When capturing for the past 2 nights every capture that was created has hot pixels, When I compare a captured image to the closest temperature dark frame I can see that the hot pixels that were captured during the dark frame session are still showing up in the nightly captures even though I have DARK_FRAME_SUBTRACTION set to True. Is there any settings I should look at for resolving this issue?

Thanks in advance, Darren

techd51 commented 3 years ago

Here are examples of the files I'm comparing, when I open them both up in Photoshop and create layers and compare the two I do see some of the hot pixels being removed but not all. 43 image-20211011230427

maserowik commented 3 years ago

@maserowik No, the software will get the current sensor temperature from the temperature.txt file then find the closes file in darks/* to that temperature. For example, current temp in temperature.txt is 21. You have 3 darks: 17.jpg, 20.jpg, and 23.jpg. The software will first look for an exact match with 21.jpg, but since it's not found it will pick 20.jpg because it's only 1 degree off from the current temp of 21. It never looks in the files - it simply looks at the names of the files. Unless something is really weird with the camera, or your darks are pretty old, the closest dark frame will give the best results. Assuming the dark and the light have the same settings, like exposure time, binning, gain, etc. And they should, since when darks are initially taken they use the max night exposure and all the other night settings.

Does this answer your question?

FYI, the Pi you're letting me use has the fixed version of darkCapture.sh and darkSubtract.sh that correctly implements this.

Thanks I have a better understanding on how the darks work with the program.

Mike

shiner501 commented 3 years ago

@maserowik I also have exact same issue. The dark makes the image look worse than using no dark. I tuned darks off until i can sort it out. My allsky cam on large pole at top of house so I need to redo darks one night. Will this overwrite existing darks?

maserowik commented 3 years ago

@shiner501 Here is what I did lastnight 10/11/2012

I went out at night time and took apart my allsky. ( Mine is still on ground level due to a issue with a failed sd card and not enough day light now a days) Again this is what I did.

I placed my camera in my freezer for about 10-15 minutes. Then set up darks to capture darks. My first dark image was at -13c /9f. I then had the allsky take darks for about 20 minutes and every so often I went to the camera to wipe of the condensation that was appearing on. keep looking at my darks folder till i did not see anymore new files. the darks go from -13 c/9 f to 30c/86f.

I am not sure that was the best way to do it. thinking about it now having water from the condensation on the camera may not have been such a good idea.

I did add some silica packets to the box when I was done. I plan on going back to the box and giving it a once over.

Mike

EricClaeys commented 3 years ago

Folks, Please wait a day or two until the fixed version of the dark algorithm is posted. It will update darkCapture.sh, darkSubtract.sh, and endOfNight.sh. The fixed version uses the correct dark from when subtracting; the version you have usually does NOT use the correct dark file so your dark subtraction won't be optimal.

This fix requires version 0.8 or higher. If you created your darks prior to 0.8 I suggest you re-do them. Prior versions didn't do a good job matching the dark settings to your normal nighttime settings; version 0.8 does, so the darks themselves will be better with version 0.8.

The fix to be posted soon (I hope) won't impact your darks - it will simply use the correct dark frame during subtraction.

Please also see the Wiki page on darks for some tips.

Once you have the dark fix and have darks created with 0.8, please let me know if they do a better job that what you're seeing now.

@maserowik I don't think dew on your camera once in a blue moon will do it any harm. What you did was a great way to get a wide range of darks in one night.

@shiner501 When you create darks, if there's already a dark of the same temperature it will overwrite it if the current temperature is the same. It only overwrites the darks when it creates a new one of the same temperature.

EricClaeys commented 3 years ago

Folks, The fixed dark capture/subtraction code has been merged into the master code. Please update the files and let me know how it goes.

Keep in mind that the dark subtraction will never be perfect, especially at the beginning and end of nighttime when your exposures likely aren't at the max value (if you are doing auto exposure night images). Darks are taken at the maximum auto exposure length for auto exposure or at your specified nighttime exposure length if doing manual exposures.

rce1086 commented 3 years ago

Observation only, please don’t take as criticism of your work Darks really should be of the same length, gain, temperature & offset as the lights that they are being applied to, otherwise they will increase noise in the image in one way or another… If you want to try scaling the darks to suit the exposure, you need bias frames to subtract, before scaling the dark, and then either re-apply the bias, or subtract it from the light frame before doing the same with the scaled dark frame.

EricClaeys commented 3 years ago

@rce1086 Carl. They are as much as possible. The software uses the nighttime settings for lights. The only times this isn't always the case is when auto exposure or auto gain light images aren't at the max exposure / gain values. The darks exposure length and gain are always at those values.

maserowik commented 3 years ago

@EricClaeys Is it ok to close this issue?

techd51 commented 3 years ago

I know the issues I was having have been resolved.

EricClaeys commented 3 years ago

@maserowik, You created the issue so if you think it's ok, then please close it. In general I prefer the original poster to close their Issues so I know they agree the problem has been resolved. I may think it has been but they may not. Eric