{'fraction_non_alphanumeric': 0.01955870668052075, 'fraction_numerical': 0.012957643175844998, 'mean_word_length': 4.775503000352983, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
An automated length measurement system for tilapia fish based on image processing technique

In aquaculture industry, measurement of fish length plays an important role in monitoring and determining fish growth, gender, age and reproduction. Currently, fish rearing industries are using measuring wooden board or acrylic plastic with the scale attached to the board itself. However, this method is causing a stress on the fish when measuring their length alive. Furthermore, manual measurement of fish length one by one using measurement board is time-consuming. Hence, this research presents an automated system that is able to measure fish length specifically tilapia fish by using image processing technique and Graphical User Interface (GUI). This automated GUI system is developed for end user and it is able to measure the length of tilapia automatically and accurately. The system is designed by using image processing tool, which consists of image segmentation and feature extraction to get the fish-shaped region. Based on the results, the GUI system is able to measure automatically and accurately the fish length based on the fish image. This developed system resulting with a 8.50% mean relative error and 91.50% accuracy of the tilapia fish length measurement for a 20 cm distance between the digital camera and the tilapia fish. These results show that the proposed system is capable to produce faster results and yield accurate length measurement of the tilapia fish. Thus, with this automated system, it is potentially assisting in fish reproduction and growth for aquaculture industry especially for tilapia industry.


Introduction
Fish length data plays an important role in determining age, growth parameters and mortality rates for fish population [1,2]. Studies of fisheries and aquaculture usually involve numerous of fish length measurements [3,4]. Furthermore, by measuring the fish length, it could potentially useful to monitor the stage of fish development, determine the feeding amount and decision making on the grading, sorting or harvesting of fisheries industries [2]. Currently, fish rearing industries are still using measuring wooden board or acrylic plastic with the scale attached to the board itself [1]. With the traditional method, the inconsistencies and inaccuracies of the length measurement do occur as a result of human bias factor such as the expertise, eyes and direction of the observer. Moreover, the traditional technique which is using wooden measuring board not only cause stress and physical damage to the fish, but it IOP Publishing doi: 10.1088/1757-899X/1088/1/012049 2 also tedious, costly and not always accurate [5]. In addition, the main limitation for fisheries industries is to measure the fish length alive in water [6].
Thus, there are several researchers who had implemented and applied had the computer vision of automatic image processing to measure fish length [5,[7][8][9]. A prototype has been developed to measure a rainbow trout's length by using image processing allowing the fish to swim through a channel and detected by a system that used a digital image to calculate the fish length [5]. They took the advantage of this research to measure its body length as the behavior of the rainbow trout swims against the flow of water. However, the system needs to be improved so that the fish orientation and position when passing across the water channel can be controlled.
Another previous study had presented a method for calculating distance and actual size from the digital image of an object [10]. A system based on model recognition and stereoscopic vision WAS also developed underwater for size assessment of fish [11]. The model recognition-based system is used to detect the object and determine the size and distance of the object from stereo video input. By using this method, the size of sea-cage salmon can be measured non-invasively. However, the use of stereo vision system in fish rearing is quite expensive, although the matching process still has an error and low image quality which can affect the accuracy of the size measurement.
Another study had developed a system to measure a fish size using machine vision as the machine vision is economic, non-destructive, rapid and efficient tool [8,9]. However, most well-developed methods are costly and quite complex. With the rapid development of technology, researchers have been exploring the conceivable ways to deal with enhance productivity and profitability of fish rearing industry. In Malaysia, tilapia fish is one of the major contributions for aquatic resources [12]. Thus, this project aims to develop a simple, low-cost automated system that is able to measure the length of the tilapia fish accurately by using the image processing technique. This will potentially open a new venture and significantly help to increase the productivity and fish growth.

System Overview
The automated system for the fish length measurement is a combination of image processing technique and graphical user interface (GUI). Figure 1 shows the overall system design where the input of the fish in digital image is captured by the camera. The fish is placed in a transparent fish container and picture of the fish is taken from the side of the container using a camera. The fish container is placed inside a custom-made black box. The box is layered with a black background for collecting the data of image and have a dimension of 30cmx35cmx35cm. The digital image will then be uploaded to the MATLAB software for the image processing analysis. Then, the GUI will display the measurement of the fish length. Figure 1. The schematic diagram of the overall automated fish length measurement system. Figure 2 depicts the flowchart of the whole system. Firstly, the system will be initialized and the image of the tilapia fish is captured into a digital image. The digital image will be processed using the IOP Publishing doi:10.1088/1757-899X/1088/1/012049 3 image processing algorithm. If the input of the fish image contains noise or inappropriate position of the fish, the system needs to capture another new fish image. The image processing technique used in this research consists of image pre-processing, image segmentation and feature extraction. After that, the logical operation algorithm will calculate the fish length based on the logical operation technique. Then, the length of the fish will be displayed on the GUI.

Data collection
Tilapia fish had a demand in fish hatcheries and aquaculture activities for human daily source of protein [12]. The location of the data set is taken at Aquatech Bio Resources, Nibong Tebal, Pulau Pinang. A total of 25 images from five different fishes were collected using a single 12 Mega-Pixel camera at 2 different distance which are 20 cm and 25 cm. The dimensions of the digital images are 4032x3024 pixels and the focal length is 4mm. The format of the digital image to be used in this research study is in JPEG file format. Two fixed distance between camera and the fish container are 20cm and 25cm were considered during the process of data collection.

Image processing technique 2.3.1 Image pre-processing
Image pre-processing is an early stage for image processing system [13,14]. Image pre-processing used to prepare the sample data or image and introduce it to an algorithm for a specific task. In this research project, image pre-processing used to open a dialog box that lists files in the current folder. A '.jpeg' file specification was used in order to get the input data image to the system. Figure 3 shows an original input data of the fish image to be uploaded and processed by the system algorithm. After selected the input digital image, the next technique used is an image multiplier. The original RGB image is multiply by 1.25 in order to get a better and clear output of image of the tilapia fish. This will enhance the image quality for a better output result of the measurement. Figure 4 shows the original image is processed by image multiply in the image processing algorithm.

Image segmentation
The process of image segmentation involves partitioning and separating an image from their background [15]. The first technique used in the image segmentation technique is RGB to grayscale conversion. This method is the most used method in image processing algorithm before extract the output digital image. Figure 5 depicts the RGB image processed into grayscale image technique by using rgb2gray in the image processing algorithm.  In this research study, threshold value is set to 0.25 and the thresholding technique are done by using Otsu's threshold method [16,17].

Feature extraction
Feature extraction is an approach for object recognition for an image [18,19]. In this project scope, feature extraction refers to a process that detect the fish shape only. Morphological operation that performed in the algorithm is filling the image region and holes in order to fill the small region in binary image.  Figure 7 shows the fish-shaped region is selected using the morphological operations. After using structuring element, morphological opening image is an erosion followed by a dilation process on a binary image. Morphological structuring element is an essential part of morphological dilating and erosion operations. All of the morphological operation is performed in order to get the region of the fish shaped.

MATLAB Graphical User Interface (GUI)
MATLAB graphical user interface (GUI) is an application that designed for user to be used as user interface for the end user. Within the research study scope, the GUI is created for end user to upload the image of the tilapia fish and automatically calculated the tilapia fish length. Figure 8 shows the GUI designed for this system. The axes plane in the guide is used to display the tilapia fish image that are uploaded by the system algorithm. Then, two buttons are used to browse the sample of data of tilapia fish image and to automatically measure the tilapia fish length. The static text is used to constantly display the fish length in centimeter unit in the guide algorithm. The edit text in the GUI is used to display the output length of the tilapia fish system measurement in centimeter unit. After measured the first sample of tilapia fish, the guide system can be uploading the next sample of tilapia fish image into the system algorithm for automatically measuring the length of tilapia fish.
where is the minimum pixel value of the fish region in the binary image and is the maximum pixel value of the fish-shaped region in the binary image. is the total difference between and .
= * 0.024 (2) where is the total length measured by algorithm that converted the pixel value to real length in centimeter. The constant value of 0.024 is calibrated in order to get the high accuracy of the output measurement of the tilapia fish length. The output of the fish length measurement unit is set to cm unit.

Performance of the measurement analysis
For both equations, is the system measured fish length, is manual measured fish length and is the number of estimated fish length. Then, the absolute error is computed by the calculating the difference between system measured length and the manual measured length. Besides that, the relative error evaluation is computed by the difference between system measured length and the manual measured length divided by the manual measured length. The result of the relative error will present the error percentage of the length measurement system. Finally, the accuracy of the length measurement system is obtained by the difference from one hundred percent and the relative error of the system measurement.

Results
There are total of 25 images of the tilapia fish from 5 different fish that are captured for this experiment for each of the distances of 20 cm and 25 cm between camera and the fish. The results will be compared based on MAE and MRE calculations on which distance that produced more accurate results. Figure 9 shows the final GUI of this automated system. The system starts by selecting the fish image from the library and uploaded to the system. After selecting an image, the user will click on the measure button in order to get the fish length measurement. The length measurement will be displayed in centimeter unit as depicted in Figure 9.  From this study, the fish length measurements are taken using this automated system and compared with the manual measurement. The results are also compared between 20 cm and 25 cm distances from the container and camera in order to select what is the most accurate distance for the fish length measurement. All data of manual measured length, system measured length, MAE, MRE and accuracy of the length measurement system that retrieve from 50 samples of image with two different distances (20 cm and 25 cm) were recorded and tabulated in Table 1 and Table 2. Table 2. System length error analysis for 25cm distance between manual measured length, system length and accuracy of the length measurement system.

Discussion
In this research, a GUI is created for end user to measure the length of the tilapia fish automatically as shown in Figure 7. The result of the tilapia fish length measurement is displayed on the GUI. As depicted in the On the other hand, Table 2 shows the summary of the length measurement system analysis of 25cm distance between the digital camera and the tilapia fish container. The performance analysis of MAE and MRE are calculated and analyzed respectively with 1.36cm and 10.40%. The accuracy of the length measurement system achieved 89.49% for the 25cm distance between the digital camera and the tilapia fish container. These results show that, the accuracy of the length measurement system does influence by the distance between the digital camera and the tilapia fish container. From this experimental research study result, it can be concluded that the longer the distance between the digital camera and the tilapia fish container the lower the accuracy of the measurement. This might be due to that the output of the digital image of the tilapia fish is not clear and slightly smaller as compared to the image at 20cm distance [20].
There are several factors that should be considered during the data collection section which are the background of the tilapia fish image, the noise of lighting from the surroundings light, the position of the tilapia fish that placed in the fish container and the level transparency of the tilapia fish container. For the background of the tilapia fish image, black layered of the custom-made box is considered during the data collection session. This is because the tilapia fish is in white color condition and the background of the image must be contrast to the tilapia fish in order to process the tilapia fish shaped recognition in the image processing algorithm. In addition, the noise of lighting is another factor that will influence the noise during the tilapia fish shaped recognition processed in the image processing algorithm processed.
Furthermore, it is important to control the tilapia fish orientation and position when capturing the sample data images of the tilapia fish. The tilapia fish need to be calmed when the data collection session is running during this experimental research study. Hence, with all the factors are taken into consideration, this automated length measurement system is able to measure the tilapia fish length precisely.

Conclusion
In this research, an automated system with an image processing technique is developed to measure the fish length accurately. The results obtained are 91.50% and 89.49% accuracy for 20cm and 25cm distance respectively between camera and the fish container. These results depict that 20cm distance produced higher accurate result as compared to 25cm distance. Thus, this automated fish length measurement system is able to measure the fish length accurately and potentially help in fish growth and reproduction especially for tilapia industry. Furthermore, this system would help to reduce the cost of labors and save more time as compared to traditional method. Future work could be improved where a digital camera can be upgraded into a real time video camera in order to do a fully automated system to measure the length of the tilapia fish.