# The Judgment of Beef Marble Texture Based on the MATLAB Image Processing Technology

Ruokui Chang, Yong Wei, Lizhen Ma, Yuanhong Wang, Hua Liu, Mingyu Song

► To cite this version:

Ruokui Chang, Yong Wei, Lizhen Ma, Yuanhong Wang, Hua Liu, et al.. The Judgment of Beef Marble Texture Based on the MATLAB Image Processing Technology. 4th Conference on Computer and Computing Technologies in Agriculture (CCTA), Oct 2010, Nanchang, China. pp.106-112, 10.1007/978-3-642-18354-6_15 . hal-01563441

HAL Id: hal-01563441

https://inria.hal.science/hal-01563441

Submitted on 17 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# The Judgment of Beef Marble Texture Based on the MATLAB Image Processing Technology

Ruokui Chang¹, Yong Wei¹, Lizhen Ma², Yuanhong Wang³*, Hua Liu¹, Mingyu Song¹

¹Department of Electromechanical Engineering, Tianjin Agricultural University, Tianjin, P.R. China 300384

²Department of Food Science, Tianjin Agricultural University, Tianjin, P.R. China 300384

³Department of Horticulture, Tianjin Agricultural University, Tianjin, P.R. China 300384

*Corresponding author, Address: Department of Horticulture, Tianjin Agricultural University, Tianjin, P.R. China 300384, changrk@163.com

**Abstract.** The beef texture as marble is one of the important quality indexes of beef. Since the grading of beef marbling is largely determined by the subjective experience of the graders, there are inconsistencies and errors in judgment. Therefore, how to find objective and quantitative measure of the marbling abundance degree according to the grade standard of beef marbling has been one new study in the world meat science fields. We can use image analysis tools of Matlab to preprocess the image of beef marbling. Through data analysis, the percentage of image content marbled has been obtained, the detection model can be established through the construction of neural network, so it can lay the foundation for the prediction grade of the unknown kinds of beef marbling in the future.

**Keywords:** marbling level; image; beef; grading

## 1. Introduction

With the development of economy and the improvement of people's living standards, our food structure has changed greatly, beef consumption is growing, and the quality of beef has attracted unprecedented attention. The evaluation method and criteria for beef quality exist in many developed countries. Among them, beef marbling is one of the key indicators. According to the marbling content, According to China's agriculture industry standard – "Beef Quality Grading", marbling can be divided into four levels: very rich, rich, a little and little, 0.5 between each level [1].

The marbling of beef is often regarded as an important indicator [1,2], but currently, there are no quantitative methods and standards in China. The classification relies more on human eyes. The method is very subjective and random, and the speed of classification is slow with low accuracy. Therefore, the study of advanced computer vision technology using quantitative methods of beef grading, is of great importance for establishing the automatic classification system.
## 2. Material and Methods

The test samples of selected images include four beef marbling assessed by experts in China, and a number of sites from Food Research Centre of Tianjin University of Agriculture. Test images are true color of RGB, storage format are all as BMP, the pixels of processing the image are 317x173.

Firstly, the image index of beef marbling was determined. Secondly, the image feature parameter was extracted with all kinds of methods. Finally, the relationship between image parameters and final grade rating members was established. The detailed measures are as follows: on the basis of standard images, the image feature parameters are extracted and regarded as the input variables of neural network; Then the NN is trained, the mode between the grading and characteristic parameter of the image is established. As is shown in Fig. 1.

<figure><img src="image_2.png" /><figcaption>Fig.1. Flow chart of image feature extraction</figcaption></figure>
### 3. Image Processing

As the images will be interfered and form noises during the transmission process. This will result in visual difficulties when extracting and identifying the features from images or cause poor visual effects. Therefore, firstly, we must address the image denoising, we decided to remove noises using median filtering through experimental comparison[3,4]. Secondly, we can get the images with no background points by selecting different growing points, the last pixel was chosen as the initial growing point. Due to different images, the initial points may be different. If the background is black with dim background, it should be chosen at the first pixel where they intersect. Finally, according to the characteristics of the image level, we can use the Otsu method for image segmentation. The steps for extracting the feature parameters of standard grade beef image are shown in Fig. 2.

<figure><img src="image_3.png" /><figcaption>**Fig.2.** Flow chart of image feature extraction</figcaption></figure>
**3.1. Image Type Conversion**

In order to facilitate the following image processing, we can use the beef marbling image of grade A as reference to finish the following process. First, the RGB was converted into a grayscale, it achieve through rgb2grey in Matlab, as is shown in **Fig. 3.** and **Fig. 4.**

<figure><img src="image_4.png" /><figcaption>Fig.3. RGB Chart</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Fig.4. The grey image</figcaption></figure>

The image denoising should be done before further processing, we can use the method of median filtering to remove noises by comparing more images through average method, neighborhood average smoothing, preserving edge smoothing, median filtering and other denoising methods. To more accurately extract the background of block beef, we should note that the threshold conditions and the initial points, after repeated debugging, we will set the threshold condition is less than 0.5, and select the image lower right corner of the last row last column of a pixel as the initial growing point, then we can obtain satisfactory background segmented image.

**3.2. Image segmentation**

When the image is in the process of binarization, we usually use the global threshold method. In the experiment, we will use OTSU algorithm which is based on gray-level image, to divide the image into two parts: background and foreground[4,5]. The method is simple, without affecting the image brightness and contrast characteristics, it read the threshold more accurately than from the R, G, B, L-channel histogram of each component, the error is small, and segment is more accurate, it is the best algorithm in image segmentation of threshold. As is shown in **Fig. 5.**

<figure><img src="image_6.png" /><figcaption>Fig.5. Binary image</figcaption></figure>
**3.3. Image Subtraction Algorithm**

The image subtraction method refers to the method of getting the new output image through two images, point of addition, subtraction, multiplication, division calculations[4]. Through subtracting, the unwanted areas can be removed from the image, and retain the areas which we are concerned about. **Fig. 6.** is the fat part of the beef, It is obtained by subtracting. **Fig. 7.** shows largest retained areas covered with fat after the removal of small isolated areas.

<figure><img src="image_7.png" /><figcaption>Fig.6. Fat part</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>Fig.7. Covered with fat area</figcaption></figure>

**3.4. Fill the image**

To remove the small muscles of fat, we use the method of filling. **Fig. 8.** shows us the experimental results of **Fig. 7.** are obtained through filling. We can get the muscular part by using the image subtraction method for the second time. **Fig. 5** will be negated, and then with the muscular part to obtain the required intersection of segmentation results, it is shown in **Fig. 9.**

<figure><img src="image_9.png" /><figcaption>Fig.8. The result of filling</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>Fig.9. Segmentation result</figcaption></figure>

Finally, Through using the method of filling and image subtraction again, we can calculate the area of Muscle tissue, marbling and Intramuscular fat with statistical functions of Matlab.

**3.5. Image Analysis of Beef**

Using the image analysis method, we obtain the result of different levels beef samples by programming. It is shown in **Table 1**.
<table><caption>Tab.1. Image analysis results compared with manual ratings</caption><thead><tr><th>Grade</th><th>1</th><th>2</th><th>3</th><th>4</th></tr></thead><tbody><tr><td>Marbling percentage</td><td>0.0320</td><td>0.0136</td><td>0.00842</td><td>0.0042</td></tr></tbody></table>

## 4. Automatic Grading System of Beef

As it's difficult to establish a linear relationship between the features of beef marbling and grade, we use three-tier BP neural network in order to rapidly and accurately determine the grade of beef marbling. We use the main components, like the total area of intramuscular, marbled area and so on, which are extracted from the images of beef as the input layer of BP network. The output layer corresponds to the level of grading standards. So the mapping relationship can be established from P2 to y1.

The 35 marbling images of beef were selected randomly, in which 30 samples for training, 5 as testing samples. Fig.10 shows the network structure.

<figure><img src="image_11.png" /><figcaption>Fig.10. Neural network system of marbling grade</figcaption></figure>

**Table 2.** shows the forecasting grade, the true grade and the relative error of 5 samples, which are selected from prediction set. From **Table 3.**, we can see that the relative error exist between the forecast grade and the true grade. It is mainly caused by small sample size.

<table><caption>Table2. The predicted result of sample</caption><thead><tr><th>subject</th><th>Predicted value (degree)</th><th>True value (degree)</th><th>relative error</th></tr></thead><tbody><tr><td>1</td><td>3.9987</td><td>4</td><td>0.0013</td></tr><tr><td>2</td><td>1.1284</td><td>1</td><td>0.1284</td></tr><tr><td>3</td><td>3.9976</td><td>4</td><td>0.0024</td></tr><tr><td>4</td><td>2.9984</td><td>2</td><td>0.9984</td></tr><tr><td>5</td><td>2.9984</td><td>2</td><td>0.9984</td></tr></tbody></table>
## 5. Conclusions

This experiment proved that using image processing tools of Matlab instead of the manual methods is feasible to determine beef marbling. Through the preprocessing operation of images, the application of "Image Subtraction method" and "region growing" is an effective way to separate effective areas and extract image feature parameters of the region in a complex background. As the number of samples for network training is limited, there are still some errors of model forecasting. We can improve the accuracy of forecasting by increasing the number of samples in the future experiments. The trial lays a foundation for online tests.

## ACKNOWLEDGEMENTS

Funding for this research was provided by Tianjin Agricultural University (P. R. China).

## REFERENCES

1. Kunjie C., Changying J.: Research on Techniques for Automated Beef Steak Grading, Trans actions of the Chinese Society for Agricultural Machinery, vol.37(3),pp.153-56(2006).

2. Fazheng R., The Judgement of the Beef Texture as Marble Applying for the MATLAB Image Treatment Technology, Meat Research, vol.4:pp.14--15(2002).

3. Kunjie C., Determination of the Box-counting Fractal Dimension and Information Fractal Dimension of Beef Marbling, Transactions of the CASE, vol.23(7),pp.145--149(2007).

4. Kunjie C., Changying J.: Operation Based on Image Segmentation of Beef Marbling, Transactions of the Chinese Society for Agricultural Machinery, vol.38(5),pp.195--197(2007).

5. Hu A.: Study on the Automatic Grading for Beef Marbling Based on Computer Vision & Artificial Neural Network& Image Processing, Sichuan Agricultural University PH.D.Dissertation(2009)

6. JieWen Z:Segment of Longissimus Dorsi and Marbling in Ribeye Imaging Based on Mathematical Transactions of the CASE, vol.20(1),pp.144--146(2004).

7. MuHua L., Determination of Beef Marbling Grade by Image Processing and SVM Classification, Journal of Shenyang Agricultural University, vol.36(6),pp.650--654(2005).