Jump to content

sgl_imaging_challenge_2021_annual.thumb.jpg.3fc34f695a81b16210333189a3162ac7.jpg

Playing around with deconvolution (programming)


NickK
 Share

Recommended Posts

Firstly.. the first image.. 

post-9952-0-56162900-1448810824_thumb.pn

One the left is the original raw long exposure - taken at SGL earlier in the year with little to no regard for mount alignment.

On the right is a new system I'm playing with - currently at it's simplest (and rotated/flipped the image by 90 by accident - such is experimental programming).

You'll note the massive reduction in elongation and sharpening. Only taken me a year to get myself around to actually writing this after the MBP died and it's all 100% CPU atm.. this is asymmetric 2D PSF deconvolution (no gaussian here). It's passive optics :) I use the guider star images, process them and then apply it to reconstruct the image.

Not bad for an initial play.. still working on refining it :D

Edited by NickK
  • Like 4
Link to comment
Share on other sites

The double star is about 13" seconds across.. not too shabby for detail. I since noted that one of the images should be removed (it's got really bad mount movement - beyond the guider track.)..

Left - Aladin, right a 30 image deconvoluted stack

post-9952-0-80275000-1448821088.pngpost-9952-0-87848900-1448821096.png

Also interesting is the appearance of some galaxies that aren't on the initial sub.. however I think the one on the left is either an artefact or something that's not in the image in Saladin. Below is a single deconvoluted sub ® and the aladin image (l) annotated side by side. Sub time is 60 seconds with a 383L at -15degC. The Guider image time is 2 seconds, cooled CCD (not sure if it was the old 16IC or the Titan).

post-9952-0-19157900-1448822184_thumb.pn

Still playing - one thing is certain, is the effect I am currently doing is impacted by the guider noise levels.

I have an idea for another way to apply the deconvolution, in that way it will not have the kernel noise squares but will take much longer to process and may loose some info.. still thinking..

Edited by NickK
Link to comment
Share on other sites

That last image.. The deconvoluted sub (l) output against the stretched raw 60 second 383L sub input. I need to check.. but I think the deconvolution is pulling detail out of the noise in the background. I'm still checking and I'll re-run the tests again...

Unfortunately the phone rang at the same time I was editing :F

Edited by NickK
Link to comment
Share on other sites

Look good Nick , do you have a link to this program I have a new Mac and still trying to get my head round useing it .

Thank

Les

Hi Les, It should be an easy standalone application - so basically drag your images to it and it will sort things out.. however at the moment it's still being tested :) (I've just run the images myself today).

It takes about 2 minutes on a 383L image at the moment - my plan is to just provide the application as open source.. then people can steal/borrow the idea for their own applications.

Link to comment
Share on other sites

Some more images.. including the other side... 

post-9952-0-35401700-1448830337_thumb.pn

^^ this matches the aladin pictures.  Image on the right is the input into the processing - the left is the output..

Whole image scaled to fit:

post-9952-0-99018900-1448830353_thumb.pn

So in all.. it looks like appears to make a very good processing tool. 

I'll post up a guide to how I do it over the next week..

Location of the star field: Field center: (RA H:M:S, Dec D:M:S) = (08:46:39.224, +20:37:51.823).

Edited by NickK
Link to comment
Share on other sites

  • 4 weeks later...

So continuing... you know when you find that you've over saturated the star - all you get is maximum pixel value?

Well.. I'm trying a technique to discover the maximum value. Effectively a like an autofocus it will defocus the smaller stars but then find the focus for the saturated stars. This should allow the deconvolution to work a lot better. Simply put it's 3D curve fitting using FFT correlation.

post-9952-0-69570500-1450802509_thumb.pn

Left to Right - processing with successive saturation. The bright saturated star becomes neater and finally the peak value on the right suggests a 20x saturation.

The idea is to performs this creating a 3D data set that gives each pixel the best peak value. The map will then be used to process the scene better.

Still early days.. but the idea seems to have merit.

Edited by NickK
Link to comment
Share on other sites

  • 1 month later...

Well I was sat in Kwik fit for an hour for the MOT today.. armed with a pen an paper I think I have an idea how to make the peak estimation work even better (and faster).

I need to code it up at some point and see but it looks like a decent way of doing it and without some of the issue the above form has....

Link to comment
Share on other sites

  • 3 weeks later...

Finally... on tuesday.. 8th interview.. 4th month.. I've been offered the job ... so still got some details to go but due to the role that takes about 6 weeks..

So as the role has a technical element.. I may have to dig out the development again :D

Idle thumbs and all..

Link to comment
Share on other sites

  • 4 weeks later...

Had a chance to play around with this today.. still got a little way to go but.. looking interesting.

First - non-stretched. Output of processing on the left and the raw sub on the right:

Screen Shot 2016-03-27 at 22.10.57.png

 

Second showing stretch using PI outstretch. 

Screen Shot 2016-03-27 at 22.10.22.png

 

You can see the PSF image border - a natural aspect but you can also see the reduction of motion blur, however I still have some work to go on this. It's picking a few hot pixels and a few other issues.

I also want to cross reference the output against Aladdin images too to see if the background data is real or spurious noise.

The system is auto-estimating the heavily saturated stars.

 

edit: noted there's possibly a little mishap with the coordinate system for the reconstruction. Will be interesting to see once that's checked.. It would explain some of the odd appearances (Y flipped double star at the top of the Aladdin and the bottom of the processed image).

Edited by NickK
Link to comment
Share on other sites

Hmm trying a new angle... 8 core MBP.. The joys of image processing with a CPU..

Screen Shot 2016-04-02 at 19.09.34.png

 

I should really switch back to GPU now it's fixed.. I need more than 8 cores!! (the GPU has 480 ...)

  • Like 1
Link to comment
Share on other sites

Been getting very involved in this.

Issues I've been tackling:

a. Per-pixel non-math modelled PSF deconvolution - this is straight forward except for saturated stars.. 

b. Saturated stars - this is complex. I have tried a varied set of ways to do this and still maintain the detail in the image. I can estimate the stars, the complexity increases when you have overlapping stars vs saturated stars - I can estimate star intensity by iterative matching of the intensity (this can be improved by using a LR style mu iterative testing) however the interesting situation is differentiating between the phase correlation result for two low intensity matches and the intermediate test for intensity. In short I have to look for the peak form and use some intelligent processing using masking/ranges.

To add fun - doing phase correlation with a large image to register is more noise robust as the signal to noise ratio is high.. with this the considerations are smaller and so the SNR drops.

After finding this - I did find a US livermore paper that correlates with my findings and experimentation (their research is not todo with astro though). So I'm obviously on the right track....

 

Link to comment
Share on other sites

Starting to pull together, the system is now far faster (orders of magnitude) with some additional optimisation and I wanted to show the star saturation system working.

On the left is the output - note the sharp peak as you'd expect, and the right the raw image indicating the flat top of a saturated star.

Screen Shot 2016-04-10 at 19.43.45.png

 

I'm continuing to work on this and I'm starting to see some good results.

 

Link to comment
Share on other sites

Just an example of the current working output but the system is pulling some interesting information out.

Left - raw image FITS autostretched in PI, middle output of the processing with autostretch in PI and right a screenshot of the location in Aladin. You'll note a bit of mirror flipping - just look at the double star to orientate. Click the image the native image (or it may be hard to see the detail).

Screen Shot 2016-04-10 at 21.25.11.png

I've still got some work to go (which will remove the squares for the estimates and a few other things).

 

Just goes to show.. in your noise... there is still signal...

Edited by NickK
Link to comment
Share on other sites

  • 2 weeks later...

Well I had a slow day today.. and ended up waking up at 7:30.. whilst the Mrs slept .. I decided to geek out a bit.. 

I've made the system not rebuild the saturated star at the moment - this is because I find that the estimation a little out and it then compresses the range for the existing background noise. However it does still scale the deconvolution (hence the two brightest saturated stars having a box - although this is too being quickly removed with some noise processing on the PSF.

Here's the output on the left - inverse and flipped (to align with the Aladin image on the right). There's a slight difference in rotation between the two images-  the Aladin image is aligned vertically during their observations - mine is as I observed it :D

Screen Shot 2016-04-24 at 18.21.15.png

Edited by NickK
Link to comment
Share on other sites

So I've been sorting out a new noise identification system in addition to the deconvolution..

Left - the raw 383L image (autostretched in PI)
Centre left - autostretched deconvolution output prior to the noise system, not that some 'stars' are actually the noise 'hot pixels' in the original.
Centre right - autostretched new output from the deconv with the new noise identification system in place (On close analysis these are "hot" in the sense of a normalised value of 0.0684 vs the background 0.0054-0.0061 range. I identify these as being suspect by standing 10% above the surrounding pixels then if suspect i check to see if it's a close match to the guider point spread function. If not then it's definitely noise..)
Right - Aladin non-autostretched

Screen Shot 2016-04-25 at 23.36.11.png

So the image on the centre right has significantly less noise (and thus false positives). I'll tune this some more as at the moment it's done on the input and to be honest I prefer the noisy input as signal is hidden in there.

Still to go is reenabling the saturation scaling and a second deconvolution step which now the noise is gone/heavily reduced .. should be far better.

This is one of the galaxies I'm after in the noise.. you can see the stars in the dim background (e.g. bottom left of the pixelated view) as well as the swirl of the galaxy.. (just in case you're wondering)

Screen Shot 2016-04-25 at 23.57.38.png

Edited by NickK
Link to comment
Share on other sites

  • 4 weeks later...

I've started playing with this again late last week on the train - with some decent progress in terms of the noise level matching.

I may have a look at the sigma stretching that the objective fits library does (I now use raw) because it seems to provide a good stretching mechanism for human viewed images.

I'm also hoping that with the automation/focusing projects almost done.. that once the job settles a little I'll have chance to capture more data.

 

Link to comment
Share on other sites

I figured I had enough playing with a single frame and attempting to pick details out of the output.. so after running overnight (CPU based code a little slow).. i7 finished at 0340 this morning.

This is autostretched in PI and I know why the boxes are there (that's the easier part to remove).. I did a 37 images, then registered in PI and did a simple integration:

PI-integration_27.png

 

The fun is this bit... galaxies that don't appear in the normal integration very well

Screen Shot 2016-05-25 at 07.26.44.png

  • Like 1
Link to comment
Share on other sites

One thing that is apparent in doing this method - you need good tracking! I was going to add some more commentary to the shot/post above but didn't have time.

With this method the guider tracking method that is normally used is "centroid mass" so the system looks for the brightest largest mass and then works out the centre point of the mass. This works if your target isn't subject to atmospheric convolution. Most will then use a 2 second or so tracking shot to guide on.

I know that people would suggest that utilising the star shapes in the final long exposure is the same, i.e. the sum is the same as taking the guider images, however from what I've seen it's more of a simplistic approximation that does not provide the fainter detail. The final image looses some possible signal into the noise due to the approximation.

Is this a bad thing? No, just misses what is there.

So if your tracking is that good you don't need guiding - then this method becomes even more valuable in that it's results are more reliable. In the shot above, ignoring the mismatch of noise floor that causes the boxes, the integration confirms the problems that "integration" using star matching actually has with wobbling guider stars.

I'm starting to lean more towards guider-less and mount accuracy being the ultimate way to really recover detail in images. With my recent interest in automation and stepper motor work for the focuser I'm starting to think that possibly making a direct drive mount may be the way to get this. Then using this method to wring out the final detail possible with the scopes size.

I can see why professional astronomers use a laser to provide a false star in this sense but that is not an option - and I think this method with the direct drive is possibly the way to go.

Link to comment
Share on other sites

  • 4 months later...

So I've had a play over the last couple of nights - including leave the laptop running (30mins per frame! CPUs are slow!) then used PI drizzle stack and autostretch:

drizzle_integration_Preview01.png

The PNG looses it a little (the PI 64bit version is a little more subtle on the noise square (I've yet to sort out the noise level adjustment so this is with noise).

The two galaxies have appeared with some additional shape (in PI and a little above).

I've also optimised this a little (hence only 30minutes!).. but there's still some more to go in terms of algorithm and optimisation.

Link to comment
Share on other sites

Found another slightly larger bug.. in my logic - phase correlation is phase strength, so scale is irrelevant. Hence if you scale a psf to estimate, it will simply tell you the same things - all scales have the same correlation.

Now if you do (x,z)*(y,z) correlation at the centre point.. that will give you the scale correlation without needing to estimate using iterations.. 

#start coding...

(x,y) correlation will give you the pin point of the pst to cover with the saturation but ignores scale (it's why this method is useful) but for incremental step based iterative estimation.. it's not the complete solution

(x,z)(y,z) correlation should then take 3D in slices to do estimation of the scale (rather than attempting todo a full 3D FFT thus should be faster

Edited by NickK
Link to comment
Share on other sites

  • 1 month later...

So... I've been playing more..

Centre is a 3D plot of the input area.. showing the input with stars - including a saturated star (large sloped star). The output looks like it loses detail.. but it's down to scale - so the right plot shows the rebuilt saturated stars and deconvolution, the right shows an autostretched lower clipped (you can see the base of the PSF as weird circle) - simply because the full scale plots of the saturated stars really dwarf the normal signal level!

So the output needs double precision! I'm currently using TIFF but I think I may need to switch to FITS!

 

Screen Shot 2016-12-07 at 20.16.37.png

 

So improvements.. there is still a little noise being added by the PSF still (the little peaks near the larger stars) which is next on the hit list!

 

Edited by NickK
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.