Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 9

Prototype of Pornographic Image Detection with

YCbCr and Color Space (RGB) Methods at


Computer Vision

XXX-X-XXXX-XXXX-X/XX/$XX.00 ©20XX IEEE


Abstract— Technological developments in the social field very important to develop an application program for
have brought about changes in terms of social communication, pornographic filters based on existing studies. This is
mindset, and changing attitudes, especially for elementary and needed so that images that are considered pornographic can
middle school age children. In addition, technological be directly detected and censored.
developments in the social field also influence the ethical
aspects of communication, where many young people give
information excessively on social media which includes family II. RESEARCH METHOD
and romance. One of the negative effects of social change A. Research Flow
caused by technological developments is the widespread The author applies several methods and completion
circulation of content that contains pornographic elements. procedures that aim to solve problems that exist in the study
The pornographic content is generally accessed from social and analyze the performance of skin color detection which
media such as Facebook, Instagram, Path, Whatsapp and can distinguish between the color of human skin and not the
Youtube to access and view pornographic content. The purpose color of human skin in an image, so that the image can be
of this study was to develop a system for identifying
said to be pornographic and can be searched for images
pornographic image negative content by designing a prototype
of pornographic image detection using the YCbCr method and pornography in a computer directory. One method for
color space (RGB) on computer vision by filtering the detecting pornographic imagery is to use the YCbCr and
algorithm of previous researchers, measuring instruments to Color Space (RGB) color models. The completion procedure
determine the accuracy of prototypes using the Confusion performed is shown in Figure 1. as follows:
Matrix algorithm. The process of image detection test produces
an accuracy rate of 76%, precision value = 82.142%, and recall
value = 76.666% of 50 random datasets between pornographic Early Stage Study Of Literature

positive images and non-pornographic images for the YCbCr Book research report
Journal
method and accuracy rate = 43.42%, precision value = 44.23%,
and recall value = 50.17% of 146 random datasets between
Data Collection
pornographic positive images, non-pornographic images and
semi-pornographic images for the RGB method.

Keywords— YCbCr, Color Space, RGB, Pornography


Detection, Confusion Matrix

I. INTRODUCTION
Pornography is a term used for images, readings, or
information that has a negative connotation, or according to
the Big Dictionary of Indonesian Language pornography is
material sexuality made by humans in the form of images,
sketches, illustrations, photos, writings, sounds, moving
images, animations or shapes other communication messages
through various forms of communication media that can
arouse sexual desire or violate the value of decency in
society [1]. Efforts to prevent free access to pornography
have been carried out by building systems that are able to
identify whether the address addressed by internet users
(through a browser) is an address that is free of pornography
or not. In general the techniques used are [2]: Checking
words that contain pornographic elements in a URL
(Uniform Resource Locator), Build a very large database to
store addresses of sites that contain pornographic elements,
Check the contents of the web page, whether it contains Count pixels
object
Porn

pornography or not. At present almost all people in all Count The Count The
Percentage Of
Show
Number Of Information
places and ages understand the internet and use it to the Pixels Of The
Image Count pixels
The Image
Object Not Porn
background
maximum extent possible to get whatever information is
needed, without going through a fairly difficult mechanism
and even tend to be free. The information circulating freely
is not all constructive and true. There is also a lot of untrue Accuracy

and even destructive information, one of which is


pornography. Family Safe Media reports that every second, Calculate Precision Show

28,258 people around the world see pornography on the True


Percentage
Information
evaluation
report
internet, 372 internet users type in search words related to
pornography in search engines, it is also reported that the
number of pornographic websites currently reaches 4.2
million (12% of total website), number of pornographic
pages 420 million, and of all types of data downloaded per
month, 35% are pornographic material [3]. Therefore it is
Figure 1. Research Method
In Figure 1. there are 3 main stages, namely Pre
processing, where in this stage the RGB image conversion is ............................................................................(6)
made into YCbCr Image. Then in the detection stage
From equation 6 can be seen if Cr has a range between
detection will be carried out using an algorithm taken from
135 and 180, Cb has a range of 85 to 135 and the value of Y
previous research [4], while in the RGB method in Figure 1.
must be greater than 80 [10]. There are also other studies
above there are 3 main stages namely pre-processing where
regarding human skin detection using the YCbCr method and
in this step the first step is choosing an image to be detected,
combined with RGB and HSV to produce the following
then the image will be resized to anticipate a large size image
equation:
so that the incoming image can be detected perfectly, after
the image is resized to size, a pixel value will be taken. Then
the detection phase will be detected using an algorithm taken
from previous studies [5]. In the pornographic stage the
classification of the two methods will be compared to the
number of background pixels by the number of pixels objek
to calculate the percentage of pixel objects in an image.
B. RGB Color Conversion to YCbCr ........................(7)
RGB color is a color that consists of three main Equation 7 is the detection of human skin using three
components, namely Red Green and Blue where each color color ranges [4]:
is worth between 0 and 255. The color YCbCr consists of
two main color chromas, namely medah and blue and light D. YCbCr Background Remove
intensity. To be able to convert RBG images to YCbCr, After the object detection process in the image is carried
conversion can be done using the following method: out, information that does not meet these requirements will
be considered as background. To simplify the image analysis
process, information containing background data needs to be
deleted so that the data will be ignored.The process of
(1)
deleting information is done by changing the pixel value
From the equation above, it can be seen that the values of from the background data to black (0,0,0) or 000000. The
Y, Cb and Cr depend on the existing RGB value [6]. There background that has been converted to black will be
are also other methods to convert from RGB to YCbCr, as combined again with data that contains object information.
follows:
..........................................(8)

.....(2) E. Efforts to Increase Accuracy


In the process of detecting an image containing
The RGB to YCbCr conversion equation [10]: pornographic content, the method [10] in equation 6. In its
application, the method still has weaknesses, namely if there
are other objects that have colors that resemble the color of
human skin, they will be identified as human skin. To
....................(3) minimize errors in the image detection process containing
The RGB to YCbCr conversion equation [7]: pornographic elements, additional filters will be made based
on the YCbCr color range so that it can improve accuracy in
the detection process. Efforts to increase accuracy are done
.........(4) by making YCbCr color filters with a shorter color range.The
process of deleting information is done by changing the pixel
C. YCbCr Skin Detection value from the background data to black (0,0,0) or 000000.
The process of detecting objects in analyzing an image is The background that has been converted to black will be
a stage that cannot be separated in this study. The approach combined again with data that contains object information.
used in object detection is by using the skin detection
method, namely the process of detecting human objects by F. YCbCr Pornography Classification
utilizing human skin color as the detection media used. In the previous stage, information from the image in the
Previous researchers who have carried out skin detection form of objects and background has been obtained.
with the YCbCr color range have made an algorithmic Background data and object data will be compared so that
approach to detect skin color with the following equation: information obtained in the form of a large percentage of
objects to the pixel size of the image.
..............................................................(5) ....(9)
From equation 5, it is seen to detect human skin Cr value
is in the color of 133 and 183, then Cb is in the color range G. RGB method
77 and 128 while the Y value has no limit [8]. Research that To be able to distinguish human skin color in an image
Romi Fadillah Rahmat, et al also agreed with Brancati that to the researchers have previously conducted research related to
detect human skin using equation 5 [9]:
this problem there are several alternative methods that have
been found before, among others, as follows [4]: Recall= X 100%..............................................(13)
1. R > 95 and G > 40 and B > 20 and Where:
2. Max (R, G, B) – Min (R, G, B) > 15 and 1. TP is True Positive, which is the amount of positive
3. |R – G| > 15 and data that is correctly classified by the system.
4. R > G and R > B ...............................................(11) 2. TN is True Negative, which is the amount of negative
In the process of an image that contains pornographic data that is correctly classified by the system.
content methods will be used from previous studies [11] 3. FN is False Negative, which is the amount of negative
from the algorithm equation (11). In its application, the data but is incorrectly classified by the system.
method still has a weakness, namely if there are other 4. FP is False Positive, which is the amount of positive
objects that have the color resembling the color of human data but incorrectly classified by the system.
skin, they will be identified as human skin. To reduce errors
in the process of detecting images containing pornographic III. RESULT
elements, additional filters are made based on the RGB A. YCbCr
color range so that it can improve accuracy in the detection Pre-Processing
process. Efforts to increase accuracy are done by making One image sample used for resizing the image is an
RGB color filters with shorter color ranges. After the object image in a dataset called nude19.jpg with a size of 675px X
detection process in the image is carried out, information 900px which is then resized to 225px X 300px. The images
that does not meet these requirements will be considered as that have been resized are shown as in Figure 3:
background. To simplify the image analysis process,
information containing background data needs to be deleted
so that the data will be ignored. The process of deleting
information is done by changing the pixel value from the
background data to black (0,0,0) or 000000. The
background that has been converted to black will be
combined again with data that contains object information.
Figure 3. Display Of Resized Images
R = 0, G = 0, B = 0..........................................................(12)
The next step in the analysis process is to convert the
In the previous stage, information from the image in
RGB color range to a range of colors YCbCr. The
the form of objects and background has been obtained.
nude19.jpg image that has been resized will then be
Background data and object data will be compared so that
converted into the YCbCr color range using equation 2
information obtained in the form of a large percentage of
found [6], while the manual calculation process in the
objects to the pixel size of the image.
conversion process is as follows.
.............................................................(13)

H. Measurement of Algorithm Performance ......(2)


In the confusion matrix, the results of the trial results
will be divided into two classes, positive class and negative The RGB conversion equation to YCbCr [6]. The first
class as shown in Figure 2. Where the positive class pixel calculation based on equation 2 is as follows:
contains the correct test results that are considered true (true
positive) and the correct test results are considered false
(true negative). Whereas in the Negative class there is a
wrong trial result (false positive) and the wrong test results Step 2
are considered wrong (false negative) [12].

Step 3

Figure 2. Class in Confusion Matrix Step 4


In confusion matrix, there is an equation used to
calculate the accuracy of a method that looks like the
following:
Accuracy= X 100% Step 5

Precision= X 100%
New images that are formed from the results of previous researchers. There are several experiments
calculations, among others, look like figure 4: conducted to get the appropriate results in the process of
finding a new filter by adding a filter with the number 5.10
and doing a filter reduction with 5.10 as well. The first
detection process is to add a number 5 so that the equation
formed is like the following equation 12.
and
Figure 4. Display of images that have been converted to or
YCbCr
The initial stage in the analysis process of an image ................................................................(12)
has been completed at the conversion stage to the YCbCr Based on the results of the filter algorithm test the
color range. In this stage the image is ready to be carried out overall value of YCbCr can be seen in table 1. below:
between the object and the background, this stage will be Table 1. Results of Image Filters By Changing Filter Values
explained in the next sub-chapter. Early Test Algorithms in Research
Detection Algorith +5 +10 -5 -10 Combin
The approach taken in the pre-processing stage is to m ed
search for similarities in pixel values with human skin color
in general. In this stage the image that has been converted
into the ycbcr color range will be taken from each pixel. The
filtering process carried out includes the following:

..............................................................(5) B. Color Space (RGB)


Maka Pre-Processing
The results of filtering that do not match the filter will be
considered as background, the data that is considered to be
the background will be converted into black.
The pixel value of Cb, and for which Cr meets the
requirements, it will be considered an object, so that the first
pixel with the value Cb = 123.099 and Cr = 142.5 and Y =
207.671 are objects. Pixels that are considered as objects
will be given a white color, while pixels that are considered
as backgrounds will be colored black so that the image Figure 7. Test Results Separation between Objects and
formed is an image in black and white. Look at picture 5 Backgrounds in an Image
below: Detection
The calculation process is done by comparing the
percentage of objects with the entire image, in this study a
trial was conducted based on the equations of previous
researchers [4] and new filters based on the RGB value
range of an image. Previous researchers suggested that
including skin color if [4]:
Figure 5. The initial view of the image that has been
1. R > 95 and G > 40 and B > 20 and
separated from the background and object
2. Max (R, G, B0 – Min (R, G, B) > 15 and
After the separation between objects with the next
3. |R – G| > 15 and
stage is to display each pixel that is considered an object so
4. R > G and R > B
that the image that appears is an image that displays an
The results of applying the algorithm of the previous
object with a black background. Objects are identified based
researcher [4] based on the above equation can be seen in
on their resemblance and compatibility with the color of
the figure 8.
human skin, so that the new image formed looks like picture
6:

Figure 8. Application of Previous Researcher Algorithm


Test Results
Figure 6. Display of images that have displayed the The test results show that the background of the color-
background and object like image (in plain view) is detected as a skin with details
In figure 6. the image that has been filtered appears of values based on the following calculations:
using the equation of the previous researcher. One of the Number of pixcel objects = 20350
contributions of researchers in the field of education is by Number of pixcel backgrounds = 38450
adding additional filters to separate the background that The total amount of pixcel = 58800
previously could not be detected based on the algorithm of Image background percentage = 65.391156462585%
Percentage of objects to image = 34.608843537415%
Based on the calculation of the algorithm of the
detection of previous researchers [4], the current research
conducted a filter test of the value of X to obtain the
accuracy of an image is said to be pornographic or not based
on the algorithm equation 6, and the researcher limits the
value if the percentage value of the object is> = 30% then it Figure 9. Image results resized
is pornographic, and vice versa if <= 30% then not porn
(from equation 7). From the reference based on the test
image 12. algorithm of the previous researcher of the
reading system if the value of the object percentage to the
image = 34.608843537415% automatically the system states
that the image is pornographic, but it is invisible that the
image is not pornographic, based on the test results try to Figure 10. Background and Object Detection
add or reduce the existing RGB value so that the accuracy of
reading the image is fulfilled between reading the system
and invisible to a pornographic image or not. For the
contribution of the research, the researcher changed the
existing number filter with several trials, the first to do the
test was to change the values of R, G, and B by increasing
the numbers to 5, 10, 15, and decreasing each value 5, 10, Figure 11. Showing the object value
15, so the results can be seen in table 3:
Table 2. Results of image filters by changing the values of
R, G, and B
Algoritma Algoritma Uji Penelitian
Awal +5 +10 +15 -5 -10 -15

Figure 12. Displaying pixel value of the object (previous


researcher)

Based on table 3. there is a clear accuracy of the


differences between objects and backgrounds, if only a
small amount of background is considered in the previous
research between objects and color-like backgrounds, after
testing the filter values of R, G, and B by adding 5, 10 and
15 and a reduction in the values of 5, 10, and 15 from the Figure 13. Displays pixel value of objects (current
initial values of the previous researcher, and from the test it contributions of researchers)
was concluded that the reduction value of 15 was better and D. Confusion Matrix
would be used as a test for pornographic or non- Based on the results of the dataset dataset, there are 146
pornographic image detection datasets because the image data consisting of semi-pornographic images as much
background color was selected as background more than the as: 22, non-pornographic images: 98 and pornographic
initial research with the gap value of the percentage of images: 26. In this study to be able to see how high the
objects to the image: 34.608843537415% - accuracy of the algorithm is used the confusion matrix
20.018707482993% = 14.59%., and the results showed that method is used [ 19]. Following in Table 4. a reference is
the image was not pornographic. given in determining the accuracy value of the algorithm
using the confusion matrix method:
C. Test data sets with Prototype Table 3. Confusion Matrix
In conducting a dataset test through the prototype of the Prediction
results of the study, the prototype was able to show the steps
of the image detection process including pornography or not   Porn No Porn
based on filters that were made. As well as showing the Actual Porn TP FN
results of the process in the right-hand information column, No Porn FP TN
examples of image detection are shown in figures 9, 10, 11,
12, and 13 below: Then the algorithm accuracy value obtained using the
current confusion matrix method from the study: TP = 43,
TN = 62, FN = 6, FP = 35. So that the results of the
accuracy value = 43.42%, the value of precision = 44.23%,
and the recall value = 50.17%, based on the test results
above, it can be concluded that the value of the previous
algorithm for current research is the value of accuracy, Segmentation Approach,” Indian Journal of Science and
precision, and recall can be higher based on the confusion Technology, vol. 9(32), no. ISSN (Print) : 0974-6846,
matrix for RGB method and the process of measuring the ISSN (Online) : 0974-5645, 2016.
performance of the YCbCr algorithm using the Confusion [6] M. K. Pandey, “Non-blind Arnold scrambled hybrid
Matrix method, using 50 data samples as trial material. In image watermarking in YCbCr color space, Springer-
the trial process, the accuracy of the information was 76%, Verlag GmbH German,” 2018.
Precision 82.142% and Recall 76.666%. [7] M. Saini, “LWT Based Hybrid Digital Watermarking
Scheme in YCbCr Colour Space,” dalam International
IV. CONCLUSION Conference on Intelligent Circuits and Systems, 2018.
In the dataset testing process, 76% accuracy, 82.142%
[8] d. N. Brancati, “Dynamic Clustering For Skin Detection In
accuracy and 76.666% recall data were obtained. this data is
YCbCr Colour Space, National Research Council (CNR),”
obtained from the results of 50 test data with each test data
Institute for High-Performance Computing and
that has been labeled into 2 groups namely porn and not
Networking, no. 80131 Napoli, Italy, 2016.
porn. The image detection testing process using the RGB
method using confusion matrix produces an accuracy rate of [9] d. Romi Fadillah Rahmat, “Skin Color Segmentation
43.42%, precision value = 44.23%, and recall value = Using Multi-Color Space Threshold,” International
50.17% of 146 random data sets between positive Conference On Computer And Information Sciences
pornographic images and non-pornographic images and (ICCOINS), 2016.
semi-pornographic image.. [10] D. Chaudhary, “Spotting and Recognition of Hand
Gesture for Indian Sign Language using Skin
ACKNOWLEDGMENT Segmentation with YCbCr and HSV Color Models under
The results of the value filter between the YCbCr and different Lighting Conditions,” International Journal of
RGB methods in this study produce better accuracy values Innovations & Advancement in Computer Science
from previous studies using prototypes made, so that it can (IJIACS), vol. 6, no. 9 September 2017, 2017.
be used for subsequent research in system implementation [11] N. N. K. B. a. I. P. Sotiris Karavarsamis, “Detecting
using this algorithm or modified prototype so that it can be Pornographic Images by Localizing Skin ROIs,”
used as an embedded system or application program API International Journal of Digital Crime and Forensics,
others so that the image identified by porn will automatically 2013.
be censored. [12] W. S. Erwin Rizki Ariyanto, “KLASIFIKASI CITRA
REFERENCES PORNO DENGAN ALGORITMA C 4.5,” Techno.COM,
Vol. %1 dari %215, No. 2, pp. 92-98, Mei 2016.
[1] W. H. dkk, “Mengenali Kecanduan Situs Porno Pada [13] S. B. Istiyanto, “Telepon Genggam Dan Perubahan Sosial
Remaja: Gambaran Mengenai Faktor Penyebab Dan Studi Kasus Dampak Negatif Media Komunikasi Dan
Bentuk Kecanduan Situs Porno,” Psikologi Talenta, vol. 3 Informasi Bagi Anak-Anak Di Kelurahan Bobosan
No. 2, Maret 2018. Purwokerto Kabupaten Banyumas,” Jurnal Komunikasi
[2] Y. d. T. H. Lin, “Pornography Detection Using Support Ikatan Sarjana Komunikasi Indonesia (ISKI), 2016.
Vector Machine,” 2003. [14] M. S. H. Mujahiddin, “Model Penggunaan Media Sosial
[3] F. S. Media, “Pornogrpahy Statistics,” 27 Juli 2012. Di Kalangan Pemuda,” Jurnal Interaksi, vol. 1 Nomor 2,
[Online]. Available: Juli 2017.
http://www.familysafemedia.com/pornography_statistics.ht [15] H. Y. Primita, “Pengaruh Media Pornografi Terhadap
ml. [Diakses 2018]. Pengetahuan, Sikap Dan Perilaku Seksual Pada Siswasma-
[4] d. S. Kolkur, “Human Skin Detection Using RGB, HSV SMK Mandiricirebon,” OASIS : Jurnal Ilmiah Kajian
and YCbCr Color Models, B. Iyer, S. Nalbalwar and R. Islam, Vol. %1 dari %22, No. 2, Februari 2018.
Pawade (Eds.) ICCASP/ICMMD-2016,” Advances in [16] M. M. H. Noor A. Ibraheem, “Experiencing Various Color
Intelligent Systems Research, vol. 137, no. Pp. 324-332, Models on Colored Images,” International Journal of
2017. Computer Applications, vol. 169 – No.2, july 2017.
[5] a. D. G. Shimal Das, “A New Hybrid Fractal based Color
Image Compression in YCbCr Scheme and Discrete
Cosine Transform with Quadtree and Isosceles Triangle

You might also like