lunar crescent detection based on image processing algorithms
TRANSCRIPT
Lunar Crescent Detection Based on Image ProcessingAlgorithms
Mostafa Fakhar • Peyman Moalem • Mohamad Ali Badri
Received: 5 November 2013 / Accepted: 17 September 2014� Springer Science+Business Media Dordrecht 2014
Abstract For many years lunar crescent visibility has been studied by many astronomers.
Different criteria have been used to predict and evaluate the visibility status of new Moon
crescents. Powerful equipment such as telescopes and binoculars have changed capability of
observations. Most of conventional statistical criteria made wrong predictions when new
observations (based on modern equipment) were reported. In order to verify such reports and
modify criteria, not only previous statistical parameters should be considered but also some new
and effective parameters like high magnification, contour effect, low signal to noise, eyestrain
and weather conditions should be viewed. In this paper a new method is presented for lunar
crescent detection based on processing of lunar crescent images. The method includes two main
steps, first, an image processing algorithm that improves signal to noise ratio and detects lunar
crescents based on circular Hough transform (CHT). Second using an algorithm based on image
histogram processing to detect the crescent visually. Final decision is made by comparing the
results of visual and CHT algorithms. In order to evaluate the proposed method, a database,
including 31 images are tested. The illustrated method can distinguish and extract the crescent
that even the eye can’t recognize. Proposed method significantly reduces artifacts, increases
SNR and can be used easily by both groups astronomers and who want to develop a new
criterion as a reliable method to verify empirical observation.
Keywords Lunar crescent detection � Image processing � Image enhancement � Circular
Hough transform
1 Introduction
Studies in predicting early lunar crescent visibility can be divided into two main categories.
First, The statistical studies that are based on collection of observation reports over a long
M. Fakhar (&) � P. Moalem � M. A. BadriIsfahan, Irane-mail: [email protected]
123
Earth Moon PlanetsDOI 10.1007/s11038-014-9449-3
period of time. The results will be used to develop a criterion for prediction. But due to the
nature of this method, the criteria are not always reliable.
One of the first criterion was used by Babylonian. They deduced, if ‘‘Moon age’’1 was
over 24 h and ‘‘delay time’’2 was more than 48 min, then the crescent can be seen by naked
eye (Odeh 2004). Fotheringham (1910) and also Maunder (Odeh 2004). Developed another
criterion at the beginning of the nineteenth century. Then Bruin (1977) introduced another
criterion. Schaefer (1996) used 295 observation records as his database and tried to con-
sider effect of atmosphere. After Schaefer, Yallop (1997) and South African Astronomical
Observatory (SAAO) (2001) criteria have been developed based on his database. More-
over, many Muslim astronomers had also developed their own criteria such as: Ibn Tariq,
Habash, Al-Khwarzmi, Al-Khazin, Al-Tabari, Al-Fahhad, Al-Farghani,Thabet Bin Qurrah,
Al-Battani, IbnMaimon, Al-Biruni, Al-Sufi, IbnSina, At-Tusi and Al-Kashani (Ilyas 1994;
Schaefer 1996). As an example, Ilyas presented the criteria: Ilyas A, Ilyas B, Ilyas C that
each one relies on some specifications of Moon crescent (Odeh 2004). Odeh (2004)
established the last criterion (in the Islamic Crescent Observation Project, ICOP) which is
based on 737 records, in which Airless Topocentric (ARCV) and Topocentric crescent
Width (W) are two important variable in his calculations.
Second part of studies presents observing of new Moon crescent, using new methods
and tools like large telescopes. Using large telescopes provides high degree of magnifi-
cation, and consequently makes discerning of the Moon crescent easier. But high mag-
nification also causes high level of noise. In addition there is very low contrast between
Moon crescent and its background which makes it indistinguishable. We should also
consider that, due to ‘‘false contouring’’3 (Gonzalez et al. 2008) and inefficiency of optical
equipment to show true data near the borders, in some images noise and artifacts appear
beside the true data that makes the work more difficult. In such a case, eye can hardly
distinguish the noise and true data and consequently it becomes impossible to verify true
observations. As a solution Fatemi and Lesani (2008) studied some algorithms based on
spatial filters to extract Moon crescent from the observed images. In his method, spatial
filters, are designed and applied to the image. Applying this type of filters without addi-
tional processing can lead to proper results except images with very low SNR. In order to
improve SNR and detect Moon crescent visually, Rezaei et al. (2011) proposed a spatial
filtering algorithm using a circular window. This circular window turns from 0 to 360
degrees for each individual pixel. Another method was offered by Elsasser (2010) in public
observation center of Munich. He used large number of images, taken uninterruptedly in a
short period of time. This method relied on averaging techniques to reduce noise.
This article introduces a new method based on image processing algorithms to extract
Moon crescent from observed images. Initially the SNR of image is improved. Then
contrast is enhanced using a method based on histogram processing to recognize Moon
crescent visually. In addition circular Hough transform (CHT) is used to detect Moon
crescent centers. In CHT Moon crescent is considered as part of a circle (full Moon). In
order to confirm the method the results of both algorithms (visual detection and machine
detection) have been checked and analyzed at the end.
1 Moon age: time from astronomical new month to present time. It will be restarted when the moon againbecomes new.2 Delay time: period of time between sunset and moonset.3 False contouring: artificial edges produced especially near the boundaries of field of view.
M. Fakhar et al.
123
2 Methods
To drive the crescent out of the image for visual detection, a histogram processing algo-
rithm is used that increases the contrast and also an algorithm based on CHT is used in
parallel as a machine detection algorithm that can detect probable crescents. Figure 1
shows the block diagram generally that indicates how this system works.
2.1 New Moon Crescents Imaging
Today telescopes and binoculars are usually used to view new crescent. In order to observe
by a telescope, the angle of observing the crescent in the sky should be calculated. After
finding approximate location of the crescent, observation can be started. This attempt can
succeed or fail. The failure can be due to false calculation. If it be assumed that correct
position is targeted, sometimes the eye is unable to see the crescent. Figure 2 shows similar
examples.
Image-recording can ensure the observer to confirm their observations. It can be seen
easily that, images have very low contrast and this can make visual discerning difficult.
Figure 3 shows histogram related to the images of Fig. 2.
The eye can’t see the crescent—if exists- out of these observed images and it’s difficult
to verify observation if it is reported ‘‘seen’’. Therefore it is necessary to extract true
information from images.
In this research, the images are taken by a Canon camera that is installed on a 12’’
Schmidt-Cassegrain telescope. Figure 4 shows a sample image recorded by our equipment
and corresponding histogram.
Fig. 1 General block diagram for processing and discerning Moon crescent
Fig. 2 Two images of a new crescents
Lunar Crescent Detection
123
2.2 Space Domain Filtering
Background of images with high magnification, include high level of noise, similar to
pepper and salt noise. This noise can cause problems in the next steps of algorithm. In
order to solve the problem in space domain, a Gaussian smoothing filter is used. Gaussian
smoothing filter is one of the most well-known tool in the denoising and restoration of grey
level and color images. The idea of Gaussian smoothing is to use 2-D distribution as a
point-spread function, and this is achieved by convolution(Gonzalez et al. 2008). Then the
new output are smoothed (blurred) as they are convolved with 2D Gaussian filter. Window
size is selected 5 and Standard deviation is fixed on 0.33.
2.3 Histogram-Based Algorithm
Global histogram equalization maps the input image’s intensity values so that the histo-
gram of the resulting image will have an approximately uniform distribution (Duan 2004;
Natendra et al. 1981). Given an image A(x, y) and a desired output image B(x, y) there is
some transformation function, f, which maps A to B. All intensity values in A in the region
of values nA to nA ? dnA will have their values mapped to a corresponding region in B in
the value range of nB to nB ? dnB. Each of these images will have a probability density
function (PDF) PA(nA) and PB(NB). Assuming a 1-1 mapping, it is easy to show that:
Fig. 3 The histogram of two images recorded from the location of the crescent
Fig. 4 Sample of taken images (left) and corresponding histogram (right)
M. Fakhar et al.
123
PAðnAÞdnA ¼ PBðNBÞdnB ð1Þ
using this relationship, it can be shown that the mapping function from A to B is:
f nAð Þ ¼ZnA
0
pðuÞdu ¼ nFAðnAÞ ð2Þ
where FA nAð Þ is the cumulative probability distribution function of the original image.
Therefore, to return a histogram equalized image, an image must be transformed using its
cumulative probability function. The primary reason for histogram equalizations success at
image enhancement is because it expands the dynamic range of intensity values while
flattening the histogram.
Many alterations of histogram equalization have been proposed to counter the effects of
this range expansion (Duan 2004). The most basic is adaptive local histogram equalization.
A Moon crescent image histogram has low degree of diffusion so Moon crescent and the
background of the image would be some sort of similar. This could make visual discerning
of data difficult. Local histograms equalizing can be a useful way to enhance the quality of
the image however; since data is not presented on the whole image, using global histogram
equalization increases the noise. The data which represent the crescent can be found only
in particular parts of the image and there is no useful information in whole part of images.
Therefore if the algorithms process the quality enhancement locally, we will reach better
result. The local computations are made by Eq. (3):
g ¼ hkðpði; jÞÞ0\i\m
0\j\nð3Þ
where parameter p is the grey level value of the pixel (i, j) from kth window, hk shows the
output on kth window after equalization, m and n are local window size which should be
optimized based on the imaging equipment. In this article, based on used imaging
equipment m, n are selected 20. In fact g presents an output image in which all individual
pixels are made based on the original image. Two samples of the crescent images and
corresponding outputs are shown in Figs. 5 and 6.
Fig. 5 a Original image, b global histogram equalization applied, c local histogram equalization applied
Fig. 6 a Original image, b applying histogram equalizing algorithm, c applying local algorithm
Lunar Crescent Detection
123
2.4 Edge Detection
An edge is the boundary between an object and the background. The shape of edges in
images depends on many parameters: The geometrical and optical properties of the object,
the illumination conditions, and the noise level in the images (Chidiac 1999). In other
words an edge is defined by a discontinuity in gray level values. After enhancement the
quality of the Moon crescent’s image, true data should be extracted. In regard to the grey
level difference of the pixels presenting Moon crescent data and the image background,
edge detection can be used as an appropriate tool. In the next step edge detection is carried
out by using Sobel operator and Canny algorithm. Figure 7 indicates the used 3 9 3 Sobel
windows.
Sobel operator acts as a bi-dimensional differentiator. By using the Sobel operator, the
points of the image with high degree of frequency range can be observed on space domain,
and high degree of grey level changes, can be detected and highlighted. In order to drive
the crescent Moon out of the background, given Sobel windows are convolved with the
original image and then the output image is recorded. Canny algorithm initially smoothes
the image and reduces its noise; then it uses differential operators to find the regions with
high degree of grey level variation. At the next stage, the algorithm traces the found edges
in order to distinguish the shapes by connecting the edges. Figure 8 indicates the result of
applying Sobel operator and Canny algorithm to the image.
The algorithm represents good results for both methods while Canny algorithm can also
link the edges. Figure 9 indicates the result after applying Gaussian smoothing filtering and
then Canny algorithm.
2.5 Circular Hough Transform (CHT)
After edge detection, the resulting connected component is labeled. Each connected
component is expressed as a chain of the coordinates of its inputs. We connect pairs of
points of the same component, using a sliding window. HT is a feature extraction technique
Fig. 7 Masks used as Sobeloperator
Fig. 8 Result on Fig. 5a. a Applying Sobel operator, b applying Canny algorithm
M. Fakhar et al.
123
used in image analysis. HT can be used for detecting simple shapes, such as straight lines,
circles or ellipses. HT with transforming data to other areas tries to detect the specific
patterns. In this article the aim is to find circle shapes and we should use a kind of HT that
can detect circle patterns. So we use CHT which is based on HT procedure. In this method
the center of circles that may exist in image are detected. Detection of the circle that the
crescent may perch on it is done by CHT. In fact the image center shows the center of
Moon. The output of edge detection operation will be a binary image. If in edge detection
algorithm, a pixel is detected as the edge its value is chosen 1 otherwise 0 assigned to the
correspond pixel.In CHT algorithm we have:
Fig. 9 Canny edge detection result on (a) Fig. 5a (b) Fig. 6a
Fig. 10 Result of CHT on (a) Fig. 9a (b) Fig. 9b
Fig. 11 a Moon image (b) edge detection (c) CHT result
Lunar Crescent Detection
123
ðx� x0Þ2 þ ðy� y0Þ2 ¼ r2 ð4Þ
As it can be seen the circle got three parameters, r, x0 and y0, where x0 and y0 are the
center of the circle in the x and y direction, respectively, and where r is the radius. The
parametric representations of the circle are:
x ¼ x0 þ r cosðhÞ ð5Þ
y ¼ y0 þ r sin hð Þ ð6Þ
Fig. 12 a, b Noisy image of Fig. 5a and 6a (c) and (d) Edge detection of noisy images (e) and (f) CHTresult of low SNR images
Table 1 Single image SNRestimation of Fig. (13)respectively
Fig 13.a : 0.72 Fig 13.b : 0.84 Fig 13.c : 2.53
Fig 13.d :1.09 Fig 13.e : 0.93 Fig 13.f : 2.02
Fig 13.g : 0.86 Fig 13.h : 1.61 Fig 13.i : 0.86
Fig 13.j : 1.26 Fig 13.k : 1.12
M. Fakhar et al.
123
Thus the parameter space for a circle will belong to R3 whereas the line only belonged
to R2. As the number of parameters needed to describe the shape increases as well as the
dimension of the parameter space R increases so do the complexity of the HT.
In order to simplify the parametric representation of the circle, the radius can be held as
a constant or limited. At each edge point we draw a circle with center in the point with the
desired radius. This circle is drawn in the parameter space, such that our x axis is the x0
value and the y axis is the y0 value while the z axis is the radius. At the coordinates which
belong to the perimeter of the drawn circle we increment the value in our accumulator
matrix which essentially has the same size as the parameter space. In this way we sweep
over every edge point in the input image drawing circles with the desired radii and
incrementing the values in our accumulator. When every edge point and every desired
radius is used, we can turn our attention to the accumulator. The accumulator will now
contain numbers corresponding to the number of circles passing through the individual
coordinates. Thus the highest numbers (selected in an intelligent way, in relation to the
radius) correspond to the center of the circles in the image (Kimme et al. 1975; Rizon et al.
2005).
The distance of any point on the circle from center equals to r. So we can conclude that
if the distance of a point (pixel) from circle’s center be equal r, that point is on the circle. In
different point of view we can say if a point on Cartesian coordinate system exists that the
relation of it to the mentioned circle is a question, a line should be drawn from that point
and the length of r if the circle passes the center, the point belongs to the mentioned circle.
Fig. 13 Initial images used as inputs
Lunar Crescent Detection
123
In CHT, for processing the image of Moon crescent we use the idea of belonging points to
the circle in CHT accumulator. But the difference is here, if the pixels which in the edge
detection operation assumed 1 belong to a circle with the radius of r = 150, drawn circles
should cross each at the specific pixel which is the center of that circle with radius of 150.
The mentioned point can be the supposed center of Moon. The result of the CHT algorithm
in expressed method is shown in Fig. 10.
Center of the circle that Moon crescent is located on, has been diagnosed well with a
suitable approximation. In fact if there is a Moon crescent in the image, the presented
algorithm in Fig. 1 can either improve image quality for visual recognition or find the
possibility of Moon crescent existence with analyzing centers of circles. If ideally we have
an image of Moon like Fig. 11a, b, c represent result of the proposed algorithm.
The algorithm presents really good result which shows its high capability. But certainty
there are limitations like minimum SNR which should be assessed as it can cause failure in
detection of crescents. Thus in order to evaluate the algorithm extra Gaussian noise is
added to images until the algorithm fails. SNR of single images are calculated based on the
method introduced as ‘‘Single Image Signal-to-Noise Ratio Estimation’’(Thong et al.
2001). For Figs. 5a and 6a the estimated SNR are 0.95 and 1.07 respectively. In next step
the white Gaussian noise is added until the algorithm failed to detect the centers that
illustrates the minimum required SNR. The limited SNRs for Figs. 5a and 6a are calculated
0.87 and 0.82 respectively. Figure 12 shows noisy images and the algorithm output:
Fig. 14 Local enhancement done on images
M. Fakhar et al.
123
3 Result
In this paper, 31 images are tested and analyzed. For tested database acceptable and
attributable results is achieved. The algorithm is also examined by other databases:
Different Moon Crescent images are taken under different climate conditions so images
have different SNRs. Calculated SNRs are listed in Table 1. For example Fig. 13a, b SNRs
are 0.72 and 0.84 respectively. In addition contour effect is observed specially in Figs. 14a
and g that can cause failure in next steps. Contour effect is created in borders images.
These phenomena should be considered and reduced during photography. Contour effect in
Fig. 13g caused many artifacts which can be clearly seen in Fig. 15g. In this case, the
crescent doesn’t locate near borders, so CHT could extract it from background.
In cases with low SNRs like Fig. 13a, e, i, SNRs are 0.72, 0.93 and 0.86 respectively.
Noise is very similar to data and vice versa. In such cases the edge detection algorithm may
consider noise instead of signal like Fig. 15i and true data may be considered as noise like
Fig. 15e that crescent is not clearly recognized.
CHT is a robust algorithm which is used to distinguish center of Moon crescents.
Figure 16 shows the CHT output. Amazingly CHT have acceptable performance in all
cases including low SNR cases. Figure 16g shows successful result of applying CHT to
Fig. 13g.
The algorithm performs noticeably successful for all images which illustrate the
capability of the algorithm. Of course when the crescent is under high intensity of noise the
algorithm (likelihood estimation process) predicts more than one center like Fig. 13a, e, g,
Fig. 15 Edge detection result
Lunar Crescent Detection
123
Fig. 16 CHT result based on edge detection result
Table 2 The SNR in which thealgorithm failed to detect thecenters for Fig. (13) respectively
Fig 13.a : 0.62 Fig 13.b : 0.75 Fig 13.c : 0.46
Fig 13.d : 0.92 Fig 13.e : 0.75 Fig 13.f : 0.55
Fig 13.g : 0.75 Fig 13.h : 1.02 Fig 13.i : 0.73
Fig 13.j : 0.89 Fig 13.k : 0.91
Fig. 17 Algorithm performance while adding noise and reducing SNRs of Images in Fig. 13
M. Fakhar et al.
123
i. To overcome this trouble the center which is determined with highest number of edges is
assumed as correct center. Detection of incorrect edges leads to face problems in CHT
process.
Fig. 18 Initial images used as inputs
Lunar Crescent Detection
123
To evaluate the algorithm white Gaussian noise is added to all images in Fig. 13 until
CHT failed to detect the centers. Table 1 shows estimated SNRs of images and Table 2
illustrates the SNRs in which the algorithm failed.
Fig. 19 Local enhancement done on image of Fig. 18
M. Fakhar et al.
123
As it can be seen in Fig. 17 there is minimum SNR that below it, algorithm fails to
detect correct centers. The reason is, although CHT is robust in cases with high intensity of
noise but under a minimum SNR noise may be detected as true data and vice versa. Under
such circumstance, edge detection output is mixture of true and false edges. As much the
SNR is lower, edge detection output includes more wrong edges and consequently under
minimum SNR, CHT will fail to detect correct centers.
Fig. 20 Edge detection result of Fig. 18
Lunar Crescent Detection
123
Fig. 21 CHT result based on edge detection result of Fig. 18
M. Fakhar et al.
123
The database is divided into two parts. Second part of data has higher SNR and is easier
to detect by naked eye or optical instrument without any process. The result of the algo-
rithm for the second part of database is also shown in Figs. 18, 19, 20, 21.
4 Discussion
Clearly processing of Moon crescent and its surface has more applications in the world and
Moon surface image analysis seems to be more practical in future. For example for landing
on the Moon or the other planets, spacecrafts need image processing technology.
The developed algorithm seems really flexible and practical. It should be considered
that the whole performance of the algorithm is depended on taking true and useful images
using optical instrument like cameras and telescopes which have various options. There-
fore the method we collect raw data is really important. Furthermore as the background of
images is always bright, clarifying correct and overexposed images is really hard. So,
setting true camera or telescope options is noticeably essential.
5 Conclusion
New presented method for lunar crescent detection based on image processing algorithms
such as edge detection and HT, has acceptable practical results. Extracting the objects that
the eye is unable to recognize can be beneficially used by astronomers as a reliable method
as a way to verify result of reports. In addition, using this technique can help to have more
accurate criteria.
References
F. Bruin, Vistas Astron. 21, 331 (1977)J. Caldwell, C. Laney, First Visibility of the Lunar Crescent. SAAO, African Skies 5 (2001)H. Chidiac, D. Ziou, Classification of Image Edges. Vision Interface’99. Troise-Rivieres, Canada (1999)J. Duan, G. Qiu, Novel Histogram Processing for Color Image Enhancement. In: Third International
Conference on Image and Graphics. pp. 55–58 (2004)M. Elsasser, (2010), http://www.mondatlas.de/other/martinel/. Accessed 5 Apr 2012S. Fatemi, M. Lesani, Moon Crescent Extraction Based on Image Processing Methods. In: 3rd calendar
conference, (2008) (in Persian)J.K. Fotheringham, Mon. Not. R. Astron. Soc. 70, 527 (1910)R.C. Gonzalez, R.E. Woods, Digital Image Processing (Prentice-Hall, Upper Saddle River, New Jeresy,
2008)R.C. Gonzalez, R.E. Woods, S.L. Eddins, Digital Image Processing Using Matlab (Pearson Prentice Hall,
Upper Saddle River, New Jeresy, 2004)M. Ilyas, QJRAS 35, 425 (1994)C. Kimme, D. Ballard, J. Sklansky, Finding circles by an array of accumulators. Commun ACM 18(2),
120–122 (1975)P. Natendra, Real-time adaptive contrast enhancement. IEEE Trans. Pattern Anal. Mach. Intell. 3, 655–661
(1981)M. Odeh, New criterion for lunar crescent visibility. Exp. Astron. 18, 39 (2004)H. Rezaiee, A. BromandNia, M.R. FeiziDerakhshi, Moon Crescent Extraction From Observed Photo-
graphed Images Using Circular kernel Transformation. In: 3rd National Conference on ComputerScience and Information Technology. (2011) (In Persian)
M. Rizon, H. Yazid, P. Saad, Object detection using circular Hough transform. Am. J. Appl. Sci. 2(12),1606–1609 (2005)
Lunar Crescent Detection
123
B. Schaefer, QJRAS 37, 759 (1996)J.T.L. Thong, K.S. Sim, C.H. Phang, Single image signal to noise ratio estimation. Scanning 23, 328–336
(2001)B. Yallop, A method for predicting the first sighting of the new Crescent Moon. RGONAO Technical Note
No. 69 (1997)
M. Fakhar et al.
123