Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Implementation Of Size-Based Recognition On

Automatic Liquid Filling Machine Using Canny-


Edge Detection Method
Muhammad Nabawi Ramadani Nur Rokhman Kurnia Sandi
Department of Electrical Engineering Department of Electrical Engineering Department of Electrical Engineering
UIN Sunan Gunung Djati Bandung UIN Sunan Gunung Djati Bandung UIN Sunan Gunung Djati Bandung
Bandung, Indonesia Bandung, Indonesia Bandung, Indonesia
nabawipnd@gmail.com nurrokhman0302@gmail.com kurkursandi@gmail.com

Ahmad Saepul Milah Lia Kamelia Ibrahim Sulton Habibuloh


Department of Electrical Engineering Department of Electrical Engineering Department of Electrical Engineering
UIN Sunan Gunung Djati Bandung
2023 9th International Conference on Wireless and Telematics (ICWT) | 979-8-3503-0502-9/23/$31.00 ©2023 IEEE | DOI: 10.1109/ICWT58823.2023.10335433

UIN Sunan Gunung Djati Bandung UIN Sunan Gunung Djati Bandung
Bandung, Indonesia Bandung, Indonesia Bandung, Indonesia
ahmadsasefulmilah56@gmail.com @gmail.com boimjeh@gmail.com

Abstract- liquid filling in small industries is often filled Automated filling equipment has become an essential
manually into containers, resulting in the liquid being poured symbol of industrial modernization. The implementation
into the container inaccurately, making it inefficient in cost and proposed by [1] using a Programmable Logic Controller
time. This paper proposes an edge detection method to (PLC), the research develops and implements an automatic
automatically detect objects based on the size of 2 bottles for bottle filling system based on a programmable logic controller
filling machines in soap liquid. The proposed process involves using a DELTA PLC (DVP 14SS), which serves as a field
image processing stages using edge detection and filling machine controller and runs the designed prototype by detecting the
control stages. The results showed that. The use of Dilated and presence of the bottle on a conveyor belt and filling it
Erode Image operations also helps to improve the detection and appropriately up to a predetermined level[2]. Automatic liquid
segmentation of 2 bottle sizes accurately. The detected bottle
filling was the subject of research by Hidayat and Winahyu,
sizes are 10ml and 20ml, with 10ml being 5.4cm high and 2.0cm
wide and 20ml being 7.7cm tall and 3.3cm wide. By examining
who developed a method for creating a small, effective device
the overall performance of the filling machine, this study proves employing a keypad start button, flow sensor, temperature
that edge detection based on object size is a practical and sensor, fan, buzzer, LCD 1602, and relay driver. [3]. But this
essential approach in machine vision. The proposed edge system does not yet use the machine vision method, so filling
detection method has great potential to improve the quality of is only done for 1 type of bottle.
segmentation and object detection in various image processing
With the background of computer vision technology
applications.
developed rapidly in recent times, an automated filling system
Keywords: edge detection method, filling machine object has been designed to solve this problem[4]. In general, the
detection, image processing, segmentation. term "computer vision systems" refers to techniques that
extract desirable features from digital images. The basic goal
I.! INTRODUCTION of these systems is to improve scene comprehension from
input photos. Machine vision refers to the use of vision
The manual refilling of liquids into containers is a systems in manufacturing environments to automate
common practice in small enterprises, particularly for the production operations. [5], [6].
liquid filling sector (such as mineral water, tea, liquid milk,
juice, etc.). The fluid that is put into the containers as a result Abdullah et al. proposed a system that uses a camera to
is erroneous, which can result in losses in terms of money and gauge the liquid level at any time during filling. The camera
time. The continual liquid filling activity in the container will can accurately identify the fluid level using the image process
greatly cut industry earnings and prevent Small and Medium technique (Edge Detection Approach) [7]. One of the crucial
steps in image processing is edge detection. Edge detection's
Enterprises (SMEs) from expanding in the future as the
primary objective is to locate and extract the borders or edges
cumulative losses result become more excellent. Therefore,
between various objects in a picture. [8]. The edges generated
we require a tool that can measure liquid volume accurately, by the edge detection process can be used to identify objects
efficiently, and at a reasonable cost. Device installation and in an image. We can classify objects based on their
operation must be simple and practical for small-scale characteristics by extracting edge features and applying
business owners who are not tech savvy. Since it doesn't need pattern recognition techniques. It is crucial in many
a lot of installation area, the owner's company can set it up applications, such as facial recognition[9], crop vehicle
quickly. recognition [10], satellite image recognition [11], etc.
Before a machine for filling liquids using a One of the most used edge detection techniques in image
microcontroller that could accurately fill liquids was processing is canny edge detection. The technology of Canny
developed, workers had to fill bottles by hand manually. The edge detection can provide exceedingly precise edges. A
automatic filling machine will reduce this loss and labor costs gradient operator that measures the shift in pixel intensity in
and eliminate another problem faced by the industry, different directions is used to achieve it.[12]. Compared to
especially in the liquid soap production industry. other edge detection methods, such as Sobel or Prewitt

"#"$%$&'(&$('()$"*)&*+&,-((!.)()&!/000
Authorized licensed use limited to: Consortium - Algeria (CERIST). Downloaded on March 16,2024 at 11:52:42 UTC from IEEE Xplore. Restrictions apply.
operators, Canny edge detection can produce smoother and properties and properties. Many image processing techniques
clearer edges by reducing the effects of noise and increasing are applied to digital images to extract information from the
edge sharpness. The Canny edge detection method has proven examined image. As shown in Fig. 2, the primary image
effective and widely used in various image processing processing procedure consists of three main steps: Pre-
applications. This technique is commonly used in object processing, image segmentation, and feature extraction [6].
segmentation, pattern recognition, computer vision, and
medical image processing applications because of its high
accuracy and capacity to produce accurate edges. [13].
This research is expected to create an automatic liquid-
filling machine that can recognize the container's shape
accurately and efficiently using Canny-edge feature-based
recognition technology. The results of this research can
significantly contribute to improving the performance of
automatic liquid filling machines and supporting the Fig.2. Image processing procedure.
development of automation technology in the production
industry. The first step in image processing is image capture.
Scientific photo or image processing can be done effectively
II. RESEARCH METHOD using scanned images or data from digital cameras. After pre-
Machine vision, which is concerned with the acquisition processing, the first step of image analysis, image
of visual data and how computers perceive it, is related to the segmentation, is required. Segmentation divides the image
methods in this work. A typical vision system comprises of a into different parts that have the same features or show some
computer, the hardware and software required to connect similarities. Edge detection techniques are used to find
with it, cameras and digital devices, and so forth. Three discontinuities in grayscale images. The proposed work
functions, namely sensing and digitizing image data, image implements the Canny-edge detection method in the
processing and analysis, and controlling and decision-making detection process. The block diagram of the canny-edge
systems, make up the system's design. detection method used in this study is shown in Fig.3.
The relationship between the three functions is illustrated
in the diagram in Fig.1.

Erode Image

Fig. 1. Filling machine system block diagram.

The sensing and digitization functions involve inputting


vision data through a camera focused on the desired scene.
Each frame's digital image matrix is subject to image analysis Fig.3. Canny-edge detection flowchart.
and processing operations for data compression and picture
interpretation. These procedures must be followed in order to Several morphological operations are performed on the
enable the use of real-time vision analysis needed for system image when a real-time RGB or binary image and provided
control and decision-making. as input to a Python program. It is then converted into a
. grayscale or binary image. After conversion, the shape to be
A. Sensing and Digitalizing Image Data recognized is selected from the image, and its corners are
marked with four specific points (box shape). So that we can
By lowering noise, shadows, and reflections, as well as
detect the size of the object shape using the edge detection
increasing picture contrast, good illumination can assist
process.
image processing and analysis be more successful. Front
lighting is mainly used when examining surface quality C. System Controlling and Decision Making
characteristics, such as colour, texture, and skin defects. The block diagram in Fig.4 shows that the webcam
However, backlighting is always used when the quality camera detects the object. The system will detect size-based
characteristics of edges or boundaries, such as size and shape, objects processed by the main component, the Nodemcu
are to be explored. Digitization is converting a visual image microcontroller. The size-based edge detection method is
into a numerical form [14]. analyzed using Python software and OpenCV. The system
B. Image Processing and Analysis has ultrasonic sensor input, water flow sensor, and relay and
servo motor output.
Digital image processing is a fragment of signal
technology that modifies digital images to improve their

Authorized licensed use limited to: Consortium - Algeria (CERIST). Downloaded on March 16,2024 at 11:52:42 UTC from IEEE Xplore. Restrictions apply.
Fig.4. Liquid filling machine system block diagram.

The system program built with OpenCV Python includes The results of the bottle size are used as objects in the
several processes. The first step is real-time image capture hardware system for filling liquid soap. The results of the
using a camera webcam, as shown in Fig.5. The next step is overall implementation of this system are shown in Fig.6.
the image pre-processing stage. The image is selected using This tool uses a webcam for image processing to detect two
the edge detection method. Next goes the size-based object- bottles measuring 10ml and 20ml—Nodemcu as a
matching identification process sent to the NodeMCU microcontroller that controls the servo motor as a conveyor
microcontroller based on serial communication. The output drive. Nodemcu also has a water flow sensor, ultrasonic
of the system processing will send a command for filling soap sensor, and relay for filling in the liquid filling machine
liquid once the system correctly detects the size-based image. system.
A. Edge Detection Implementation And Analysis
The first process run on the liquid filling machine system
for filling soap is image processing. Some stages of image
processing include the actual image, Grayscale Image,
Gaussian Blur Image, Thresholding Image, Canny Image,
Edge Image, Dilated Image, and Fillled Image. Based on their
size, these stages detect bottle images using the Python
programming language. Before entering the image
processing stage, the original image is obtained from the
webcam in real time, shown in Fig.7.

Fig.5. The blueprint of the automatic liquid filling machine system.

III. EXPERIMENTAL RESULTS AND DISCUSSION


The outcomes of processing picture data and image
analysis, which is the input of the study, are displayed using
the software. The image results are in the form of bottle
detection data based on the object's size.

Fig. 7. Original image.

The original image is converted to pre-processing stages


such as Grayscale, Gaussian Blur, and Thresholding.
Grayscale helps to focus on intensity differences, Gaussian
Blur reduces noise and false edges, while Thresholding
converts the image to binary to highlight significant edges.
Combining these three stages provides more accurate edge
detection results and simplifies interpretation in image
analysis. The stages of grayscale, gaussian blur, and
Thresholding are written in Python programming as follows:
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
Fig.6. Automatic liquid filling machine implementation. blurred_image = cv2.GaussianBlur(gray_image, (9, 9), 0)
threshold_value = 127
max_value = 255

Authorized licensed use limited to: Consortium - Algeria (CERIST). Downloaded on March 16,2024 at 11:52:42 UTC from IEEE Xplore. Restrictions apply.
_, thresholded_image = cv2.threshold(blurred_image,
threshold_value, max_value, cv2.THRESH_BINARY) canny_image = cv2.Canny(thresholded_image, 50, 100)
dilated_image = cv2.dilate(canny_image, None,
The original image is converted to Grayscale Image using iterations=1)
cv2.cvtColor() with parameter cv2.COLOR_BGR2GRAY eroded_image = cv2.erode(dilated_image, None,
iterations=1)
resulting in a grayscale image (Fig. 8). Gaussian Blur using
cv2.GaussianBlur(). The second parameter (9, 9) specifies
The cv2.Canny() function is used to detect image edges
the kernel size, which controls the degree of smoothing (Fig.
by applying edge detection sensitivity based on the threshold
9). Thresholding uses cv2.threshold(). The first parameter is
value (Fig. 11). Dilated Image uses cv2.dilate() with the
the image to be threshed (in this case, the Gaussian Blur result
specified kernel to strengthen the edge lines (Fig. 12). The
image), the second parameter is the threshold value used, the
kernel value does not need to be filled in numerically as it is
third parameter is the maximum value to be assigned to pixels
sufficient to write None as it already gets the required result.
that exceed the threshold, and the fourth parameter is the
The erosion method to remove the edge flesh uses cv2.erode()
thresholding method used which is cv2.THRESH_BINARY
with the kernel written None. It helps to obtain a neater and
(Fig. 10).
smoother edge line (Fig. 13).

Fig. 8. Grayscale image.


Fig. 11. Canny image.

Fig. 9. Gaussian blur image.


Fig. 12. Dilated image.

Fig. 10. Thresholding image.


Fig. 13. Erode image.
After performing the pre-processing stages, a series of
steps will go through edge detection, including Canny Image, The calculation used to measure the bottle size uses the
Dilated Image, and Filled Image. The Canny algorithm is Euclidean technique. A mathematical formula calculates the
used to identify significant edges. A dilated image helps to distance between two points in two- or three-dimensional
connect disconnected edges, and Filled Image is used to fill Euclidean space. This formula is known as "straight distance"
the area within the detected edge of the object. Through these or "Euclidean distance". The results of this research show that
combined stages, this research successfully improves the the Canny-edge detection method can detect objects with
quality of edge detection and obtains useful information in high accuracy based on their size in the image shown in Fig.
object recognition and bottle image segmentation. The steps 14.
of Canny Image, Dilated Image, and Filled Image are written
in Python programming as follows:

Authorized licensed use limited to: Consortium - Algeria (CERIST). Downloaded on March 16,2024 at 11:52:42 UTC from IEEE Xplore. Restrictions apply.
The conveyor system is driven by a servo motor with a
rotating direction. This conveyor directs the bottle right in
front of the ultrasonic sensor, which will stop the rotating
rate. At times like this, the bottle detection system will
validate the bottle size between 10ml and 20ml. At the
detection of a 10ml bottle size, relay one automatically turns
on and turns on the water flow calculated by the water flow
sensor according to the size of the bottle, likewise, with the
size of 20ml. Filling each bottle that has been completed
drives the servo motor back to rotate the conveyor. The test
results of this soap-filling system are shown in TABLE II.

5 TABLE II. SOAP FILLING TRIAL RESULTS


Fig. 14. Canny-edge detection result.
Trial 10 Ml Size Filling 20 Ml Size Filling
The method can detect the size of 2 bottles, which are 1 ON ON
20ml and 10ml, based on the width and height values of the
2 OFF ON
bottle. The results of the bottle width and height
measurements are shown in TABLE 1. 3 OFF OFF
4 ON ON
TABLE I. BOTTLE SIZE WIDTH AND HEIGHT
5 OFF ON
Bottle Size Width Height
When both are ON, filling the soap liquid is still in
10 ml 2,0 cm 5,4 cm
progress. In the OFF and ON conditions, one bottle serves,
20 ml 3,3 cm 7,7 cm and the other has finished filling. While in both OFF, both
have finished filling the soap liquid, and the conveyor moves
in a rotating direction. The results of the size detection value
B. System Controlling and Decision-Making are shown in Fig. 16.
Implementation
The implementation of an automatic filling machine
control system for filling liquid has a working system shown
in Fig. 15.

Fig. 15. Automatic liquid filling machine system flowchart. Fig. 16. The result of bottle sizes.

This research focuses on developing an edge detection


method to detect two bottles based on their size in an image. IV. CONCLUSION
In the initial stage, the original image is converted to image In this research, an edge detection method was
analysis using several image pre-processing techniques to successfully developed to detect objects based on the size of 2
facilitate pixel intensity analysis. A good image processing bottles for the filling machine in filling soap liquid. The
technique produces a clear image for detecting two bottle proposed process involves image processing stages using edge
sizes using the edge detection method. detection and filling machine control stages. The image
processing stages include Grayscale, Gaussian Blur,
After getting the bottle size value, the stage of entering Thresholding, Canny Edge Detection, Dilated, and Erode
the value into the Nodemcu parameter to run the filling Images. At the same time, the control stage enters the bottle
machine system. The filling machine has three subsystems: a size value into the Nodemcu parameter to run the filling
conveyor, liquid filling, and bottle detection based on machine system.
distance.

Authorized licensed use limited to: Consortium - Algeria (CERIST). Downloaded on March 16,2024 at 11:52:42 UTC from IEEE Xplore. Restrictions apply.
The results show that when using an appropriate threshold, [6] A. Bhargava and A. Bansal, “Fruits and vegetables quality
the edge detection method can produce clear and well-defined evaluation using computer vision: A review,” J. King Saud Univ. -
Comput. Inf. Sci., 2018, doi: 10.1016/j.jksuci.2018.06.002.
edges on objects of the desired size. The use of Dilated and [7] O. I. Abdullah, W. T. Abbood, and H. K. Hussein, “Development
Erode Image operations also helped to improve the accuracy of Automated Liquid Filling System Based on the Interactive
of detection and segmentation of the two bottle sizes Design Approach,” FME Trans., vol. 48, no. 1, pp. 938–945, 2020,
accurately. The detected bottles are 10ml and 20ml in size. doi: 10.5937/fme2004938A.
The 10 ml bottle has a height of 5.4cm and a width of 2.0 cm. [8] Y. Wu and Q. Li, “The Algorithm of Watershed Color Image
Segmentation Based on Morphological Gradient,” Sensors (Basel).,
The 20 ml bottle has a height of 7.7 cm and a width of 3.3 cm. vol. 22, no. 21, Nov. 2022, doi 10.3390/S22218202.
In testing the overall performance of the filling machine, [9] R. P. Rizki, E. A. Z. Hamidi, L. Kamelia, and R. W. Sururie, “Image
processing technique for smart home security based on the principal
this study proves that edge detection based on object size is a component analysis (PCA) methods,” Proc. - 2020 6th Int. Conf.
practical and essential approach in image processing. The Wirel. Telemat. ICWT 2020, pp. 2–5, 2020, doi:
proposed edge detection method has great potential to 10.1109/ICWT50448.2020.9243667.
improve the quality of object segmentation and recognition in [10] V. Dworak, M. Huebner, and J. Selbeck, “Precise Navigation of
various image processing applications. Small Agricultural Robots in Sensitive Areas with a Smart Plant
Camera,” J. Imaging, vol. 1, pp. 115–133, 2015, doi:
10.3390/jimaging1010115.
REFERENCES [11] R. Bausys, G. Kazakeviciute-Januskeviciene, F. Cavallaro, and A.
Usovaite, “Algorithm Selection for Edge Detection in Satellite
Images by Neutrosophic WASPAS Method,” Sustain. 2020, Vol.
[1] R. Ambare, S. R. Lende, P. R. Arote, O. B. Pokharkar, and G. R.
12, Page 548, vol. 12, no. 2, p. 548, Jan. 2020, doi:
Waykar, “Design And Development Of Automatic Bottle Filling
10.3390/SU12020548.
Machine,” 2019.
[12] N. M. Syahrian, P. Risma, and T. Dewi, “Vision-Based Pipe
[2] M. Liton Ahmed, S. Kundu, and M. Rafiquzzaman, “Automatic
Monitoring Robot for Crack Detection Using Canny Edge
Bottle Filling System Using PLC Based Controller,” J. Adv. Mech.,
Detection Method as an Image Processing Technique,” Kinet. Game
vol. 4, no. 1, 2019.
Technol. Inf. Syst. Comput. Network, Comput. Electron. Control,
[3] R. Hidayat and H. S. Winahyu, “Automatic Liquid Filling Machine
pp. 243–250, Sep. 2017, doi: 10.22219/KINETIK.V2I4.243.
using Flow Sensor and Arduino Pro Mini,” Indones. J. Eng. Res.,
[13] L. Liu, F. Liang, J. Zheng, D. He, and J. Huang, “Ship infrared
vol. 1, no. 1, pp. 27–31, Oct. 2020, doi: 10.11594/IJER.01.01.05.
image edge detection based on an improved adaptive Canny
[4] S. Roy, C. T. Hazera, D. Das, R. M. S. Rahman Pir, and A. S.
algorithm,” Int. J. Distrib. Sens. Networks, vol. 14, no. 3, Mar. 2018,
Ahmed, “A Computer Vision and Artificial Intelligence Based
doi:
Cost-Effective Object Sensing Robot,” Int. J. Intell. Robot. Appl.,
10.1177/1550147718764639/ASSET/IMAGES/LARGE/10.1177_
vol. 3, no. 4, pp. 457–470, Dec. 2019, doi: 10.1007/S41315-019-
1550147718764639-FIG3.JPEG.
00107-1/METRICS.
[14] N. Suresh Kumar, S. Margret Anouncia, and M. Prabu,
[5] Y. Chen, K. Chao, and M. S. Kim, “Machine Vision Technology
“Application of Satellite Remote Sensing to Find Soil Fertilization
for Agricultural Applications,” Comput. Electron. Agric., vol. 36,
by Using Soil Colour,” Int. J. Online Eng., vol. 9, no. 2, pp. 44–49,
pp. 173–191, 2002.
2013, doi: 10.3991/ijoe.v9i2.2530.

Authorized licensed use limited to: Consortium - Algeria (CERIST). Downloaded on March 16,2024 at 11:52:42 UTC from IEEE Xplore. Restrictions apply.

You might also like