AUTOMATIC FACIAL ACNE DETECTION
FOR MEDICAL TREATMENT
BY
THANAPHA CHANTHARAPHAICHIT
A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF
THE REQUIREMENTS FOR THE DEGREE OF MASTER OF
ENGINEERING (INFORMATION AND COMMUNICATION
TECHNOLOGY FOR EMBEDDED SYSTEMS)
SIRINDHORN INTERNATIONAL INSTITUTE OF TECHNOLOGY
THAMMASAT UNIVERSITY
ACADEMIC YEAR 2016
AUTOMATIC FACIAL ACNE DETECTION
FOR MEDICAL TREATMENT
BY
THANAPHA CHANTHARAPHAICHIT
A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF
THE REQUIREMENTS FOR THE DEGREE OF MASTER OF
ENGINEERING (INFORMATION AND COMMUNICATION
TECHNOLOGY FOR EMBEDDED SYSTEMS)
SIRINDHORN INTERNATIONAL INSTITUTE OF TECHNOLOGY
THAMMASAT UNIVERSITY
ACADEMIC YEAR 2016
ii
Abstract
AUTOMATIC FACIAL ACNE DETECTION
FOR MEDICAL TREATMENT
by
THANAPHA CHANTHARAPHAICHIT
Bachelor of Engineering in Electronic and Communication Engineering, Rajamangala
University of Technology Thanyaburi, 2013
Master of Engineering (Information and Communication Technology for Embedded
System), Sirindhorn International Institute of Technology, Thammasat University,
2016
In this thesis, the implementation of the automatic acne detection system has
been made by the various method of image processing. It consists of two main parts;
blob detection and Bayesian's classification. First, a blob detection technique is
utilized to facial images of patients to reveal circular structures of acne and its
amounts. An input image is RGB, then it is converted into HSV and grayscale
pictures, these are done to compare and relate points of interest. There may be some
misdetection of acne such as blemish and freckle, binary thresholding has been used
afterward to contrast and remove the mistakes easier. Using of box shape created by
MATLAB, it has been made as an indication to the regions of interest in the results,
they are seen as markings. For the second part, the output of blob detection has been
fed into feature extraction and Bayesian classification algorithm to filter out the
misdetection results from the previous step which boosts the overall system
performance. The method of feature extraction composes of acne characteristic
calculation such as skewness, kurtosis or entropy. Lastly, an algorithm of
classification is applied as training and testing process to have the system
automatically distinguish facial contents more deeply. Experimental output increases
accuracy, precision and sensitivity with constant value, but all of these depend on
location, shape and lighting condition of the facial image.
Keywords: image processing, acne, blob detection, feature extraction, Bayesian
classification, image processing, acne detection, binary threshold
iii
Acknowledgements
First and foremost, I would like to give my highest regards to SIIT, Tokyo
Tech., and NSTDA for the support of ICTES program and provide a great opportunity
of research in my interested topic.
I would like to express my deepest gratitude to my advisor, Associate
Professor Dr. Bunyarit Uyyanonvara for advice and suggestions in progressing this
study. Also, I would like to give a great appreciation to Dr. Chanjira Sinthanayothin,
Dr.Akinori Nishihara and Dr. Pakinee Aimmanee as thesis committees for their
helpful suggestions and feedback toward this project during every presentation.
I also would like to thank my friends: Piyaphat Phukphan and Sorn Suksatra.
They have recommended the ideas, suggested about algorithm and equipment I should
implement, and grammar which is the most difficult for me. My research could not
have been completed without them.
Finally, I would like to give thanks to my parents whom taken care of me over
these years of my life. Without them, I may not make this day come true.
iv
Table of Contents
Chapter Title Page
Signature Page Abstract i
Abstract ii
Acknowledgements iii
Table of Contents iv
List of Figures vii
List of Tables viii
1 Introduction 1
1.1 Motivation 3
1.2 Objectives 4
1.3 Thesis Structure 5
2 Literature Review 6
2.1 Basic Knowledge of an Acne 6
2.2 Grayscale, RGB and HSV color model 6
2.3 Binary Threshold 9
2.4 Blob Detection and Markings 10
2.5 Feature Extraction 11
2.6 Bayesian Classification 14
3 Thresholding method and experimental result 17
3.1 Proposed Method 17
3.2 Methodology 18
3.2 1 RGB to Grayscale Conversion 18
3.2.2 Maximum Intensity and Gray-Scale Normalization 19
v
3.2.3 RGB to HSV Conversion 19
3.2.4 Brightness Extraction 20
3.2.5 Image Subtraction for Region of Interest 20
3.2.6 Binary Threshold 20
3.2.7 Spot and Region Removal 21
3.2.8 Labeling and Structuring a Mark 22
3.2.9 Marking Acnes on Image 22
3.3 Experimental Results and discussion 23
3.3.1 Thresholding Result 23
3.3.2 Ground Truth 26
3.3.3 Detection Performance Evaluation 27
4 Bayesian classifier method and experimental result 31
4.1 Proposed System 31
4.2 Methodology 33
4.2.1 Blob detection 33
4.2.2 Feature extraction 33
4.2.2.1 Mean Value 34
4.2.2.2 Variance Value 34
4.2.2.3 Skewness 34
4.2.2.4 Kurtosis 35
4.2.2.5 Energy 35
4.2.2.6 Entropy 36
4.2.3 Bayesian Classification 36
4.2.3.1 Training Process 37
4.2.3.2 Testing Process 37
4.3 Experimental result and discussion 38
vi
5 Conclusion and Future work 43
5.1 Summary of Thresholding method 43
5.2 Summary of Bayesian classifier method 44
5.3 Future Work 44
References 46
Appendix 50
Appendix A 51
vii
List of Figures
Figures Page
2.1 Example of acne on facial image 6
2.2 Grayscale intensity range 8
2.3 RGB color plane (Primary and secondary light) 8
2.4 HSV color model in cone shape 8
2.5 Original grayscale image (left), Post-thresholding binary image (right) 9
2.6 Example of connectivity detection mask 11
2.7 Blob detection on grayscale image (left),
Blob detection on RGB image (right) 11
2.8 Negative skewness (left), Positive skewness (right) 14
2.9 Uniform kurtosis = 1.8 (left), Normal kurtosis = 3.0 (middle),
Logistic kurtosis = 4.2 (right) 14
3.1 The flowchart of the proposed method 17
3.2 Output with acne marking 23
3.3 First image processing 24
3.4 Second image processing 25
3.5 Third image processing 26
3.6 Ground truth and Original image 27
4.1 The flowchart of the proposed method 32
4.2 Output image of result 39
4.3 Ground truth image 40
4.4 Output image of result 40
4.5 Negative image of result 40
viii
List of Tables
Tables Page
3.1 Detection Performance Evaluation 27
3.2 Result of acne detection from Thresholding method 29
3.3 System efficiency evaluation from Thresholding method 30
4.1 Result of acne detection from Bayesian classifier 41
4.2 System efficiency evaluation from Bayesian classifier 42
1
Chapter 1
Introduction
It is now trendy and influential among every society to have a nice skin. As
dermatological clinic has been increasing, a competition in method and technology to
cure skin is harsher, such as in laser treatment or skin tightening. But one of the
important skin problems nowadays is facial acnes treatment. Most teenagers and even
some adults are facing this problem and later experience cystic acnes or inflammatory
acnes. A cause of acne is mainly a fluctuation of hormones or skin’s fatty acid, but it
can also be caused by an individual skin condition, stress, unhealthy food, weather,
and medicines.
A scientific name of acnes is "Acne Vulgaris". It is a very common chronic
skin disease related to blockage or inflammation of pilosebaceous, they are hair pores
and sebaceous gland which are fatty gland. These glands are stimulated by male
hormone, which is produced from the adrenal glands in either males or females. There
are two types of acne, one is a non-inflammatory lesion, and another one is
inflammatory lesions. In some persons, they have mixtures of both types. The acnes
contain the possibility to sprout up on a chest and back also, not only a face. Although
the acne is not dangerous, but it can leave bad scars. If there is high-quality of
diagnosis and treatment method, it would be very easy to deal with all types of acne.
A pre-processing of facial skin and acne diagnosis is one of the necessary procedures.
A regular method of diagnosis is to have a dermatologist manually mark the spot of
acne on the marking sheet corresponds to a location of acnes which have been
observed. Results from this are unreliable, inaccurate, which increases exceeded effort
and time.[1-3] Therefore, a computer-aided application to inspect the acnes is very in
need by implementing detection algorithm which has been developed in recent
years.[4] Most skin analysis systems require a manual outline of the regions of
interest (ROI’s) [5-6, 7]. However, the outline of ROI is commonly known as a time-
consuming and non-repeatable process. Most skin clinics consume VISIA, a widely
used skin analysis system, which acquires images from various wavelengths to detect
skin spots [7]. However, the system still relies on manual outline of ROI for highly
accurate results; nonetheless, it is very expensive.
2
To illustrate, in order to be able to count more proficiently the comedo and
acne, Phillips has studied further about polarized light photography, shown in the
previous study. The light comes from electric and magnetic fields vibrating in a single
plane. Skin features, color, lighting, and framing are enhanced in polarized photo
leading the researchers to be able to find acne more easily. [8] Hideaki Fuji has
adopted a multispectral image (MSI), known as an image data at wide range of the
electromagnetic spectrum. The MSI is used to differentiate several types of skin
lesions such as comedo, reddish papule, pustule, and scar. Nevertheless, there are
limitations of the image functions in terms of the requirement of manual inspection.
[9] Humaynn has utilized a template matching approach used for locating the
correlated object, and it is applied for localizing the acne lesion. This approach proved
to be effective for counting and recognizing of lesions as it leads the program to the
learning process toward the appearance of acne before the matching process. [10]
Cula has employed multispectral imaging and linear discriminant functions with a
time varying component into acne detection and counting system. Gaussian mixture
models have been used to detect and register facial acnes for multiple times, so there
is an alignment technique to synchronize pictures. [11] Chuan-Yu Chang has used
feature-based detection to locate ROI and pattern recognition to detect different types
of defects through boosting classifiers. This method provides more proficient
detection ability, compared to other reviews, and are able to detect several features at
a time. [12] Manita Khongsuwan, however, has used a UV fluorescence image for
acne detection since bacteria in acne are reported to react to UV light. The image is
applied to H-maxima transform to find regional maxima and segment acnes. This
method is good and quite robust with satisfied efficiency, but UV can damage a tested
skin due to the long period of exposure. [13] Biman Chandra Dey has adopted digital
color (RGB) image to detect acne with the pixel-based method. The pixels are
recorded by skin backgrounds and interesting acne separately. A knowledge cluster is
made by pixels data arrangement, then acne is segmented by Mahalanobis Distance
(MD) and Bayes’ method. Compared to ground truth, the efficiency of MD is better
than Bayes’ as it keeps data of both skin and acne with a fine pixel details and direct
RGB input. [14]
3
For examples of the algorithm, a blob detection, brightness, or RGB features
have been introduced to detect acne shape in a different way. A blob detection is a
famous method to capture a sudden change in image intensity in a circular structure,
which is an edge of the object with the circular region of interest. The brightness and
RGB method consider an intensity and color specifications of each content in the
image to particularly define facial acnes from other objects. These two features can be
combined with the blob detection also. But there are advantages and disadvantages for
each method, so a more precise and effective system should be made to suppress any
side effects.
In this thesis, the system of automatic detection and counting acne has been
implemented. The works can be separated into two major steps; "Binary thresholding"
and Bayesian classifier". The binary thresholding technique has been started with
input image of facial acne fed into gray and HSV conversion so that it can be easily
calculated and brightness controllable. Then, the system makes a binary image to
clearly see ROI from the previous step, we can apply a method of small spots and
large region elimination to classify if the small regions are acne and obtain
coordinates. These can be used to mark constructed boxes onto locations of acnes as
final outputs. But the result was not desirable with middle-to-low accuracy, so the
second step of Bayesian is introduced to improve performance. The Bayesian step
starts by feature extraction and filtering out wrong detected region. It will be
separated into “Training” and “Testing” algorithm, and use each of them to compare
performance with another one. The feature extraction method is applied both in
training and testing to bring out regions in need by more deep and specific way.
“Bayesian Filter” is put at the last part to decide the regions whether they are in right
detection or not.
1.1 Motivation
For now, most of the dermatological technologies have been introduced into a
market. There are many functions in both analytic and treatment system, such as
precise camera, biological scan, laser treatment, etc. But in this project, a method of
image processing and statistical technique have been used as an alternative and more
efficient way of diagnosis and analysis. Also, this implementation is quite cheap
4
compared to the others with automatic work and usage easiness. The author has an
interest in cosmetology field for a long time, so the author would like to improve
functionality and benefit of the dermatologic system to be more advanced.
Also, I would like to know and research more in digital image processing field
which is quite important in the present days. Almost all electronic devices require this
application, such as QR code, Augmented Reality, Medical Diagnosis, etc. An image
information is one of the most common in daily life and easy to be transferred or
processed. With the typical way of image processing, it requires a certain object in an
image to be good detection system. Sometimes, the input image must have constant
lighting condition and color shade to make the system worked. But in reality, an
environment is very easy to be varied by sun ray, fluorescent, shadow. So we have to
create some statistical counter-measure to improve system performance.
1.2 Objective
This project has been developed the system for automatically detect acnes on
patients' face without any manual means to count or diagnose if the area is an acne or
not. Another benefit is to help relieve dermatologist work that is not quite accurate.
When an acne is defined by human eyes, there may be errors occurred caused by
ambiguous shape and color of facial contents. Moreover, automatic detection can be
implemented for tele-diagnosis, this can reduce time requirement and provide
convenience to both doctors and patients.
For the expected output of this project, an information of acne coordinates
must be clarified which one is acne and not first with the lowest level of errors. The
detection system has to be able to work in any lighting condition in input images, any
different angles of the face, the focus must be a shape of acne precisely. In the step of
classification, an algorithm of feature extraction must be implemented in more
effective method to extract right location from previous output with known
characteristic values. Lastly, we have to deeply understand what Bayesian theorem
can help this project to its limit. With this statistical method combined, it provides the
possibility of perfect analysis and detection of acnes on overall faces.
5
1.3 Thesis Structure
This thesis consists of five chapters, In Chapter 1, a basic information of acnes
in dermatology is introduced with the typical technique of analysis used. There are
also motivation and objectives. Then Chapter 2, a background knowledge which have
been being used has been studied and described, such as blob detection and Bayesian
theorem. Next is Chapter 3, the methodology of the proposed system is introduced to
see an overview of work, i.e. intensity-HSV normalization, binary threshold, blob
detection, and experimental results of this method. Similarly, Chapter 4 describes the
proposed methodology and experimental results of feature extraction and Bayesian
classification. After that, Chapter 5 expresses the discussions and conclusions on two
summarized work. Comments on further study and possible improvements toward this
work are also given.
6
Chapter 2
Literature Review
2.1 Basic Knowledge of an Acne
Acne is one of a skin disease that usually expresses by red skin area with
infection and erupts from a normal skin. It has commonly occurred on a human face,
but in fact, it can appear all over a body. It can be in any shape but the most regular
shape is circular with various color (red, black, white) depends on a cause and stage.
It may be caused from the skin is infected by bacteria and it enters into a fat gland
under the skin, this produces an inflamed acne at that infected area. On the other hand,
acne is not necessary to be made by bacteria, so it can be non-inflamed with a cause
of clogging fat gland. Fig. 2.1 a and b show that about an example of acne.
(a) (b)
2.2 Grayscale, RGB and HSV color model
Grayscale is a color type of gray shade with no true color related. A range of
its value is 0 to 255 typically. The lowest value represents black color which is the
color of absence color of all light. While the highest value expresses white color
which is all combination of the color of light, the value between these two is gray
with luminance corresponding to its own number. The grayscale value is only one-
dimensional value. An example shade of grayscale is shown in Fig. 2.2
Fig. 2.1 (a), (b) Example of acne on facial image
7
For RGB color, it consists of three plain of colors, i.e. red, blue and green
color plain. So it is considered as three-dimensional value, which each of the color
adjustment can affect overall shade in the picture with additive mean. The additive
light means that the three light beams of red, green, blue are added together,
wavelength by wavelength, resulting in output light color [15].
Zero intensity for each component (RGB) means there is no light exposure.
This situation gives the blackest color while the whitest color means the full intensity
of all colors. But a quality of this monotone color depends on a balance of each
components light. On the other hands when these intensities are different, the result is
a colorized light depending on the strongest or weakest component. When one of the
components has the strongest intensity, the color is near this primary light. Then there
is a possibility of two components have the same strongest value, the color is a
secondary light (Cyan/Magenta/Yellow). A secondary light is formed by the sum of
two primary lights in equal amount as it can be seen in Fig. 2.3
For HSV color model, it is more complicated but suitable to explain
colorization, luminance better than RGB model. “H” is hue which it is an angled
plane of color, starting from red at 0 degrees, green at 120 degree and blue at 240
degrees. “S” is saturation that is a concentration of each color value correspond to the
radius of circular hue. The final component is “V”, it can be called intensity level on
grayscale or brightness. A top value of “V” is white color, while a bottom is a black
color. This representation that shown in Fig. 2.4 is very famous in computer graphics
which is the better expression that RGB one. Nowadays, computer vision algorithms
that work on color images are straightforward like in grayscale images, so it is not
appropriate to analyze RGB image in detail. There are many kinds of the color
detection algorithm, for the examples, k-means, fuzzy clustering of the pixel, or canny
edge detection. In one picture, there are possibly different color contents which can be
separated easily with the only RGB. However, some of the pixels which are desired to
detect may have near color coordinate in RGB plane, so it can be more accurate using
HSV model with a separated indication of color components. The main cause is the R,
G, and B components of an object in a digital image are all correlated in term of the
amount of reflected light on that specific content, therefore image descriptions may be
8
more difficult. In this project, only the brightness from HSV and grayscale value are
used to compare and calculate the regions of interest. [16]
Fig. 2.2 Grayscale intensity range [17] Fig. 2.3 RGB color plane
(Primary and secondary light) [18]
Fig. 2.4 HSV color model in cone shape [19]
9
2.3 Binary Threshold
Thresholding is a basic form of image segmentation, which is the method to
distinguish an interesting object or scene considered from brightness and/or
colorization. The threshold is the value setting to be a reference, then a comparison is
made between each pixel’s intensity or color with the threshold value, so each pixel
will be assigned with some new value according to its old value is greater or lower
from the reference. The newly assigned value may be maximum/minimum one for
binary thresholding, which has been used in this thesis or any other that is proper with
specific works [20].
For an image segmentation, it is the method to differentiate a computer image
into several segments. Its own objective is for simplification of image contents to see
scenes or objects more easily. Moreover, it is very important for an image expression
to go through segmentation before going into a particular process of analysis. Image
segmentation is regularly applied to detect desired image contents or boundaries in the
computer images. It can be said that this segmentation process is used to mainly
synthesize, group, and categorize objects into the same contents which contain the
same attributes. The specific contours or labels with color in an image contents are a
final result of image segmentation. Properties of each pixel in the same labeled region
may contain similar characteristics such as color (as in RGB or HSV model),
brightness intensity, texture, or some physical contents. Neighboring regions of one
specific labeled area do not share the same image properties as they are considered the
different contents. An example of binary thresholding image is shown in Fig 2.5
Fig. 2.5 Original grayscale image (left), Post-
thresholding binary image (right) [21]
10
2.4 Blob Detection and Markings
Blob detection is a process to find circular-shaped objects in a digital image. It
is derived from edge detection technique which is one of image segmentation
procedures. Edge detection is an image processing technique to capture a sudden
change in neighboring image intensity which means there is a border of image
contents in that specific area. This method is therefore used as the basic interpretation
of another segmentation technique. The edges are usually a disconnected object in an
image. A development has been made from this technique is a closed-boundaries
region detection to track or capture completely separated image contents. The
boundaries are information consisting of a pixel region, and including foreground,
background, object groups or classes, user-interested objects. Edge detection methods
can be applied to the binary thresholding region to emphasize region of interest more,
so the results will be out like a silhouette pictures [22] [24].
For blob detection, it works by Laplacian of Gaussian filter (Spatial
derivative) masking all over image pixels. If there is an instantly changed value in
near pixels, the Gaussian mask will create a period sinusoidal wave to assign the
border. This scheme is called border detection. But the blob must be a closed region
within the border, so the Gaussian mask must form a minimal or maximal from an
encounter of two sudden edges which indicate the area of blob region. The blob
detection can also be used in the high dimensional image plane, like RGB or HSV,
other than the grayscale image. There are two types of checking region connectivity;
one is 4-connectivity, another is 8-connectivity. For 4-connectivity, the Gaussian
mask checks neighboring pixels in only 4 directions, which are up, down, left, and
right. While there are additional 4 directions; which are up left/right and down-
left/right, in 8-connectivity. These masks iteratively move through all pixels in an
image with corresponding to a center of masks. When this procedure is finished, it can
provide blob information from connectivity inspection of Gaussian mask and mark
interested objects with a circular shape. In this project, the regions of interest are
acnes on the facial image. They contain closed boundary with a circular shape, which
is very good for blob detection algorithm. In MATLAB, a function of marking region
coordinates is provided by box shape construction. So it can label acnes throughout a
11
facial image according to coordinates of actual acnes. The below matrix is the
examples of Laplacian Gaussian filter.
The left matrix is a 4-connectivity checking mask while the middle one is an
8-connectivity. The last matrix is also the 8-connectivity mask but with different pixel
gains, however, an average gain value must be the same. Fig 2.6 shows examples of
blob detection applied on an image. Fig 2.7 shows examples of blob detection applied
on an image.
2.5 Feature Extraction
The feature is some characteristic value determined in each object or boundary
for image processing field. It can be either physical meaning; which is a shape, texture
and color that is able to be observed with human perception, or statistical meaning;
Fig. 2.7 Blob detection on grayscale image (left) [24],
Blob detection on RGB image (right) [25]
Fig. 2.6 Example of connectivity detection mask [23]
12
which is probabilistic data with color and intensity frequency over a stochastic form
like Gaussian distribution for example. In a digital image, it may be difficult to see a
tiny difference in pixel intensity which is desired to be segmented out. It may also
provide harder analysis than usual if only physical data is used in processing. So in
this project, the statistical values have been used to determine contents separation and
extraction.
The typical functions which have been used to analyze image contents are
mean, variance, energy function, and entropy function. The mean value is the most
basic measure for almost every mathematical function. [26] Particularly in image
processing field, it is mostly used as a filter or noise reduction method. The type of
mean used in this feature extraction is an arithmetic type. This value will be
calculated in each sub-image which is considered as the regions of interest. Then a
comparison among these mean values is applied to the system to see if the contents in
several sub-images are similar or not. But the mean value results in only a single
middle-value consideration in each sub-image, so it may not be accurate enough. The
additional variable is variance. It is the value that tells how much spread of image
intensity distribution is. Therefore, this is better to have analyzed in image histogram
which is more accurate than a single value. Variance is the most appropriate tool to
distinguish an edge area in the image. [26] For energy and entropy. [27] They are
variables which have been used in many fields of natural science. It is a property that
expresses the consistency of data in information science, with a function of error
correction and intensity adjustment. Lastly, entropy is one of important probabilistic
function, derived from “Shannon’s Entropy”. [28] It can give information about the
uncertainty of image intensity in some specific regions of interest. It is also closely
related to a quantitative measure from transmitted information by particular image
area. When all of these data are combined together as an image content feature, the
system is most likely able to detect the desired region of interest by comparison.
There are two main complex variables which have been considered; one is
“skewness”, another is “kurtosis”. Skewness is a value determines how symmetrical
of an image distribution is. An image intensity histogram which is perfectly
symmetric will be assigned zero value of skewness. With some asymmetrical tail of
data, that distribution will have positive skewness value if the tail spreads to the right
13
side while it contains negative skewness when the tail spreads to the left side. [29] For
kurtosis, it is variable to quantify how similar a shape of an image distribution data is
compared to a Gaussian distribution. Therefore, the base shape of Gaussian is
assigned zero value. Any negative kurtosis values are for a flat peak distribution while
a steep peak distribution contains positive kurtosis, all of these are Gaussian’s
reference. Both skewness and kurtosis are united. [29] The examples of skewness and
kurtosis in data distribution are expressed in Fig. 2.8 and 2.9 respectively.
The two variables mentioned above can be used to extract certain objects in
the digital image. In regions and boundaries, there may be some contents which
contain the same of these characteristic values throughout one image. Feature
comparison can be implemented to group and extract desired objects without their
neighborhood requirement. Feature extraction method starts from an input of raw
image data, such as distribution, combined with image feature data which have been
calculated for all desired objects. This method has been used to easier understanding
in an informative way with normalization for data manipulation output. So this
process may lead image data to work in any application without complication. So in
summary, feature extraction works in a form of processed data reduction algorithm,
this reduced data is then able to be used to better process rather than a lot of raw data.
An analysis with a large number of data causes an excessive memory can
computational power, it is not appropriate for data samples and output at the end of
the imaging system. The results of feature detection and extraction will be an image
with segmentation or labeling on the regions of interest provided in deep details.
Because its own algorithm produces a local decision whether there is a region of
interest at a given image coordinates or not. An objects separation is very important
when the detected features are relatively spread widely in a whole image. The result is
usually represented in terms sets of coordinates of the image points where features
have been detected. With skewness and kurtosis, a checking algorithm can be
developed to detect contents which contain the similar or near value of these two
variables to be the same group and can be classified in a next step.
14
2.6 Bayesian Classification
The classification method in a digital data field has been used to make a group
of separate type of data which they can be mixed together before in one source. It is
also used for particular data detection and extraction to obtain needed contents from
the large pool of data. The class levels assigned by classification are dependent on
data attributes. Basically, some criteria must be indicated to be a rule of classification,
it can be called a decision algorithm. In Bayesian algorithm, joint probability among
classes and class attributes are considered as classification indicators. After an
estimation of prior probability, the classification of new introduced data is conducted
by examining of conditional probability. This conditional probability should be able
to decide the most probable returning class to the desired data. [31]
The Bayesian algorithm has to be trained to make a right decision of
separation by itself. The means of the training system is by feeding in a certain pattern
input to make the system remember which types of the data it observes in a certain
Fig. 2.8 Negative skewness (left), Positive skewness (right) [30]
Fig 2.9 Uniform kurtosis = 1.8 (left), Normal kurtosis = 3.0 (middle),
Logistic kurtosis = 4.2 (right) [30]
15
time. After we have the system recognize the input information, the testing step may
be implemented to see whether the algorithm is functional or not with an unknown
input. So it can classify or detect the important data based on its system learning. The
step of Bayesian method must be divided into two separate works; one is training
algorithm and data set, another is testing input data set. The fundamental approach of
Bayes’ theory is using decomposition of chain rule in joint probability equation as
follows:
𝑃(𝐶, 𝐴1, 𝐴2, … , 𝐴𝑘) = 𝑃(𝐶)𝑃(𝐴1, 𝐴2, … , 𝐴𝑘|𝐶) (2.1)
Where; P(C) is a prior probability of the certain class.
P(A1, A2,…, Ak | C) is a distribution of newly introduced attributes given the
class label.
P(C, A1, A2,…, Ak) is a joint probability of class label and new attributes.
Then the new attributes can be assigned to any prior classes, considering a conditional
probability of new assigned class given by desired data attributes:
𝑃(𝐶|𝐴1, 𝐴2, … , 𝐴𝑘) = 𝛼𝑃(𝐶)𝑃(𝐴1, 𝐴2, … , 𝐴𝑘|𝐶) (2.2)
Where; α is a normalization factor for making a summation of 1 for all
conditional class label probability.
So the new input data set can be classified by a combination of class’ prior
probabilities with conditional probabilities of the input data attributes.
The main benefit of Bayesian classifier is that it reduces estimation of
probability values to make a system error as least as possible. This property is called,
“asymptotic correctness”, the system should learn the best possible method of
classification to provide the best results with sufficient training data set. It can be
expressed that the Bayesian classifier can reach asymptotic correctness if the joint
probability of each class is consistent. In training data set, it may provide the best
probable classifier inside it but we cannot point it out directly without an optimal
classification rule and an exact estimation of the probability distribution.
16
For the simplest form of Bayesian classification algorithm, it is called, “Naïve
Bayesian Classifier”. It utilizes some of probabilistic theory to help in simplification
of conditional probability estimation, learning a density of input data distribution with
the same attribute label. An assumption of independent probability among each
attribute is realized, so the probability of input attributes given prior class probability
can be rewritten as:
𝑃(𝐴1, 𝐴2, … , 𝐴𝑘|𝐶) = 𝑃(𝐴1|𝐶) ∙ 𝑃(𝐴2|𝐶) ∙∙∙ 𝑃(𝐴𝑘|𝐶) (2.3)
As the equation above, a conditional probability can be derived to the multiplication
of probability of each input attributes with respect to prior one. Then, the posterior
probability of class given each attribute can be derived as the following:
𝑃(𝐶|𝐴1, 𝐴2, … , 𝐴𝑘) = 𝛼𝑃(𝐶)𝑃(𝐴1|𝐶) ∙ 𝑃(𝐴2|𝐶) ∙∙∙ 𝑃(𝐴𝑘|𝐶) (2.4)
This equation is called, “Naïve Bayesian Classification Rule”, which is
estimated the new assigned class by prediction of training data set. The decision of
class assignment to the input data is considered from the most value of posterior
conditional probability, which has to be relative to one specific group of data. The
system will give a class with most likely independent probability to the others with
respect to a point of view of the desired classified object. In the medical inspection, an
occurrence of this situation is frequent. So this method can be used as an effective
basis of classification.
17
Chapter 3
Acne detection with modified Threshoding method
As described in the second chapter related to the research of acne detection,
there was a variety of techniques done in the procedure. However, the process of
counting acnes was the main target of the program. We were convinced that the acne
detection was crucial for the doctor since it could evaluate the costs needed to be paid
before the treatment would start. The method focusing on the detection concentrated
on searching for only red acnes. The research could be improved by approaching the
related work, with the classification added. Nonetheless, the experiments were done
with the purpose of showing the efficiency of the procedure’s performance. The
details of the methodology and results will be described later in this chapter.
3.1 Proposed Method
Find maximum intensityRGB to Gray conversionGray image
normalization
RGB to HSV conversionExtract brightness (V)
plane
Gray off brightness
image subtraction
Input
image
ROI ThresholdingBelow 20 square pixels
spots removal
Above 7k square pixels
regions removal
Acquire image with spot
size 20 to 7000
Labeling and countingMaking a box structure
Show the
result with
markings
Fig 3.1 the flowchart of the proposed method
18
This is the first proposed system in this research which is processed by
MATLAB program and thresholding method as an image processing. The research
methodology in this thesis can be divided into three main parts: preparing an image,
processed and exact positions of acne which will be output in image form. However,
it can only detect acnes in the side facial image, left and right side separately Fig. 3.1
presents processes of the proposed method, We firstly convert RGB color input image
to gray-scale image, Find maximum intensity, Gray-scale normalization, Retrieve
HSV color image from RGB input image, To extract only V image which is
brightness image from HSV in the previous step, then Subtract normalized gray-scale
value out of brightness image to show region of interest , Next Threshold in image,
from image of threshold find the suitable of point image, Labeling and counting point
of acnes, Drawing boxes on input image at location of acnes. The details of each step
are explained in next topic.
3.2 Methodology
This chapter clarifies a function and works done by each step of the proposed
system. They can be explained as following:
3.2.1 RGB to Grayscale Conversion
This is the first step of the proposed methodology works in converting RGB
color input image to gray-scale image which is Gray RGB color have equal red, green
and blue values respectively. As you can see in the experimental equation of;
Gray = (0.2989 x R) + (0.5870 x G) + (0.1140 x B) (3.1)
When converting from RGB to grayscale, it can be that specific weights to
channels R, G, and B should be applied. These weights are: 0.2989, 0.5870, and
0.1140.
The values multiplied in each color are get from an experiment. RGB input
image must be processed to gray scale image because it is simpler to calculate and
clarify in our program.
19
3.2.2 Maximum Intensity and Gray-Scale Normalization
Intensity normalization is a method to reduce or increase a range of image
pixels to make a picture more or less in contrast property. It can also standardize an
image input to be able to make a calculation and comparison with another image in
term of intensity (gray-scale) more easily. A typical equation for computing a new
range is shown as following;
𝐼𝑛𝑒𝑤 = (𝐼 − 𝑀𝑖𝑛) (𝑁𝑒𝑤𝑀𝑎𝑥−𝑁𝑒𝑤𝑀𝑖𝑛
𝑀𝑎𝑥−𝑀𝑖𝑛) + 𝑁𝑒𝑤𝑀𝑖𝑛 (3.2)
For this research, this method is used to finding maximum intensity in the
gray-scale image by maximizing in X and Y coordinate. When an image is taken into
the max function, it will first get maximum value along the x-axis in each y-column.
By taking max function again, an absolute maximum value is obtained. Then next
step is Gray-Scale Normalization which is taken the gray-scale image. Each pixel
value is divided by a maximum intensity value of the whole image to obtain a gray-
scale image with range 0-1. This should be done to allow gray-scale. It is in a range of
zero to one to be able to compare with HSV model. Subtraction which has the 0-1
range by default.
3.2.3 RGB to HSV Conversion
HSV model is a convenient color model to describe an image in terms of
color, shade, and brightness. It can be explained in details as the following;
H = Hue; it is a color indicator which is controlled by circular angle. Each
color is separated within a fixed range of circular degree. At 0 degree, it starts with
red color then it changes to yellow at about 60 degrees followed by green (120
degrees), cyan (180 degrees), blue (240 degrees) and magenta (300 degrees). This
looks like a color palette with primary and secondary color.
S = Saturation; it is a value determining a color level or shade. This parameter
is controlled by a radius of hue circle, more length in radius affects in more color
level of that angle. On the other hand, less radius shows that more shade of grayscale
occupies that color.
20
V = Value of brightness; this variable expresses how much brightness is in an
image pixel. Minimum brightness means black color and maximum one mean white
color. This value is represented by the level of height for H+S circular plane. With
this combination,
In my research, we retrieve HSV color image from RGB input image and we
focus on V image which is brightness image, it is a value of illumination which is
dark or light. This brightness image is important to deal with exposure problem in our
picture.
3.2.4 Brightness Extraction
Brightness image or V, with a range of 0 to 1, retrieved from HSV image was
the only method applied in the research. This brightness image revealed how each
area performed with lighting. The areas with strong light, which equal to 1 due to the
rank, were represented with white color, and the areas with the rank of 0 were
represented with the darker color. The brightness image could usually be valued at the
range of 0 to1, which was similar to the ordinary gray-scale image.
3.2.5 Image Subtraction for Region of Interest
For the subtraction of gray-scale normalized value be out brightness image is
performed to expose the acne interested areas which can clarify point of acne interest.
Both brightness and normalized gray-scale image are in the same range that is 0 to 1,
therefore it can be compared. Brightness image has more intensity if it is subtracted
by gray-scale normalized image, it will give a region of interest at an area of the
strongest luminance.
3.2.6 Binary Threshold
This was a fundamental method of image segmentation setting up a
conditional level called “threshold”. If pixel intensity exceeded the pre-determined
level, it was going to be specified to ‘1’ binary value and vice versa for ‘0’ value. The
result acquired from this method was known as a binary image containing black and
white color. The black one was usually a background while the white one was an
object area that was interesting. However, we would not be able to know the accurate
21
value to be threshed by only our approximation. Thus, there was a method to specify
the value of mean and medium. Although the method produced ineffective threshold
for complex or multi-gradient images, it was considered as the simplest ones. This
type of images must be dealt by threshold with the complicated algorithm such as
multi-level, adaptive and, the most famous one, Otsu’s method. The process could
provide optimal threshold value according to the image data histogram.
If the pixels were valued below 0.2, which was defined by how it located near
black pixels valued around 0 to 0.2, they would be set to 1 and vice versa to
emphasize ROI.The pixels with the value of 0.2 in the darker lighting were considered
as unattractive areas. In this process, the images would be flipped to negative binary
color.
3.2.7 Spot and Region Removal
Binary image obtained from binary thresholding method was adapted to
perform at this process. We, then, demonstrated the process of eliminating areas that
were not considered as acnes. In order to remove acne spots, we would consider the
areas with the size less than 20 square pixels and the areas with the size more than
7000 square pixels.
In the beginning, we focused on the areas with the size less than 20 square
pixels, which were defined from their users through its noise performance. Then, very
tiny points would be erased. After completing this process, we changed binary image
to negative color image with the purpose of the revealing region of interest that
regularly pointed to clarify our images. Subsequently, very small noises would be
erased since they were not the size required, which would be valued by setting a
threshold of the area with 20 square pixels (e.g. the area with the size of 4*5, 3*6
would be deleted).
After obtaining the images of acnes, some with less than 20 square pixels were
eliminated. Then, the process of removing regions from the binary-thresholding-
method images would be started. If they had the area more than 7000 square pixels in
most facial images defined by the users, it caused a very large area to be left out.
These very large areas with the size above 7000 square pixels could be any skin that
were not focused, such as blemish or freckle. It can be seen that there was no white
22
region left in the images, which means that no large region would exist in these
images.
Logical subtraction was approached between the images with the size of 20
square pixels and below 7000 square pixels. The output provided images with the size
of 20 square pixels to 7000 square pixels. Logical subtracted had to be applied
because the binary threshold images were still in the process with the binary valued of
0 or 1. Eventually, we came out with two images for logical subtraction. The first one
was the image containing everything except small points, and the other one was the
image with the area below 7000 square pixels containing only large regions, and some
interesting features.
3.2.8 Labeling and Structuring a Mark
We started with the image labeled and counted for the objects found in the
previous step. Some functions could be used to reveal a number of acnes and
coordinate the acnes. These gave the array of x and y at acne location, and the length
of an array was acne’s number. Then, with the process of making a box structure at
every single object referred to their size, using function ‘region props’, this function
had to be fed in with objects obtained from the array and boxes marked as ‘Bounding
Box’ before they were drawn.
3.2.9 Marking Acnes on Image
In terms of the process of making acne on images, the final step was to show
the result of overall work. We used drawing boxes around the acne areas of the input
images and used ‘rectangle’ crop tool to crop the areas that the program could detect
in. According to the result shown in figure 3.2, the program could properly mark and
detect acnes of the input image with accurate sizes and areas.
23
3.3 Experimental Results and discussion
This section would discuss the results of the experiment using thresholding
methods, which consists of three sectors; starting with the part of demonstrating the
results of each step of Algorithm mentioned before in the pictures, following with the
part of demonstrating the efficiency illustrating the setup method of calculation and
sources of each value. Finally, the last sector would be filled with tables illustrating
the comparison of each value, results of efficiency, and conclusion of the experiment.
3.3.1 Thresholding Result
As it could be considered in the first picture that there was a picture of cheeks,
where there were inflammatory acnes, small and big sizes throughout the face. The
first picture was seen as the original picture, which would be called as input (a)
hereafter. It was an input and program functioning to transfer the input to the gray-
scale image, which the transition would change the range of the picture color from 0-
255 to 0-1. It could be portrayed that (b) the dots of the objects could be seen as small
distinct dots with the better lighting, compared to the previous picture. The picture (c)
was regarded as the HSV picture obtained from consuming a function to transfer the
original picture to HSV picture. The process was crucial since we demanded to
possess V or brightness picture (d) in order to compare with the gray-scale picture.
The following picture was the gray-scale picture (b) which was deducted the
brightness already with the purpose of aiding to notify the interesting dots more
clearly before delivering the picture to the thresholding process shown in the picture
(e). The picture (f) has resulted from the thresholding process. It could be recognized
Fig. 3.2 Output with acne marking
24
that we could see the dots, acnes, shown in the picture distinctly. Nonetheless, some
dots were too tiny and some were too gigantic in the picture. We, then, had a process
to eliminate the dots that might not be acnes. We formed specifications that dots with
a smaller size than 20 megapixels and with bigger size than 7000 megapixels would
be removed, which the process would be illustrated in the pictures (g) and (h). In the
picture (h), it could be regarded that there was no area more than 7000 megapixels;
thus, the picture turned out in the black color. The following process was erasing the
picture between (g) and (h), and the picture displaying the interesting dots that might
be acnes comes up as the picture (i) which was the picture with the capacity to
demonstrate the same amount of acnes, compared to the original picture. All of this is
shown in Fig 3.3
The second picture in Fig 3.4 shown in the project could be interpreted in
terms of its result as there were a few differences, and the number of acnes was not as
Fig. 3.3 first image processing
25
much, compared with the interesting areas that might be acnes in the sample picture
of the first set. The results, obtained from the thresholding process, revealed that the
areas bigger than 7000 megapixels inspected from the considerable area below were
not acnes. However, the issue would be solved in the process (h) and (i), which were
the processes taking the colossal area out of the picture.
This final simple picture in Fig 3.5 demonstrated the slight tendency of having
acnes, the low resolution of the picture, and the faded marks of the acnes. We could
also notice that the low resolution of the picture resulted in undetected low-contrast
ROI mistakes shown in the picture (f) as the system could encounter only the areas
around the acnes.
We chose the threshold 20 and 700 specifically based on optimum value for
this specific dataset. This threshold must be changed depending on the size of images
in the dataset. If the image size changes, this threshold value must be re-optimized
again
Fig. 3.4 Second image processing
26
3.3.2 Ground Truth
In our experimental result, they are focused on counting point and detection of
acne. Many blobs processed in the system, the program can detect them whether it is
an acne or not. Next, this information is brought to evaluate its own performance.
Therefore, we must have a Ground Truth to compare and measure with the original
image of acne. Then a comparison was made with the images obtained from the
results of our program. Therefore, ground truth is very important and have to be found
first.
The system begins with the original image. The facial image on the cheek with
acne, the system will mark the point of acne indication. As measured by human eyes,
our work will focus on the point of acnes. The red spots and acne (starting stage the
bulges, curve or red spot), they will be manually separated by ourselves with the help
of Photoshop program. Fig 3.6 show that ground truth and original image.
Fig. 3.5 Third image processing
27
(a) (b)
(c) (d)
3.3.3 Detection Performance Evaluation
We, then, evaluated the performance of the proposed method by using the
statistical measures, including sensitivity, precision, and accuracy. Thus, a reference
number of actual acnes was displayed as ‘Ground Truth’, which was counted
manually. Then, the following evaluation process was to use the blob-based system
since we considered only the interesting shape of acnes, not the whole pixels.
Frist and foremost calculation this value we have to find true positive, true
negative, false positive, false negative as they are described by following.
Table 3.1 Detection Performance Evaluation
Scar and normal skin
Acne
Correctly Detected
Incorrectly Detected
Correctly Detected True positive (TP) False positive (FP)
Incorrectly Detected False negative (FN) True negative (TN)
Fig. 3.6 Ground truth and Original image
28
From Table 3.1 Shows that the definitions which have to be introduced attaching
to this section:
True positive (TP): Acne correctly detected as acne
False positive (FP): Scar and normal skin incorrectly detected as acne
True negative (TN): Scar and normal skin correctly detected as scar and
normal skin
False Negative (FN): Acne incorrectly detected as scar and normal skin.
We could evaluate detected acnes on images by using sensitivity, precision, and
accuracy. These statistical measures could be described as follows;
Sensitivity was used to designate the probability in our experimental evaluation. It
showed that when we tested the program, we obtained the correct value of detected
acnes (true positive). The result of counting number was divided by the accurate
number of acnes, known as 'true positive rate', or the proportion between the number
of when we tested detected acnes (true positive) and the accurate number. In this
process, the program had to detect both true positive and false negative.
𝑆𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑇𝑃
(𝑇𝑃+𝐹𝑁) × 100 (3.3)
Precision was a proportion of interesting areas, which could be precisely
detected as a point of acne (true positive) compared to the total positive results (true
positive + false positive).
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑇𝑃
(𝑇𝑃+𝐹𝑃) × 100 (3.4)
Accuracy was one of the statistical measures used to measure the value at the
specific time. The measure was used to compare to its actual value, which was the
number of detected acnes. This value was portioned out from its total accurate results
(true positive + true negative), compared to all population in the experiment (positive
+ negative).
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = (𝑇𝑃+𝑇𝑁)
(𝑇𝑃+𝑇𝑁+𝐹𝑃+𝐹𝑁) × 100 (3.5)
29
Table 3.2 Result of acne detection from Thresholding method
From table 3.2, we use 10 images for a test this algorithm which is a part of
the cheek. We cut out only the cheek to obtain a smooth area for detects the acne
more than other parts of the face. Each of image for tested will have different acne.
Our program will detect inflammatory acne including redness and acne vulgaris. The
next column is the number of ground truth on each of acne images. The ground truth
will count the number of acne spots that human eye can see and ground truth use to
compare with the image from the test with our program to find the fault of acne
detection. The results of the program can be divided into four categories, i.e. true
positive, true negative, false positive, false negative, which has been described
previously. The analysis results in Table 3.2 is less acne forming, there is a high
probability of acne detection correctly while the sample group 1 and 9 are false
negatives. Only 1 and 2 respectively occurs. The amount of acne is very common in
some images. It shows more error and the most are false positive which is not the
acne area, but it detects the acne. Because of this area is similar to inflammatory acne
in shape and properties. The three example are an error in a false negative than false
positive may result from the spread of acne and irregular shapes of its and the next
Sample
image
Ground truth
(Human eye)
Image Processing
(Proposed method) TP FP TN FN
1 5 4 4 0 0 1
2 28 31 27 4 0 0
3 21 15 12 3 0 6
4 18 22 16 6 0 2
5 18 27 18 9 0 0
6 25 29 21 8 0 0
7 16 23 13 10 0 2
8 22 27 18 4 0 4
9 9 7 7 0 0 2
10 33 35 27 8 0 6
30
table will use the value that obtained from Table 3.2 to analysis the evaluate
efficiency.
Table 3.3 System efficiency evaluation from Thresholding method
Table 3.3 shows that the value used to evaluate the effectiveness of the
proposed system begins from the sensitivity value which calculates the rate of
detection in the method that likely to be able to judge the object correctly. The table
shows all of the examples have the acceptable value, except the third example is the
66.67% which is relatively low, probably because of the appearance and position of
acne is not clear including the light on image make sensor test system be in error. For
the precision value, it is the positive forecasts to assess how many chance for detected
correctly throughout detect all objects from itself. You can see that the value in the
table of sample 5 and 7 are relatively low in the test because of the unclear of acne
forming. For the final value, accuracy is the overall rate of accurate results when
compared with all objects in both positive and negative. This value can tell all
performance of this system which is still unpleasant experiments by using
Thresholding method.
Sample
image Sensitivity (%) Precision (%) Accuracy (%)
1 80.00% 100.00% 80.00%
2 100.00% 87.10% 87.10%
3 66.67% 80.00% 57.14%
4 88.89% 72.73% 66.67%
5 100.00% 66.67% 66.67%
6 100.00% 72.73% 72.41%
7 86.67% 56.52% 52.00%
8 81.82% 81.82% 69.23%
9 77.78% 100.00% 77.78%
10 81.82% 77.14% 65.85%
Average 86.37% 80.00% 70.00%
31
Chapter 4
Acne detection with Bayesian classifier method
In Chapter 4, another method used to inspecting facial acnes mentioned in
Chapter 2, which is named as Bayesian Classifier would be discussed in terms of how
it was applied in the project. It was convinced that the original program commonly
used for inspecting acnes could not efficiently work that well at identifying the
interesting dots that might be acnes. The program could only illustrate the differences
of the interesting dots on the background and distinguish them out of the picture.
Another condition that the Bayesian Classifier was convinced to investigate better
was because the program was allowed to add more function in the process, and that
was why we designated to adopt the Bayesian Classifier in the project. It was also
because the program was designed to be easy and comfortable to use, which was also
the reason we started to use the program. In this chapter, we would begin describing
the proposed system part that illustrated the flowchart of the program’s overall
procedure, following with the description of the Blob detection referring to Chapter 3,
further description of the feature extraction consumed in the project with the purpose
of identifying the characteristics of the dots eliminated from the picture, the
description of Bayesian Classifier, consisting of Train-and-Test process, and, finally,
the description of the experiment and its result.
4.1 Proposed System
The presented system mostly consists of data processing running by
MATLAB program, referred from the previous process. We would use the program as
the input process entering the data of the picture. The main procedure of the research
project was to intercept and filter the inspected areas which were known as faulty
areas. The following step was to distinguish the inspected areas into Train-and-Test,
which the results obtained from this process would be transferred to compare the
efficiency of the performance with the original process specified in Chapter 3 (see the
picture 4.1). It could be witnessed that the picture demonstrated the methods of acne
inspection was considered as an input to the Train process after test process of acne
32
detection. Then, the process of feature extraction would be adapted to pull the
characteristics of unique interesting pictures out, and it would be saved as data for
adding into the system in the Bayesian Classifier process. For the Train process, we
would teach the system which dots are acne and which are not; therefore, it could
identify by itself and remember them. Then, the Test process would be adopted,
which we would bring the pictures that were not trained to test if the system could
work on it correctly. The details of these
Process would be described in Fig. 4.1 as follows;
Detect Object Feature Extraction
Training
Save data
Detect Object Feature Extraction
Send to Bayesian
Keep Region
Delete
No
Yes
Train Test
Input image
Blob detection
Output
Fig. 4.1 the flowchart of the proposed method
33
4.2 Methodology
4.2.1 Blob detection
The process would start similar to the Train-and-Test process. However, the
main work would focus on the ability to witness the pictures and the cropping signs or
blob detection. Then, the output obtained from the process and the picture with the
selection of interesting dots, would be sent to the next process. This process would
start with sending the picture for the data processing and changing the picture from
RGB into Grayscale in order to facilitate the comparison between the interesting dots
from its background. Then, the use of the functions of estimating the Gray-scale
normalization and picture adjustment for the picture to be in the range between 0-1
when saving it would be adopted. After that, the original RGB picture would be taken
to distinguish the V picture out of the HSV, which was considered as the process of
transforming the RGB picture to be HSV picture. We would consume only the V
picture of the interesting dots in this process, and take it into the process of deleting
pictures. Gray-scale normalization would be eliminated pixel per pixel with the V
picture with the purpose of illustrating the interesting dots more clearly. The
thresholding process would be conducted after that for replacing the white interesting
dots with the dark background. Moreover, the Blob analysis would be carried out for
obtaining the picture with the marks at the acne areas. These marks consist of centroid
coordinate and circular area according to each acne.
4.2.2 Feature extraction
This main duty of the process is to get the detected interesting dots examined
in terms of graph analysis, which is usually called as graph’s state-of-the-art feature
extraction picture. The process also works similarly to the Train-and-Test process,
known as the first data processing such as the resolution of the picture. We might
have to convert it to graph form, and that the probability of density function would be
gained from it. Characteristic values needed to be considered are as follows; Mean
value, Variance value, Skewness, Kurtosis, Energy, and Entropy.
34
4.2.2.1 Mean Value
This value can be simply defined as an average measurement of
intensity on a region that we are interested in. An equation from MATLAB used to
calculate the value is shown below:
Mean = sum (Prob.*Gray_vector); (4.1)
This shows that the mean value can be calculated by the sum of each
image pixel intensity multiply by its own probabilistic factor of occurrence compared
to the whole region.
4.2.2.2 Variance Value
Variance is seen with the deeper process, compared to the mean value.
It is used to measure spread or wideness of intensity probabilistic data. According to
MATLAB, the value can be achieved through following equation:
Variance = sum (Prob.*(Gray_vector-Mean).f^2); (4.2)
From the equation above, weighted and squared on a subtraction
between a gray intensity of each pixel region mean are summed up to be the variance.
Therefore, we must know the mean in a region of interest prior.
4.2.2.3 Skewness
Skewness is a measure of symmetry or asymmetry. A distribution,
known as a data set, can be called as symmetric if both sides of the equations are
equal, which is the mean of overall probability density function of data. This value
can be computed based on mean and variance:
Skewness = ∑ (Yi −Y̅)3N
i=1 N⁄
s3 (4.3)
35
Where; Yi = gray intensity,
Y_bar = intensity mean,
S = standard deviation (root of variance)
As a probabilistic weight of each gray level is used in the project, the sampled
number (N) is not necessary.
4.2.2.4 Kurtosis
Kurtosis is a measurement method processed to see if the data has a
peak or flat relative to a normal distribution. This means that an intensity data which
has a single distinct peak near its own mean tends to contain more value of kurtosis.
Moreover, the high kurtosis data has a possibility to decline exponentially further
from the mean area, and have heavy traffic of intensity at both tails of a histogram.
Data sets with low kurtosis will have opposite character of the high one. Kurtosis can
be calculated by the equation below:
Kurtosis = ∑ (Yi −Y̅)4N
i=1 N⁄
s4 (4.4)
It can be perceived that kurtosis equation is much like the one of
skewness except for the power of 4 instead of 3. Also, mean and variance is able to
have a large impact on both skewness and kurtosis though the visualized histogram is
not clear enough to see symmetry or peak.
4.2.2.5 Energy
This term is utilized in several fields of study. However, it can be
defined as the numerical contents presented in an image, and how the intensities are
distributed over the whole image, in terms of image processing. This value is simply a
mean-square of probabilistic function, i.e.:
Energy = sum (Prob.*Prob); (4.5)
36
Probability density value in each corresponding pixel intensity is
multiplied together and summed up to be the energy of region of interest.
4.2.2.6 Entropy
Entropy is reasonably similar to energy and was generally chosen to be
used in various branches of science. It can be called as the randomness of contents in
image processing. For example, an image with a high density of contents such as city
landscape could contain a high value of entropy. On the other hand, an image of a
white plain wall could have lower entropy value. Its equation is fairly resembled the
energy, with additional logarithm function:
Entropy = -sum (Prob.*log (Prob)); (4.6)
From these six characteristics of the histogram, we can train or test the
system further, as well as understand the features that needed to be improved.
4.2.3 Bayesian Classification
The category is commonly arranged by following the theoretical decisions
such as methods of identifying the pictures. The process of categorizing would be
based on an assumption or more, such as geometric forms, color, or greyscale. Each
of these characteristics was assigned for a unique analysis. How the system learns to
be familiar with the process could be done by the users providing the data for the
system to learn. The process could be achieved by identifying the number of
demanding categories. The processes of categorizing and distinguishing were similar
to each other in terms of putting the label on each component resulting in the picture
apportionment.
In terms of Bayesian method, it was highly scalable, with the require of a
number of features working in the learning process. This type of classification could
be done by evaluating a closed-form expression rather than iterative approximation
that is normally used for many other types of classifiers, so it was better to use to save
computation time and resources. The Bayesian method was usually implemented to
minimize the possibility of misclassification.
37
4.2.3.1 Training Process
This process aimed to let the system know and remember which acne
areas were rightly or wrongly detected. An algorithm usually worked on teaching the
system to start its work by having a window of pixels slid through until it covered all
areas in the images. The users had to manually input the interesting areas that the
window was on by identifying if it was an acne. Then, this vector of right and wrong
detection would be implemented into blob detection to filter out the unnecessary areas
in the images that had been considered as an acne. The process would help the result
of the output to be more reliable.
Next, the naïve Bayesian classifier was applied into the training data
set, compared to original blob detection of images. The basic equation of this
classifier was shown as follows;
𝑝(𝑥 = 𝑣|𝑐 = 1
√2𝜋𝜎𝑐2
𝑒−
(𝑣−𝜇𝑐)2
2𝜎𝑐2
(4.7)
According to the Gaussian distribution, the equation supposed that the
training data contained a continuous variable, x. The intensity data from training class
was computed out its mean and variance in each class. The process led µc to be the
mean of the values in x associated with class c, and σc2 be the variance of the values
in x associated with class c. Then, the probability of distribution could be computed
by plugging υ into the equation to make a normal distribution of parameter by µc and
σc2.
Lastly, all of training data and Bayes’ classification data were saved
into original detected acne images to show the most precise location of actual acnes
that users had defined into the core system.
4.2.3.2 Testing Process
This was the second phase process to let the system test and decide
automatically whether a specific area was acne or not. First, we must create a window
to observe parts of image then it would slide through the entire of each image. This
38
was much like training except that a prediction function in MATLAB would be used
to automatically classify. This function was shown in the below statement;
l = predict(Y, X) (4.8)
Where; l = vector of class labeling data intensity,
Y = discriminant classifier,
X = matrix of observation in row, predictor in column
After the prediction step, the areas that pass criteria would be kept for
the next step, while the ones that failed would be deleted. Then the whole image
would be marked on the right locations of acnes with the centroid of coordinate and
areas referred from each acne component.
4.3 Experimental result and discussion
1. When we run codes on Matlab program, it would automatically show the
dialog box for the users to select pictures that they wanted the system to learn or to
test detecting acne. The users would be able to select one picture for testing
2. The system would inquire the users whether they wanted to use Train or
Test if they wanted to use Train, they were required to select number 1. However, if
they wanted to use Test, they were required to select number 2. We tried Train at the
beginning in order to put data into the system for it to remember and learn
3. The system then showed the picture that we selected to test the first step,
along with the message asking if the dots marked were acne with the dialog box
showing the picture with circle marks around the detected dots, which might be acne.
The users were required to answer in the screen if it was an acne or not. If yes, then
press 1. If no, press 2.
4. The system would consistently require the users by demonstrating the marks
around the interesting dots until it covered all the dots. However, the system would
not repeat the detected dots since we provided the repeated codes in the system.
5. When the system had already asked about all the dots, the dialog box saying
that Training complete would be popped up automatically.
39
6. Then the testing process would be carried out. In this process, we did not
have to set up anything since the system would remember and learn from the first
training. After that, the results of acne detection would be on the pictures by showing
the marks around the dots or the areas that might be acne (look at picture 4.2)
In terms of the experiments, four sample images were used to see results of
this program. Fig.4.2 (a) and (b) showed an image with quite a high number of acnes.
The result was well-defined and almost accurate, but there would still be wrong-
detected and overlapped areas. Nevertheless, they were pretty close to the accurate
acnes.
Fig.4.2 (c) and (d) contained a very few acne lesions. It could be seen that a
classification was very effective, and almost no mistake is presented. This proposed
method boosted an efficiency of the system as it could detect blobs more thoroughly if
compared to blob detection.
(a) (b)
(c ) (d)
With the purpose of measuring effects and performance of the proposed
system, we used ten images of the acnes from different patients’ face to test the
Fig. 4.2 Output image of result
40
proposed method based on the MATLAB program. A reference number of actual
acnes was displayed as ‘Ground Truth’ which was counted manually. Therefore, the
following evaluation process was blob-based since we considered only the interesting
shape of acnes, not the whole pixels. We could evaluate detected acnes on images by
using sensitivity, precision, and accuracy, which was the same as the experiment from
chapter 3.Fig. 4.3 is the Ground truth image and fig. 4.4 is the Output image of result
From the fig 4.5, it shows the negative detection results. We found that the
yellow dots show the correct detection results but the blue dots are the false negative,
i.e. the location where acne appears but the system couldn’t detect it. This mistake
happens because the boundary between acne and the background is so blurred. The
green dots show the false positive, or the location where there is no acne, but the
system wrongly detected as an acne. The mistakes or similar ones occur when there
are dots or spots that are not acnes on the patient’s face.
Fig. 4.3 Ground truth image Fig. 4.4 Output image of result
Fig. 4.5 Negative result
41
Table 4.1 Result of acne detection from Bayesian classifier
From Table 4.1, we use all 10 images, which is the same image used to test
with Thresholding method that presented in Chapter 3 to make it easier for compare
the results of both techniques. Therefore, the value obtained from the Bayesian
Classification detection is a number of detected areas by using Training and Testing
algorithms, but still have errors in these results as well. The results of this program
can be divided into four types are truly positive, true negative, false positive, false
negative.
The results showed that if we use the test image with a small number of acne,
our detection system can detect it correctly and effective while the sample groups 1
and 9 have values 0 and 2, respectively. More acne image, the detection system has
more error and the most are false positive which is not acne area but it like acne
lesions that cause testing errors.
Sample
image
Ground truth
(Human eye)
Image Processing
(Proposed
method)
TP FP TN FN
1 6 6 6 0 0 0
2 28 33 25 8 0 3
3 25 27 20 7 0 5
4 24 26 21 5 0 3
5 13 13 10 3 0 3
6 33 34 28 6 0 5
7 25 42 23 19 0 2
8 22 24 18 6 0 4
9 10 8 8 0 0 2
10 33 36 26 10 0 7
42
Table 4.2 System efficiency evaluation from Bayesian classifier
From Table 4.2, a value used to assess the overall performance of the system
is sensitivity, is the rate of the detection system with more likely to be diagnosed the
counting of acne number accurately. This table will provide an acceptable value for
each sample as in Image 1 is 100%, which is good for a test this system while the
image 3 is 74.76%, which is the lowest value of all. The precision value is a positive
forecast value used to estimate how many chance for detected accurately, as well as
objects from all object itself to be checked. We can see that the values in the table
show the system still have an error. The value is relatively low in image 7 is 54.76%
is the only one with a low percentage, but the other value is acceptable. From this low
percentage may be due to the unclear of acne areas. Finally, the accuracy value which
is the overall rate of accurate results when compared to all the objects in both positive
and negative can tell all the performance of this system is not desirable except the
tested image 1 and 9, both values have a relatively high percentage. However, the
total percentage has sensitivity, precision, accuracy values are 83.17%, 81.13%,
70.65%, respectively, and we can consider this system is satisfactory.
Sample
image Sensitivity (%) Precision (%) Accuracy (%)
1 100.00% 100.00% 100.00%
2 75.76% 89.29% 70.27%
3 74.76% 80.00% 63.64%
4 87.50% 80.76% 73.33%
5 76.92% 76.92% 64.71%
6 84.85% 82.35% 72.50%
7 92.00% 54.76% 53.33%
8 81.82% 75.00% 65.52%
9 80.00% 100% 81.82%
10 78.79% 72.22% 61.36%
Average 83.17% 81.13% 70.65%
43
Chapter 5
Conclusion and Future Work
Acne detection system is a useful system that helps doctors to assess the initial
treatment easier, save time and reduce fatigue of doctors. In this thesis research, we
implement two methods in Thresholding method and Bayesian classifier method
which applied image processing techniques to use acne detection system. Their
conclusions are described following.
5.1 Summary of Thresholding method
This thesis presents an automatic counting of acne number. The study found
that image processing techniques are interesting especially the use of an image to find
the differences of color, light intensity, or even a small area with embossed are all
differences that can be isolated by the above techniques. The algorithm presented in
this thesis has a prominent point at using Thresholding property which is a basic
property but can meet the proposition very good. The steps are not complicated but
have satisfactory results. The presented techniques will include the input data, RGB
color image which is converted into a gray image. In the first steps, for processed
easily, gray-scale normalization, HSV input conversion to use brightness image
compare with the gray image, ROI extraction, binary threshold, Non-ROI feature
elimination, marking results and overlaying onto the original image.
Performance Measurement of the experiment will show that the false positive
is likely to appear due to some other problem on the face can have similar properties
when compared to acne and the calculate percentage of sensitivity, precision and
accuracy are relatively high, except precision which has to be improved soon. Some
small errors can arise from the mistakes of the acne shape that unclear detected.
Therefore, we have to increase the separation system of acne that point is acne or not
by increasing the Bayesian Classifier method.
44
5.2 Summary of Bayesian classifier method
This thesis aims to investigate an automatic acne detection method by using
developed algorithm, feature extraction and, Bayesian classification. In addition, the
results shown on the sample facial picture with varied types of acnes and the
effectiveness evaluations of the system were provided in the previous table. The
presented algorithm included Blob detection techniques, which was considered as the
first method applied in the project. The method could be achieved by separating the
Blobs out of the background skin. Nonetheless, this method had an immense tendency
to cause an error; hence, we decided to add the feature extraction during the process.
This method extracted the feature graphic of acnes out in order to see differences.
Then, we used Bayesian classifier with train-and-test algorithm to sort or classify the
exact amount of acnes out of the overlap misunderstanding or errors.
Performance measurement of the experiment presented that the false positive
was likely to occur due to some other problems on the face. This is because the acnes
and other scratches tend to have similar properties, compared to the efficiency
calculation of acne inspection revealing the percentage of sensitivity, precision, and
accuracy. It could be perceived that the accuracy was relatively high; nevertheless, the
precision still had to be improved. Some tiny errors could arise from the man-made
mistakes and different shapes of acnes.
5.3 Future Work
In forthcoming work, we are planning to improve the algorithm performance.
It was also possible that we would expand the process of detection, classification in
order to optimize the algorithm to better results of precision and accuracy. Firstly, we
are convinced that the quality of acne images should be improved as they are an
important factor before sending these images to next process. This is because the
results of performance have a low rate on some example images due to the errors on
detection. Similarly to classifier process, we are planning to improve the algorithm to
be more powerful with many techniques in the process, such as neural network
classification. This thesis may be developed more to be presented in the following
study, and real-time detection will be concerned in the future work.
45
We suggest that the cross validation should be used to validate the output.
There are many cross validation methods such as Holdout method or K-Fold cross
validation. For the Holdout method, dataset will be divided into 2 sets, the training set
and the testing set. This method is good for the application that need speed in training
because we can estimate training and testing time based on the number of the dataset.
For K-fold cross validation, we separate the data set into parts and use them as they
are used in Holdout method, but we do it for K times. Each time, we choose different
data as training set and testing set. Even though, the running time is k-fold but the
validation result will be more accurate even with small number of data set.
46
References
[1] J. Christiansen, P. Holm, and F. Reymann, “Treatment of acne vulgaris with
the retinoic acid derivative ro 11-1430. A controlled clinical trial against
retinoic acid,” Dermatologica, vol. 153, no. 3, pp. 172–176, 1976.
[2] S. Sigurdsson, P. A. Philipsen, L. K. Hansen, J. Larsen, M. Gniadecka, and H.
C. Wulf, “Detection of skin cancer by classification of raman spectra,” IEEE
Transactions on Biomedical Engineering, vol. 51, no. 10, pp. 1784–1793,
2004.
[3] J. A. Witkowski and H. M. Simons, “Objective evaluation of
demethylchlortetracyclinehydrocloride in treatment of acne,” The journal of
the American Medical Association, vol. 196, no. 5, pp. 397- 400, 1966.
[4] H. Fuji, T. Yanagisawa, M. Mitsui, Y. Murakami, M. Yamaguchi, N.
Ohyama, T. Abe, I. Yokoi, Y. Matsuoka, and Y. Kubota, “Extraction of acne
lesion in acne patients from multispectral images,” in 30th Annual
international IEEE EMBS conference, pp. 4078–4081, 2008.
[5] H.-H. Wu and C.-C. Chen, "Complexsion analysis system based on computer
vision," Master Thesis, National Yunlin University of Science & Technology,
2007.
[6] H.-C. Lee, W.-J. Kuo, and H.-H. Huang, "Research on the features of human
skin appearance by image processing," Master Thesis, Yuan Ze University,
2006.
[7] VISIA Complexion Analysis, from http://www.visiacomplexion-
analysis.com/visia-complexion-analysis.asp.
47
[8] Phillips SB, Kollias N, Gillies R, Muccini JA, Drake LA, "Polarized light
photography enhances visualization of inflammatory lesions of acne vulgaris,"
Journal of the American Academy of Dermatology, pp. 948-952, 1997.
[9] Fujii H, Yanagisawa T, Mitsui M, et al, "Extraction of acne lesion in acne
patients from Multispectral Images," 30th Annual International IEEE EMBS
Conference, pp. 4078-4081, 2008.
[10] Humayun J., Malik A.S., Belhaouari S.B., Kamel N., Yap F.B.B., et al,
"Localization of acne lesion through template matching," 4th
International IEEE ICIAS Conference, pp. 91 – 94, 2012.
[11] G. O. Cula, P. R. Bargo, and N. Kollias, “Imaging inflammatory acne: lesion
detection and tracking,” in SPIE 7548, 75480I, 2010.
[12] C.Y. Chang, S. C. Li, P. C. Chu, J. Y. Kuo, and Y.C.Tu ,“Automatic Facial
Skin Defect Detection System,” IEEE BWCCA, Conference, PP.527-
532,2010.
[13] Khongsuwan M, Kiattisin S., Wongseree W., Leelasantitham A., "Counting
number of points for acne vulgaris using UV fluorescence and image
processing," IEEE BMEICON Conference, pp.142-146, 2011.
[14] B.C. Dey, B. Nirmal, and R.R. Galigekere, “Automatic Detection of Acne
Scars Preliminary Results,” IEEE PHT, Conference, PP. 224-227, 2013.
[15] Martin Krzywinski ,2006-1015. Image Color Summarizer v0.52, from
http://mkweb.bcgsc.ca/color_summarizer/?faq#whatare
[16] John W. Shipman, 2012. Introduction to color theory. The hue-saturation-
value (HSV) color model, from
http://infohost.nmt.edu/tcc/help/pubs/colortheory/web/hsv.html
48
[17] Gray Scale, from http://www.pysanky.info/Photographing/Gray_Scale.html
[18] Color Space Color Model, RGB Color Model.2012-2014, from
https://www.colorcodehex.com/color-model.html
[19] Technical Terms: Hexagonal Cone, from
http://www.clickscanshare.com/journal/technical-terms-hexagonal-cone
[20] Basic Thresholding Operations, 2011-2014., from
http://docs.opencv.org/2.4.10/doc/tutorials/imgproc/threshold/threshold.html
[21] Image editing using Array Fire: Part 3, from Simple Binary Threshold.
http://arrayfire.com/image-editing-using-arrayfire-part-3-2/
[22] James Fishbaugh, Blob Detection by Scale-Space Filtering. 2010, from
http://www.cs.utah.edu/~jfishbau/advimproc/project1/
[23] From http://homepages.inf.ed.ac.uk/rbf/HIPR2/figs/lapmasks.gif
[24] Manasi Datar, Blob Detection Using Scale Space, from
http://www.cs.utah.edu/~manasi/coursework/cs7960/p1/project1.html
[25] Mohammad Jahangiri, June 2008. Maria Petrou,Electrical and Electronics
Department,Communication and Signal Processing Group Imperial College
of London, from http://www.ipb.unibonn.de/projects/etrims/results/blob-
detection.html
[26] Vijay Kumar, Priyanka Gupta, “Importance of Statistical Measures in Digital
Image Processing” International Journal of Emerging Technology and
Advanced Engineering. ISSN 2250-2459, Volume 2, Issue 8, August 2012
[27] Image Processing Continuous Energy Minimization, from http://www1.inf.tu-
dresden.de/~ds24/lehre/bvme_ss_2013/ip_07_cont.pdf
49
[28] Du-Yih Tsai, Yongbum Lee, Eri Matsuyama, “Information Entropy Measure
for Evaluation of Image Quality” Journal of Digital Imaging, Vol 21, No 3
(September), 2008: pp 338Y347
[29] GraphPad Software, Inc. All rights reserved. 1995-2015.Interpreting skewness
and kurtosis, from
http://www.graphpad.com/guides/prism/6/statistics/index.htm?stat_skewness_
and_kurtosis.htm
[30] Stan Brown, 2008–2015. Measures of Shape: Skewness and Kurtosis,
From http://brownmath.com/stat/shape.htm
[31] Dell Inc.All rights reserved, 2015. Naive Bayes Classifier, from
http://documents.software.dell.com/Statistics/Textbook/Naive-Bayes-
Classifier
50
Appendix
51
Appendix A
List of Publication
1. Thanapha Chantharaphaichit, Bunyarit Uyyanonvara,Chanjira Sinthanayothin
and Akinori Nishihara “Automatic Acne Detection for Medical Treatment”,
ICTES International Conference on Information and Communication
Technology for Embedded Systems Vol. 06 No. 1,p33-38,March 22-24,
2015,Novotel Hua Hin Cha Am Beach Resort and Spa, Thailand
2. Thanapha Chantharaphaichit, Bunyarit Uyyanonvara, Chanjira Sinthanayothin
and Akinori Nishihara, Automatic Acne Detection With Featured Bayesian
Classifier For Medical Treatment, The 3rd International Conference on
Robotics, Informatics, and Intelligence control Technology (RIIT2015), p10-
16, 27-30 April 2015, Asia Hotel Bangkok, Bangkok, Thailand
3. Thanapha Chantharaphaichit, Bunyarit Uyyanonvara, Chanjira Sinthanayothin
and Akinori Nishihara, Automatic Facial Acne Detection With Extended
Featured Bayesian Classifier, The 11th International Symposium in Science
and Technology 2016 (ISST2016) ,26-28 July 2016,Kansai University, Japan