mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Hobbies > Astronomy

Reply
 
Thread Tools
Old 2016-11-17, 21:38   #23
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29×3×7 Posts
Default

I started from first principles, using ImageMagick to perform basic image manipulations to snip out a 21x21 pixel star image for an experimental PSF (psf.png), to select a 256x256 region near Capella (dportion.png) and then to convert each of these to text format for subsequent custom code.

I then implemented CLEAN (if it's good enough for the HST before corrective optics were installed, it's good enough for me) and then ran 400 iterations with a lambda of 0.2. (Roughly speaking, CLEAN removes lambda * the PSF from the maximum intensity in each iteration.) The code is very from from optimal. It works on each of the RGB planes independently and took 4.5 minutes for the complete process to produce an RGB clean map.

The code is very crude (I'm very much a novice in this field) and doesn't estimate remaining noise levels. Examination of the output, clean.png, suggests that some noise crept in. Examination of the residue map, residue.png, suggests that only noise now remains though that's undoubtedly arguable.

In retrospect, I should either have converted to grey scale first (immediately making the CLEAN process three times faster) or generated three separate single-colour images. The PSF could almost certainly have been estimated better by removing noise from it. Further speed improvements could come from using a smaller PSF (run time is proportional to its area) and subtracting lambda * PSF from several independent maxima at each iteration before recalculating the maxima from the residue map. Fiddling with the value of lambda might also be productive.

The clean map almost always looks a mess and is traditionally blurred with a Gaussian. The clean1 image is clean.png converted to grey scale and then blurred (by ImageMagick) with a kernel of radius 3 pixels and standard deviation of 1.5 pixels.

You might want to play with IM and/or the GIMP to perform colour map manipulations to show finer detail (and the noise) in the images.

I claim that clean1.png is in some sense better than dportion.png. Capella itself is at least as nasty when cleaned as in the original (contrast stretch both to see this particularly clearly) but Capella C is much more easily visible as the center of the three stars in an arc below Capella.

The cepstrum of dportion.png is given in cep.png. It shows a very clear ellipse with major axis aligned along the coma in the original image. If it were a circle, its radius would be the size of the defocussing PSF; if it were a straight line its length would be the size of the motion blur. I do not (yet) know how to transform an elliptical cepstrum into a smooth PSF. No doubt the computed images would look nicer if I could.

Fun stuff. CLEAN code and the text-format files available on request. It took me about three days work from a standing start. Cleaning the source (pun intended) may happen if I get enough round tuits.
Attached Thumbnails
Click image for larger version

Name:	dportion.png
Views:	108
Size:	294.7 KB
ID:	15144   Click image for larger version

Name:	clean1.png
Views:	106
Size:	21.5 KB
ID:	15145   Click image for larger version

Name:	residue.png
Views:	105
Size:	358.1 KB
ID:	15146   Click image for larger version

Name:	clean.png
Views:	110
Size:	3.4 KB
ID:	15148  
Attached Images
 
xilman is offline   Reply With Quote
Old 2016-11-18, 01:57   #24
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29×3×7 Posts
Default

Quote:
Originally Posted by xilman View Post
In retrospect, I should either have converted to grey scale first
Doh!

I just realized that I should have converted to HSV, CLEANed the V component and then used the original H and S components to colourize the restored image because very little information is in the latter pair.

Proving I'm just a novice ...
xilman is offline   Reply With Quote
Old 2016-11-19, 07:39   #25
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

250008 Posts
Default

Quote:
Originally Posted by xilman View Post
I just realized that I should have converted to HSV, CLEANed the V component and then used the original H and S components to colourize the restored image because very little information is in the latter pair.
OTOH, as there is clear chromatic aberration in the original, perhaps I shouldn't.

There's a discussion going on in the ImageMagick forum where several more good ideas for experimentation have been produced.
xilman is offline   Reply With Quote
Old 2016-11-22, 18:44   #26
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29·3·7 Posts
Default

Now trying to find a much better PSF, primarily by co-adding the images of N stars to reduce the noise by sqrt(N). Sub-problem: find the stars.
  1. Manual selection is too tedious.
  2. Cross-correlation between one star and the entire image worked, sort of, but missed lots of stars which were obvious to the human eye.
  3. Thresholding at 8% (value found by experiment) of the image finds most, if not all, stars, and relatively little noise.
Thresholding also drew my attention to a large number of stuck red pixels in the lower right corner of the image. Looks like the CCD might be rather more defective than is desirable.

Next phase is to find connected components of the thresholded image, locate the centroid of each component and co-add a region of the original image around the centroid to form an aggregate PSF. Removing all isolated single pixels from the thresholded image will remove noise peaks and the stuck pixels. Big problem with Capella because it is saturated. Propose removing that one by hand or, perhaps, dropping all connected components which are "too large" in some sense.

However, something should be done about the stuck pixels. Perhaps replace by 3x3 median for all pixels set at maximum value? Do this in each colour separately of course.

Currently working on the original image converted to grey-scale for simplicity and ease of computation.

Comments and suggestions welcomed.
xilman is offline   Reply With Quote
Old 2016-11-27, 19:39   #27
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29·3·7 Posts
Default

Stilll having fun with this stuff, especially with colour processing.

According to ImageMagick the .nef image claims to be in the sRGB colourspace with gamma 0.45455. Displaying the images with gamma=2.2 (1/.45455) certainly gives a visually more pleasing result on my monitor. Attached are versions of a 256x256 region near Capella. color2_2.png is the full RGB with a gamma correction of 2.2 applied; gray2_2.png is converted first to grey scale and gamma applied. The others are the respective red, green and blue channels extracted and then gamma corrected.

The full colour image shows a strong red cast. I've already noted the stuck pixels (not shown in the portion of the full image attached here) and I suspect that the cyan area of Capella may be dead red pixels. Careful examination of enlargements of the rest of the image also indicates suspiciously large number of zero or very small pixel values in the red channel.

Contrast is highest in the green channel and lowest in the red. Perhaps thats because the camera is designed for human vision where sensitivity is greatest in the green region. Note the diffraction halo around Capella is almost entirely in the green channel and essentially invisible in red.

Not sure what to conclude from this, other than perhaps I should concentrate on the green channel for the time being.
Attached Thumbnails
Click image for larger version

Name:	color2_2.png
Views:	94
Size:	322.7 KB
ID:	15185   Click image for larger version

Name:	gray2_2.png
Views:	91
Size:	110.0 KB
ID:	15186   Click image for larger version

Name:	red2_2.png
Views:	90
Size:	108.8 KB
ID:	15187   Click image for larger version

Name:	green2_2.png
Views:	91
Size:	108.8 KB
ID:	15188   Click image for larger version

Name:	blue2.2.png
Views:	84
Size:	107.2 KB
ID:	15189  

xilman is offline   Reply With Quote
Old 2016-11-27, 19:54   #28
fivemack
(loop (#_fork))
 
fivemack's Avatar
 
Feb 2006
Cambridge, England

144238 Posts
Default

Would you like some more images? I cannot guarantee consistency of point spread function, but it was a nice clear night on Thursday and I can make available any of:

* Five exposures of the Pleiades, in which you can definitely see the surrounding nebulosity if you stack them and look in the blue channel

* 24 exposures of the region around the M33 galaxy in Triangulum, which probably say something interesting about the lens properties when you try to line them up by moving integer numbers of pixels and minimising sum-of-absolute-difference-over-bright-pixels in a region around the galaxy

* Three exposures with a wider-angle lens of a region from Auriga across to Gemini with the four rich star clusters M35-M38

* Twelve exposures (nine seconds f/4) of the reasonably rich cluster M41 in Canis Major, though it was near enough the horizon that there are tree branches and bits of house in the full frames and probably cropping to the cluster is the way to start.

These are 70MB per exposure so I don't really want to upload them all on spec.

What I would really like is some kind of plausible approach to subtracting out the light-pollution background - it's a uniform shape between images, because light pollution is uniform on a ten-degree scale and all I'm seeing is a measurement of the vignetting of the lens/detector combination, but it's bright enough that it leaves the images very unsatisfying if I just do a gentle high-pass filter by subtracting an Gaussian-blur-with-100-pixel-diameter of the image from the image.

I need some kind of (PSF-driven?) kludge for working out when to try subtracting from a saturated pixel and when to leave the pixel saturated ... my inclination would be to subtract from saturated pixels whose neighbours are not all saturated, and leave the middles of saturated blobs as saturated.
fivemack is offline   Reply With Quote
Old 2016-11-27, 19:57   #29
fivemack
(loop (#_fork))
 
fivemack's Avatar
 
Feb 2006
Cambridge, England

191316 Posts
Default

Quote:
Originally Posted by xilman View Post
Thresholding also drew my attention to a large number of stuck red pixels in the lower right corner of the image. Looks like the CCD might be rather more defective than is desirable.
Remember the CCD has a Bayer mosaic of colour filters in front of it, so one hot red pixel is going to have its hotness propagated to at least its eight neighbours and probably a bit further during the demosaicing phase; I think there are two adjacent hot red pixels and the rest of that region is a processing artefact.
fivemack is offline   Reply With Quote
Old 2016-11-27, 21:30   #30
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29·3·7 Posts
Default

Quote:
Originally Posted by fivemack View Post
Remember the CCD has a Bayer mosaic of colour filters in front of it, so one hot red pixel is going to have its hotness propagated to at least its eight neighbours and probably a bit further during the demosaicing phase; I think there are two adjacent hot red pixels and the rest of that region is a processing artefact.
Ah, I wasn't aware of the structure of the detector in that amount of detail. Makes some sense. I find it somewhat surprising that so many red spots scattered over such a large area of the complete 12M pixel image come from a processing artefact arising from only two CCDs.

Note that there is also evidence of a dead red pixel (or few) in the Capella region where there is a pronounced cyan edge to the disk.

Images of a uniform black (or almost black) and a uniform white (or almost white) field should nicely characterize pepper and salt noise in each channel. I don't know if you've tried this. These would allow you to compensate for dark field and stuck pixels as the first two steps in the data processing pipeline. It would be interesting to find out the results.
xilman is offline   Reply With Quote
Old 2016-11-27, 21:41   #31
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29×3×7 Posts
Default

Curious.

I've been working on the original NEF image converted to PNG format with ImageMagic thus convert capella.full.nef -colorspace rgb -quality 00 -define png:format=48 capella.png and that image shows a smattering of stuck red (and only red) pixels in the south east corner.

Your .jpg conversion doesn't show those artefacts so it looks like we may have been talking to cross porpoises.

I'm now wondering which if either is "correct". The old adage about always work with the originals is why I went down the chosen route --- I didn't know what artefacts JPEG conversion may have created whereas PNG quality 0 should preserve everything.

Added in edit:
convert capella.full.nef foo.jpg
pcl@anubis ~/Pictures/process/save $ display !$
display foo.jpg

shows the same red artefacts. Is one of our .NEF images corrupted in some way? The md5sum of the one I downloaded is
58204a0ff0f903e0f6b27fd9c7e87030 capella.full.nef

Last fiddled with by xilman on 2016-11-27 at 22:13 Reason: Fix tag
xilman is offline   Reply With Quote
Old 2016-11-27, 21:57   #32
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29×3×7 Posts
Default

Quote:
Originally Posted by fivemack View Post
Would you like some more images? I cannot guarantee consistency of point spread function, but it was a nice clear night on Thursday and I can make available any of:

{Deletia}

These are 70MB per exposure so I don't really want to upload them all on spec.
I'd like all of them but the only plausible transfer mechanism is sneakernet. I should provide you with a USB flash drive of adequate capacity.
Quote:
Originally Posted by fivemack View Post
What I would really like is some kind of plausible approach to subtracting out the light-pollution background - it's a uniform shape between images, because light pollution is uniform on a ten-degree scale and all I'm seeing is a measurement of the vignetting of the lens/detector combination, but it's bright enough that it leaves the images very unsatisfying if I just do a gentle high-pass filter by subtracting an Gaussian-blur-with-100-pixel-diameter of the image from the image.
Tried a morphological filter? A standard is to roll a large diameter sphere (or circle for a 1-d image) underneath image surface and record height of the centre of the sphere at each pixel. Add the radius of the sphere to each height and that's your computer background to subtract from the raw image. Computationally cheaper approaches are to roll a circle along each scan line or to roll a cylinder along two orthogonal directions but the sphere almost always gives the best results.

Hmm, perhaps I should have done that one the Capella image before any further processing.
Quote:
Originally Posted by fivemack View Post
I need some kind of (PSF-driven?) kludge for working out when to try subtracting from a saturated pixel and when to leave the pixel saturated ... my inclination would be to subtract from saturated pixels whose neighbours are not all saturated, and leave the middles of saturated blobs as saturated.
I don't have a quick good answer to that one. Try fitting a low-order polynomial in (x,y), or a Gaussian, to the neighbourhood of the isolated saturated pixels perhaps. If you've done background suppression there will still be some room at the top of the intensity scale for the peak to stand a chance of not being computed as 100% intensity. Sounds very much a kludge though.
xilman is offline   Reply With Quote
Old 2016-11-27, 22:07   #33
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

29×3×7 Posts
Default

Quote:
Originally Posted by xilman View Post
The full colour image shows a strong red cast.
Quote:
Originally Posted by fivemack View Post
What I would really like is some kind of plausible approach to subtracting out the light-pollution background
A light dawns, figuratively and literally. I bet you live in an area with a large amount of low-pressure sodium street lighting.

Last fiddled with by xilman on 2016-11-27 at 22:20
xilman is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't add assignments manually dragonbud20 Information & Answers 5 2015-11-18 09:39
Why factoring is single-core designed? otutusaus Software 33 2010-11-20 21:05
Oil immersion lens davieddy Puzzles 17 2010-06-26 10:47
How fast is your internet connection? (focus on dial-up) eepiccolo Lounge 8 2003-05-11 06:04
Manually adding primes Dærk Software 5 2002-11-01 14:01

All times are UTC. The time now is 12:59.


Fri Jul 16 12:59:48 UTC 2021 up 49 days, 10:47, 2 users, load averages: 1.31, 1.52, 1.50

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.