Printer Friendly

Beef Quality Identification Using Thresholding Method and Decision Tree Classification Based on Android Smartphone.

1. Introduction

Beef is one of the many produce prone to contamination by microorganism. Water and nutritional contents make an ideal medium for the growth and proliferation of microorganism [1, 2]. Contaminated beef will easily degrade and has less storage duration. Beef class is valued by two factors: its price and its quality. The quality itself is measured by four characteristics: marbling, meat color, fat color, and meat density. Specifically, marbling is the dominant parameter that determines meat's quality [3, 4]. Determination of beef quality is commonly conducted visually by comparing the actual beef and reference pictures of each beef class. This process presents weaknesses as it is subjective in nature and takes a considerable amount of time. Therefore, an automated system based on image processing that is capable of determining beef quality is required. Some researches suggest that image processing can be applied to analyze beef color and texture that will in turn allow analysis results to be used as a reference parameter in the process of meat quality identification [3-6]. Furthermore, marbling grade evaluation has been conducted using the watershed algorithm and artificial neural network [7].

This research aims to develop an image segmentation using the Otsu thresholding method to separate the images of fat and meat. Researches on image processing using thresholding segmentation have been conducted before [812]. The developed algorithm is proven capable of meat quality identification based on color and texture. This system is then embedded into the android programming to enable even faster and easier use.

2. Theory

Some researches on the application of image processing for beef quality identification have been conducted earlier [4-6]. One of those researches tried to determine the quality of beef using texture analysis with the gray level cooccurrence matrix (GLCM) method [3]. Beef quality is categorized into 12 grades based on the amount of fat it contains. A research by Shiranita et al. shows that the GLCM method is effective in determining beef quality. Another research on the application of image texture to classify beef type yielded a correlation up to 0.8 [5]. The other research that designed the hardware and software for beef image segmentation using the vision threshold method can be used as the initial process for beef quality testing [6]. Those researches indicate that image processing based on meat texture can be applied to identify beef quality. Some other researches also prove that mobile image analysis methods based on android programming are also applicable [13-15]. Among these android related researches is image recognition using android smartphones [13], basic digital image processing using android [14], and application of power consumption meter based on image processing using android smartphones [15]. Results of those three researches show that image processing can be embedded into android-based mobile devices.

Beef quality is categorized into 12 grades [3] as depicted in Figure 1. This is the result of image texture analysis using the gray level cooccurrence matrix (GLCM) method and meat type recognition process using the multi-support vector machine (MSVM) method.

2.1. Image Segmentation and Feature Extraction. The image processing starts from image segmentation consisting of two stages. The first is separating the meat and the background. This process begins with thresholding the blue canal of the RGB (Red, Green, and Blue) image using the Otsu thresholding method to obtain a binary image. Afterwards, the binary image is used as masking for object cropping. Once the object is separated from the background, the second stage of segmentation, that is, meat and fat separation, proceeds. This process itself starts by converting the RGB color space into the grayscale color. Then, the process of thresholding to separate meat and fat can be done. Otsu's method is also one of the oldest methods of image segmentation that is treated on statistical method according to the probabilistic implementation [16]. Otsu's method is one of the best automatic thresholding methods [17]. Basic principle of Otsu's method is to divide image into two classes that form object and background. Automatic threshold is obtained by finding the maximum variance between two classes [9, 10]. If the [1,L] is the grayscale in the image and [P.sub.i] is the probability of each level, the number of pixels with gray level i is symbolized by [f.sub.i]; thus the probability of gray level i in the image of equations is given [16, 18]:

[P.sub.i]= [f.sub.i]/N (1)

If [[mu].sub.T] is the automatic thresholding that divides the class into two classes [C.sub.1] = [1, ..., t] and [C.sub.2] = [t+1, ..., L] [17,19], therefore the probability distribution of the degree of gray for the two classes is

[mathematical expression not reproducible]. (2)

So the average range for classes [C.sub.1] and [C.sub.2] is

[mathematical expression not reproducible]. (3)

If [[mu].sub.T] is an overall average of the image, therefore by adding up all the parts it became

[[beta].sub.1][[mu].sub.1] + [[beta].sub.2][[mu].sub.2] = [[mu].sub.T], (4)


[[beta].sub.1] = [t.summation over (i=1)][P.sub.i] [[beta].sub.2] = [L.summation over (i=t+1)][P.sub.i]. (5)

Total probability will always be the same with one, so

[[beta].sub.1] + [[beta].sub.2] = 1. (6)

Therefore Otsu will define variant between two classes [C.sub.1] and [C.sub.2] by the equation

[[sigma].sup.2] = [[beta].sub.1] [([[mu].sub.1] - [[mu].sub.T]).sup.2] + [[beta].sub.2] [([[mu].sub.2] - [[mu].sub.T]).sup.2]. (7)

Optimal value threshold T is the maximum value between variant classes [[sigma].sup.2] that is shown by the following equation:

T = max {[[sigma].sup.2] (t), 1 [less than or equal to] t [less than of equal to] L}. (8)

Once segmentation is done, features extraction is carried out based on two parameters of meat area and fat area. Meat area is the number of pixels it is made of, whereas fat area is the number of pixels making up the fat area. Both parameters were used as inputs for the classification algorithm that determines the marbling score.

Otsu's method is one of the global methods looking for thresholds that minimize class variance from original image histogram, that is, background and foreground. The purpose of the Otsu thresholding method is to divide the gray level image histogram into two different regions automatically without requiring the user's help to enter the threshold value. The approach taken by Otsu's method is to conduct a discriminant analysis of determining a variable that can distinguish between two or more groups that arise naturally. Discriminant analysis maximizes these variables in order to split the foreground and background objects. Since the beef image samples have a large variance between background and object, the Otsu thresholding method is appropriate for a meat quality identification system compared to traditional segmentation.

2.2. Classification. The classification algorithm used in this research is decision tree algorithm using the C4.5 model. Classification is started by forming a root node followed by entropy value calculation for all data trained in the node. Parameters with maximum gain information were used as breaking nodes that make branches. Next, if each node has not yielded one class label, then entropy value calculation is repeated. However, when each node has yielded one class label, then each of these nodes will be used as the leave nodes containing decisions [20-22]. Based on research

[21] the decision tree based C4.5 algorithm achieved the highest classification accuracy compared with Support Vector Machines (SVM) and Multilayer Perceptron (MLP) model. Therefore in this research we used the C4.5 model for the classification of beef quality.

3. Method

The system designed in this research includes processes of image acquisition, image segmentation, features extraction, marbling score classification, and system embedding into the android programming. The diagram block for this system design is given in Figure 2.

Algorithm 1. The following is an automatic threshold using Otsu's method and classification using decision tree as follows:

(1) Start

(2) Load Image

(3) Calculate the probability of each level of intensity

(4) Set the initial values [[beta].sub.i] and [[mu].sub.i]

(5) Calculate the optimal threshold value T with different values 1 [less than or equal to] t [less than or equal to] L

(6) Update the value of [[beta].sub.i] and [[mu].sub.i]

(7) Calculate the value of [[sigma].sup.2](t)

(8) Desired threshold is the maximum value of [[sigma].sup.2](t)

(9) Calculate meat area ([A.sub.m]) and fat area ([A.sub.f])

(10) Input node parameters [A.sub.m] and [A.sub.f]

(11) Calculate entropy for all parameters in the node

(12) Choose parameters with maximum gain value

(13) Use those parameter as breaking node that make braches

(14) Each node only give one class label, if true to step (13) else step (9)

(15) Node become leaves containing marbling score decisions

(16) End

4. Result and Discussion

The image processing stages involved in this research consist of image acquisition, image segmentation, and system embedding into the android programming.

4.1. Image Acquisition. Results of beef image acquisition along with the marbling scores are given in Figure 3. The marbling scores (MB) in this research are 4, 5, 6, 7, and 9.

Image acquisition is conducted vertically by varying the camera distance, resolution, and angle. The varied distances are 20 cm and 30 cm. In addition, the varied resolutions are 3.2 MP, 4 MP, and 5 MP. Samples of beef image resulting from distance and resolution variations are given in Table 1.

In order to figure out the effect of angle in image acquisition, the following variations are made: 0[degrees], 45[degrees], 90[degrees], 135[degrees], 180[degrees], 225[degrees], 270[degrees], 315[degrees], and 360[degrees], as depicted in Figure 4.

Each image from every varied combination is taken twice. Hence, as many as 540 images were obtained.

4.2. Image Segmentation. The process of image segmentation to separate meat and fat consists of two stages. First, separating the meat from the background. This process begins with extracting the blue canal of the RGB image. This extracted blue canal then undergoes the Otsu thresholding method to yield a binary image. Then, this binary image is used as a mask in the process of meat cropping, as shown in Figure 5.

Once the meat is separated from the background. The next step of image segmentation that separates the meat and fat begins. This process itself starts by converting the RGB color space into the grayscale color. Then, the process of thresholding to separate meat and fat ensues. The thresholding values set are 76 for fat and 30 for meat. This second stage of image segmentation is given in Figure 6.

Those results show that all acquired images can be properly segmented using the Otsu thresholding method.

4.3. Features Extraction. Features extraction is carried out based on the parameters of meat area and fat area. Meat area is the number of pixels that make up that meat area (Figure 6(d)), while fat area is the number of pixels from which it is made of (Figure 6(c)). The samples of features extraction results are shown in Table 2.

Both categories of extracted features are then used as inputs in the process of beef quality classification.

4.4. Classification. In this research, marbling score classification is carried out using the decision tree algorithm. The decision tree algorithm for identification of beef quality is shown in Figure 7.

The confusion matrix that resulted from that decision tree in the training process is given in Table 3.

It can be seen in Table 3 that there are nine pieces of beef data that are wrongly identified. Hence, the resulting accuracy is

Accuracy = the number of correctly identified data / total data x 100% = 81 / 90 x 100% = 90%. (9)

The confusion matrix that resulted from the decision tree is given in Table 4. This matrix is from the testing process.

It can be seen in Table 4 that there are 14 pieces of wrongly identified beef data. Therefore, the resulting accuracy is 84%.

Results from both system training and testing using decision tree algorithm are given in Table 5.

Distance and resolution variations need to be done to determine the best distance and minimum resolution required by the system to properly acquire the beef image. Variation of distance will give an impact on the image detail obtained by smartphone camera, so that the right distance will get a good image. Results from both system training and testing show that image acquisition at 30 cm gives better accuracy compared to acquisition from a 20 cm distance. Other than that, image acquisition using a 4 MP resolution camera yields better results compared to using both 3.2 MP and 5 MP resolution cameras. While the variation of angle for beef acquisition using smartphone camera has no significant effect, the process of testing data with various angle will be recognized as beef with the same quality. So it can be concluded that the acquisition image with variation of angle does not affect the beef quality identification process; it can be seen in Figure 8. So the acquisition image can be taken from various angles with the perpendicular position between the beef and the camera smartphone.

4.5. Android Smartphone Implementation. This research uses both hardware and software. The hardware utilized is a tablet with specifications given in Table 6.

Meanwhile, the software used is android studio and openCV. The process of system embedding into the android programming is shown in Figure 9.

The identification of marbling score developed in this research has been properly embedded into the android programming. We have tested the beef quality identification time as shown in Table 7. From the test results, the average identification time process was 2.84 s. Based on these results the system can identify the quality of beef quickly. Therefore, this method can be further used for future research such as in beef quality identification based on video processing systems.

5. Conclusion

Results show that the system developed in this research is capable of acquiring and segmenting beef images and identifying marbling score. The variations involved in the process of image acquisition include camera resolution, distance, and angle. The Otsu thresholding method is able to properly separate images of fat and meat. Classification was carried out using the decision tree. The resulting accuracies are 90% for the training process and 84% for the testing process. From the test results, the average identification time process was 2.84 s. This system is then embedded into the android programming as to allow further research on beef quality identification based on video processing systems. 10.1155/2017/1674718

Conflicts of Interest

The authors declare that they have no conflicts of interest.


This research was funded by a program from the Indonesian

Directorate General of Higher Education in 2016.


[1] J. Li, J. Tan, F. A. Martz, and H. Heymann, "Image texture features as indicators of beef tenderness," Meat Science, vol. 53, no. 1, pp. 17-22, 1999.

[2] F. Ruiz De Huidobro, E. Miguel, B. Blazquez, and E. Onega, "A comparison between two methods (Warner-Bratzler and texture profile analysis) for testing either raw meat or cooked meat," Meat Science, vol. 69, no. 3, pp. 527-536, 2005.

[3] K. Shiranita, T. Miyajima, and R. Takiyama, "Determination of meat quality by texture analysis," Pattern Recognition Letters, vol. 19, no. 14, pp. 1319-1324, 1998.

[4] K. Shiranita, K. Hayashi, A. Otsubo, T. Miyajima, and R. Takiyama, "Grading meat quality by image processing," Pattern Recognition, vol. 33, no. 1, pp. 97-104, 2000.

[5] O. Basset, B. Buquet, S. Abouelkaram, P. Delachartre, and J. Culioli, "Application of texture image analysis for the classification of bovine meat," Food Chemistry, vol. 69, no. 4, pp. 437-445, 2000.

[6] K. Chen and C. Qin, "Segmentation of beef marbling based on vision threshold," Computers and Electronics in Agriculture, vol. 62, no. 2, pp. 223-230, 2008.

[7] X. Meng, Y. Sun, Y. Ni, and Y. Ren, "Evaluation of beef marbling grade based on advanced watershed algorithm and neural network," Advance Journal of Food Science and Technology, vol. 6, no. 2, pp. 206-211, 2014.

[8] K. Adi, S. Pujiyanto, O. D. Nurhayati, and A. Pamungkas, "Beef quality identification using color analysis and k-nearest neighbor classification," in Proceedings of the 4th International Conference on Instrumentation, Communications, Information Technology and Biomedical Engineering, ICICI-BME 2015, pp.

180-184, idn, November 2015.

[9] K. Adi, R. Gernowo, A. Sugiharto, K. S. Firdausi, A. Pamungkas, and A. B. Putranto, "Tuberculosis (TB) Identification in The Ziehl-Neelsen Sputum Sample in NTSC Channel and Support Vector Machine (SVM) Classification," International Journal of Innovative Research in Science, Engineering and Technology, vol. 2, no. 9, pp. 5030-5035, 2013.

[10] K. Adi, R. Gernowo, A. Sugiharto, A. Pamungkas, A. B. Putranto, and N. Mirnasari, "Autothresholding Segmentation For Tuberculosis Bacteria Identification In The Ziehl-Neelsen Sputum Sample," in Proceedings of the 7th International Conference on Information & Communication Technology and Systems, Bali, Indonesia, 2013.

[11] K. Adi, S. Pujiyanto, R. Gernowo, A. Pamungkas, and A. B. Putranto, "Identification of plasmodium falciparum phase in red blood cells using artificial neural networks," International Journal of Applied Engineering Research, vol. 9, no. 22, pp. 13917-13924, 2014.

[12] A. Pamungkas, K. Adi, and R. Gernowo, "Identification of plasmodium falciparum development phase in malaria infected red blood cells using adaptive color segmentation and decision tree based classification," International Journal of Applied Engineering Research, vol. 10, no. 2, pp. 4043-4056, 2015.

[13] I. Billiauws and K. Bonjean, Image Recognition on an Android Mobile Phone (Msc. thesis), Elektronica-Ict, 2009.

[14] R. S. Jagtap and J. A. Sadalage, "Image Processing as Android Application," International Journal of Science and Research Technology, vol. 1, no. 2, pp. 12-15, 2013.

[15] K. M. Saipullah, A. Anuar, N. A. Ismail, and Y. Soo, "Measuring power consumption for image processing on Android smartphone," American Journal of Applied Sciences, vol. 9, no. 12, pp. 2052-2057, 2012.

[16] N. Otsu, "A threshold selection method from gray-level histogram," IEEE Transactions on System Man Cybernetics, vol. 9, no. 1, pp. 62-66, 1979.

[17] D.-Y. Huang, T.-W. Lin, and W.-C. Hu, "Automatic multilevel thresholding based on two-stage Otsu's method with cluster determination by valley estimation," International Journal of Innovative Computing, Information and Control, vol. 7, no. 10, pp. 5631-5644, 2011.

[18] F. Jassim and F. H. AAltaani, "Hybridization of otsu method and median filter for color image segmentation," International Journal of Soft Computing and Engineering (IJSCE), vol. 3, no. 2, 2013.

[19] H. K. Singh, S. K. Tomar, and P. K. Maurya, "Thresholding Techniques applied for Segmentation of RGB and multispectral images," in Proceedings of the MPGI National Multi Conference 2012 (MPGINMC-2012, Advancement in Electronics Telecommunication Engineering), 2012.

[20] H. Chauhan and A. Chauhan, "Implementation of decision tree algorithm c4.5," International Journal of Scientific and Research Publications, vol. 3, no. 10, 2013.

[21] F. S. Alaa and A. Amneh, "A Professional Comparison of C4.5, MLP, SVM for Network Intrusion Detection based Feature Analysis," ICGST Journal of Computer Networks and Internet Research, vol. 6, no. 3, pp. 192-205, November 2015.

[22] J. Jashan and M. Bag, "Cascading of C4.5 Decision Tree and Support Vector Machine for Rule Based Intrusion Detection System," International Journal of Computer Network and Information Security, vol. 4, no. 8, pp. 8-20, 2012.

Kusworo Adi, (1) Sri Pujiyanto, (2) Oky Dwi Nurhayati, (3) and Adi Pamungkas (1)

(1) Department of Physics, Diponegoro University, Semarang, Indonesia

(2) Department of Biology, Diponegoro University, Semarang, Indonesia

(3) Department of Computer System, Diponegoro University, Semarang, Indonesia

Correspondence should be addressed to Kusworo Adi;

Received 11 April 2017; Revised 24 August 2017; Accepted 5 September 2017; Published 17 October 2017

Academic Editor: Paolo Napoletano

Caption: FIGURE 1: Beef quality levels based on marbling scores [3].

Caption: FIGURE 2: Research diagram block.

Caption: FIGURE 3: Samples of acquired beef images.

Caption: FIGURE 4: Samples of beef image with variation of camera angle.

Caption: FIGURE 5: The first stage of beef segmentation.

Caption: FIGURE 6: The second stage of beef segmentation.

Caption: FIGURE 7: Decision tree for beef image with 4 MP resolutions.

Caption: FIGURE 8: Example of testing result for variation of angle with marbling score (MB) 6.

Caption: FIGURE 9: System embedding into android.

TABLE 1: Samples of beef image from varied camera distance and

                     3.2 MP   4MP   5MP
Distance     20 cm
             30 cm

TABLE 2: Samples of features extraction.

Number of image   Image   MB            Features

                               Meat area   Fat area

1                         4      27859      52910
2                         5      16355      48738
3                         6      89665       9925
4                         7      16873      60255
5                         9      42868      45583

TABLE 3: Confusion matrix from decision tree in the
training process.

                               Predicted class

                      MB 4   MB 5   MB 6   MB 7   MB 9

Actual class   MB 4    12     0      0      2      4
               MB 5    1      17     0      0      0
               MB 6    0      0      17     0      0
               MB 7    0      1      1      17     0
               MB 9    0      0      0      0      18

TABLE 4: Confusion matrix from decision tree in the testing process.

                                 Predicted class

                      MB 4   MB 5   MB 6   MB 7   MB 9

Actual class   MB 4    12     1      0      2      3
               MB 5    1      14     0      0      0
               MB 6    0      0      17     0      0
               MB 7    1      2      1      15     0
               MB 9    3      0      0      0      18

TABLE 5: Overall results from both training and testing processes.

                           Distance        Resolution           No
                           variation        variation        variation

                       20 cm   30 cm    3,2    4 MP   5 MP

Number of   Training    135     135     90      90     90       270
  image     Testing     135     135     90      90     90       270
Accuracy    Training    82      86      83      90     90      37,7
  (%)       Testing     80      81      81      84     78      35,18

TABLE 6: Hardware specification.

  Dimension     214 x 120 x 8.9 mm
  Weight        328 g
  Type          IPS LCD capacitive touchscreen, 16 M colors
  Size          8.0 inches (~72.3% screen-to-body ratio)
  Resolution    800 x 1280 pixels (~189 ppi pixel density)
  OS            Android OS, v4.4.2 (KitKat)
  Chipset       Intel Atom Z3530
  CPU           Quad-core 1.33 GHz
  GPU           PowerVR G6430
  Primary       5 MP, autofocus
  Features      Geotagging
  Video         720 p
  Secondary     2MP

TABLE 7: Result of testing identification time.

Sample      Image   Time (s)

Sample 1              3.27
Sample 2              2.62
Sample 3              2.55
Sample 4              2.48
Sample 5              3.27

Average identification time
COPYRIGHT 2017 Hindawi Limited
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2017 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Title Annotation:Research Article
Author:Adi, Kusworo; Pujiyanto, Sri; Nurhayati, Oky Dwi; Pamungkas, Adi
Publication:Journal of Food Quality
Article Type:Report
Geographic Code:1USA
Date:Jan 1, 2017
Previous Article:Comparative Study on Different Drying Methods of Fish Oil Microcapsules.
Next Article:Cation-Specific Effects on the Self-Assembly of Collagen Molecules Mediated by Acetate on Mica Surface Observed with Atomic Force Microscopy.

Terms of use | Privacy policy | Copyright © 2019 Farlex, Inc. | Feedback | For webmasters