Keywords

1 Introduction

Image is defined as the visual description of the objects in nature. According to Qidwai and Chen [1], digital image is the state of digitized and extracted version of images from three dimensions into two dimensions. Digital image is a function such an \( \alpha (x,y) \) that has two variables. These variables are the position of coordinates and the value of this function represents the intensity or brightness. The scientific definition of digital image is that the image is extracted by using the analog image of \( \alpha (x,y) \) from two-dimensional continuous space into two-dimensional discrete space as a result of sampling process defined as digitization [1].

In digital images, most widely used term in order to denote the element of an image is pixel. Beside this definition, pixel is identified as the intersection point of row and columns. All techniques related to image processing is applied to pixels. Furthermore, the operations in image processing are performed based on operators such as arithmetic operator, convolution operator, and gradient operator used by many methods in image processing.

Image processing is an operation which alters the nature of images in the manner to improve visual interpretation and to transform images into a suitable state that could be perceived by autonomous machine by using computers [2]. Gonzalez and Woods examined processes performed in image processing into three different categories [3]:

Low-level Process. This process includes primitive operations (noise reduction, contrast enhancement, etc.). Input and output are identified as images.

Mid-level Process. Input is characterized by an image, however; output is attributes of the image such as edges. Image segmentation could be given as an example for this type of processes.

High-level Process. This level contains higher operations and beside the mid-level it gives meaning to the images. Text recognition and detection of counterfeit money are among the application of high-level process.

2 Corrugated Boards in Industrial Packaging

The raw material of the corrugated board is the recycled paper. There are many different types, sizes, and shapes of corrugated boards. The corrugated board provides high-level environment-friendly packaging. Products which are fragile, hard, soft, solid, and liquid could easily be packed and protected thanks to the board. Corrugated board is produced from two sheet combination and glued to a corrugated inner medium. The shape of corrugated board is shown in Fig. 1.

Fig. 1
figure 1

Corrugated board [4]

There are many benefits of the corrugated board packaging [4]:

  • Sustainable. Completely recyclable and 100 % natural.

  • Cheapness. It could be produced by recycled paper.

  • Safe and Hygienic. Due to having disposable characteristics and certified by Good Manufacturing Practice.

  • Superior Protection. Resistant to impact, vibration, dropping, and shock.

  • High-technology and Innovation. Adaptable to technological developments (RFID) and innovations (Cooler corrugating).

  • Informative and Promotional. Strong marketing tool for companies in order to increase the value in the market.

  • Ideal Logistic Partner. Packaging is fundamental component and guarantee maximum stocking and space use.

3 The Methods Used for Counting of Corrugated Board Algorithm

In corrugated boards counting algorithm, different methods related to image processing are utilized. The algorithm is developed in MATLAB software. The general and detailed flow of the original algorithm are shown in Figs. 2 and 3, respectively.

Fig. 2
figure 2

General flow of the algorithm

Fig. 3
figure 3

Detailed flow of the original algorithm

The methods will be explained one by one in order to show the advantages of usage in this algorithm.

Adaptive Histogram Equation. All histogram equation methods are based on color value distribution and aim to adjust contrast. Distinctively, adaptive histogram performs this type of adjustment locally which means to remove the low contrasts, brightness, and saturations in the local part of the image. Philip states that this method produces effective results to homogenize color density [5]. As a result, image defects caused by perspective could be eliminated.

Sobel Filter. This filter is basically used in order to find the edges in the image and based on derivative approach. MATLAB offers a function called fspecial for the Sobel filter by utilizing from h matrix. The matrix used to find the horizontal edges is shown in Fig. 4. Moreover, Sanduja and Patial [6] stated that this filter removes spurious noises and makes the edge smoother. Besides, Shrivakshan and Chandrasekar [7] explained that Sobel filter provides more simplicity than the other filters using the approach of the Gaussian. Therefore, the method is faster and gives effective results.

Fig. 4
figure 4

Sobel horizontal edge (h) matrix [10]

Erosion. This method performs the morphological process based on a structural element for gray-colored images. In addition to many different shaped and sized of structural elements (line, square, disk, etc.) offered by MATLAB, it could be formed by an operator. Therefore, operators could use structural elements arbitrarily and do not obliged to use available ones.

The working principal of this method is based on the rule of the mask of the pixels which are defined by structural element matrix. The method assigns the value of the minimum element inside the mask window as a value of centered pixel in the mask area. Example is shown in the Fig. 5. Structural element of this process is defined as 3-3 square matrix.

Fig. 5
figure 5

Erosion (Martin et al. [11])

Dilation. Dilation is the one of the process that is executed basic morphological process for grayscaled images. Dilation process is materialized based on the identified one structural element like erosion. The working logic is the reverse of the erosion. Therefore, determined structural element matrix is carried to the whole image by taking every pixel as a center. In contrast to erosion, the maximum value of the element is assigned as pixel value. The example is shown in the Fig. 6 regarding dilation process which is performed by using 3-3 square matrix.

Fig. 6
figure 6

Dilation (Martin et al. [11])

Chitra and Balakrishnan [8] stated that dilation and erosion methods are used to smooth the boundary of the objects and do not change the area of them. In addition, these methods are consecutive and firstly applied erosion followed by dilation in the opening operation. The erosion method is firstly applied for our algorithm due to the opening operation structure.

Median Filter. Median filter is used in order to remove the image noise. This filter could be used to preprocess for other subsequent process. The filter is applied by means of mask matrix. The image is scanned by this identified matrix. In each window, the values of pixel are ordered from the minimum to maximum value. As a result of alignment, the value in the middle is assigned as the value of the centered pixel. It is widely used method in image processing in order to remove noise without causing damage to the edges. The example is shown in Fig. 7 regarding to this filter. In this example, the central element is altered from 97 to 4 which will be in the middle when the numbers are ordered.

Fig. 7
figure 7

Median filter application

Graythresh. This threshold is used to obtain black-white images from gray images. According to this method, pixel values which is above the examined threshold level is colored white, conversely it is colored black when the pixel value is below the level. By means of this method, the image is transformed from grayscale into BW images.

Threshold level is determined by two methods:

  • Operator observation: In this method, the operator observes the different results by trying different threshold values that is defined arbitrarily. According to the observations, the optimal threshold level is determined.

  • MATLAB Function (Graythresh): To find the best threshold level of the gray images, a MATLAB function called graythresh is used. This function utilizes from Otsu method in order to find the optimal threshold level. Briefly, the method assumes that image consists of two color categories as back and front hand. The variance value is calculated for both two classes. The value which minimizes the variance value is given as an optimal threshold level (Wang [9]).

Classification of the Black-White Color. To classify black-white colors, MATLAB offers a function called bwboundaries. The function is used in order to determine objects, hollowed structure substances (called parent) and spongy structure substances (called child). These types of objects are shown in Fig. 8. The important point is that the function is only available for BW-scaled images.

Fig. 8
figure 8

Classification of BW color [12]

4 The Original Algorithm Developed for Corrugated Board

The methods used in this algorithm are explained in Sect. 3. In Sect. 4, it will be pointed out specific issues which make the algorithm original.

This algorithm is developed by using 15 different images of finished corrugated boards produced by Azim Packaging. The reason why these images are selected is to demonstrate the verification and the robustness of the algorithm. The images have different characteristics including quality (abnormal sinus curves, etc.) and size (such as bigger or smaller sinus curves). All images of 15 selected products are shown in Appendix-1. The results of our algorithm related to these images are shown in Table 1.

Table 1 Results

In this section, the algorithm is performed step by step on only one image which is selected from 15 images and the results of each step is given at the end of relevant step.

The original image and its magnified part of the image are shown in Figs. 9 and 10, respectively.

Fig. 9
figure 9

Original image

Fig. 10
figure 10

Magnified part of the original image

Step (1) Adaptive Histogram Equation: After RGB-colored original image is loaded into MATLAB, it is firstly converted into grayscale. Then adaptive histogram method is applied in order to remove background noise caused by the perspective. The former and the latter images are shown in Figs. 11 and 12, respectively.

Fig. 11
figure 11

Before adaptive histogram

Fig. 12
figure 12

After adaptive histogram

Compared with Figs. 11 and 12, it is noticed the perspective noise placed in the middle is removed in the latter image. In addition, the color of the image becomes more homogeneous than the former one.

Step (2) Sobel Filter: This filter is applied in order to emphasize horizontal lines. Filtering image is shown in Fig. 13. In addition, the difference between the former and the latter images is shown in Fig. 14a, b, respectively. This step also supports the next step by making the horizontal edges more visible.

Fig. 13
figure 13

After sobel filter

Fig. 14
figure 14

a Before sobel and b after sobel

Step (3) Erosion: This step is the most important step for the success of the algorithm. The point is to remove the sinusoidal curves between the lines by using structural element.

Definition of Structural Element: As stated in Sect. 3, the structural element is generally defined as either available MATLAB elements or completely by user. In our algorithm, after analyzing the image in detail we define our structural element instead of using available MATLAB elements.

According to analyses of the images, the width of the sinus curves located between two lines changes mostly in the range of 2–5 white pixels. Therefore, structural element is formed as matrix in 1 × 6 sized. To clarify the idea, as mentioned in Sect. 3, the smallest value inside the frame is assigned to the center element. Hence, this matrix makes the erosion of the white pixels in the sinus curves substantially guaranteed. Furthermore, the values of the matrix elements do not affect this process. For this reason, the value of 1 (one) is given arbitrarily to all elements of the matrix.

Key Point of This Step. Thanks to removing sinus curves, the next steps could be performed easily. The latter and the former images are shown in Fig. 15a, b, respectively.

Fig. 15
figure 15

a Before erosion and b after erosion

Step (4) Dilation: This step is complementary of the erosion method. In the previous step, when removing the sinus curves, horizontal lines are affected negatively. Therefore, it brings out discontinuity in some points. In order to recover, dilation method is applied. The latter and the former images are shown in Fig. 16a, b.

Fig. 16
figure 16

a Before dilation and b after dilation

Compared with Fig. 16a, b, it is remarked that the lines are more continuous in the latter one.

Step (5) Median Filter: As stated in Sect. 3, this filter is used as preprocessor to the subsequent process to remove the image noises. Specifically, for this image the noises around the horizontal lines make the lines wider and less distinctive. This filter is also applied after analyzing the characteristics of the image. The analysis shows that the thickness of the horizontal edge is almost 4 pixels. The related figure is shown in Fig. 17. In this figure, the difference between two y positions gives value 4. Therefore, the mask matrix of the median filter is selected as [4 4] sized.

Fig. 17
figure 17

Magnified former image

The before and after median filter is applied, the images are shown in the Fig. 18a, b, respectively.

Fig. 18
figure 18

a Before median and b after median

After median filter is applied, the horizontal lines become more clear as shown in Fig. 17b.

Step (6) Transforming into BW Scale: After median filter, the image is converted into binary image in order to carry out the counting process. The working principle of this method is mentioned in Sect. 3. Then, the vertical cross section is taken from the middle area of the image due to the quality issues (smoothness, continuity of lines, etc.) compared to the other areas of the image.

Note Determination of cross section width is a critical issue. The reason why this width is important will be explained in the next step.

Step (7) Counting Process: After segmentation, the last step of the algorithm is to find the number of corrugated boards. In order to count, bwboundries function defined in MATLAB is utilized. The working principle is mentioned in Sect. 3. Briefly, this function traces the interior and exterior boundaries of the objects and detects them. The essential point is that the image must be binary where nonzero pixels show the objects while zero pixels show the background. In our algorithm, bwboundries function takes the binary image as an argument and finds the number of the objects. The output of this function is assigned to a variable. The length of the variable gives the count of the corrugated board. The related figure is shown in Fig. 19.

Fig. 19
figure 19

Counting of corrugated board

5 Results

In this algorithm, seven steps are carried out in order to find the number of corrugated boards. These steps are applied to 15 images selected from real production area of Azim Packaging Company. The results are shown in Table 1. In this table, actual number of corrugated boards, the found number by our algorithm, and average processing time for each figure are given.

As shown in Table 1, the algorithm could find the true count for the images between photo nos. 1–9 accurately. The algorithm converges into the true number with 1 difference for the images between photo nos. 10–14. The algorithm converges into the true number with 2 differences for the photo no. 15.

The algorithm could accurately find the true number at the rate of 60 % and the remaining images have some defects caused by alignment and the quality of the photographs. Therefore, with 1 difference could be accepted in the range of success. As a result, the success rate is 94 %.

In this section, the important key performance indicators (KPI) are:

  • The independency to the initial data. In this algorithm, despite selected images show different characteristics, the results are satisfactory and show the flexibility of the algorithm developed. As a result, our algorithm is not dependent on initial data.

  • The processing time. Processing time is measured by using MATLAB commands. Table 1 shows the average processing time. The average value is found in a way that each figure is run 10 times so each value includes the average of 10 running time value. In addition, the values change between the range of 13 and 17 s. As a result, average processing time could be accepted as nearly 15 s.

  • The accuracy of results. The success rate is given in this section as 94 %.

Finally, our image processing algorithm is successful in counting of corrugated boards.

6 Conclusions

In this study, the application of corrugated board counting is performed by using a new image processing algorithm. After applying the algorithm with real products, the results are satisfactory and reasonable.

Our paper is the first study about this subject because no other scientific study analyzed this problem.

The algorithm offers fast and efficient solution to counting problem of corrugated boards and not dependent on initial data.

As a further research of this study, video processing can be tried to compare the results for industrial applications. QFD—Quality Function Deployment—technique can be used to match the technical specifications and customer needs for a counting machine. In addition, this counting algorithm should be integrated with production machines and ERP systems. The total counting time of algorithm may be improved if the time of production line is faster than counting time of the algorithm.

The method can be applied to other industrial problems such as sheet and paper counting.