# Marine-Hydraulic-Oil-Particle Contaminant Identification Study Based on OpenCV

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Oil Particle Image Detection Platform

#### 2.2. Image Morphology Processing

#### 2.2.1. Grayscale and Binarization

#### 2.2.2. Opening/Closing

#### 2.3. Oil Particle Contour Extraction

#### 2.3.1. Canny Edge Detection and Contour Extraction

_{x}and S

_{y}are horizontal direction and vertical direction of the Sobel operator.

_{p1}and G

_{p2}are the gradient intensity of the corresponding sub-pixel point in the gradient direction of the pixel point. If the gradient intensity of the pixel is bigger than G

_{p1}and G

_{p2}, it is determined as a possible edge point.

#### 2.3.2. Area, Perimeter and Result Analysis

_{L}and K

_{A}is perimeter and area of the oil particle, W

_{L}, W

_{A}is perimeter and area of the actual oil particles.

#### 2.4. Oil Particle Shape Detection Based on Image Moment

#### 2.4.1. Obtain the Centroid through the First-Order Image Moment

#### 2.4.2. Polygon Fitting

#### 2.4.3. Shape Detection

_{x}and I

_{y}is the ordinate and abscissa of the pixel point.

- (1).
- The waveform of the circle is a straight line, but because there is no perfect circle in nature, it is often presented in the form of an ellipse. The waveform of the ellipse has a certain degree of periodicity and appears in the form of a sine wave (as shown in Figure 13a). The flattening degree of the ellipse is proportional to the fluctuation amplitude of the sine wave (as shown in Figure 13b).
- (2).
- The waveform of the polygon (excluding circle and ellipse) has many non-derivable points, and the number of non-derivable points is equal to the number of corners.
- (3).
- The angle corresponding to the corner of the polygon is inversely proportional to the sharpness of the non-guided points (this means the D-value between the left derivative and the right derivative of the non-differentiable point value.)
- (4).
- The waveform of the symmetric graph shows a high degree of symmetry and even periodicity.

#### 2.4.4. Extracting Characteristic Parameters by Difference Operation

## 3. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Wang, S.; Zhang, Y.; Zhang, B.; Fei, Y.; He, Y.; Li, P.; Xu, M. On the Sparse Gradient Denoising Optimization of Neural Network Models for Rolling Bearing Fault Diagnosis Illustrated by a Ship Propulsion System. J. Mar. Sci. Eng.
**2022**, 10, 1376. [Google Scholar] [CrossRef] - Shu, P.; Sun, T.; Yu, Q.; Li, G.; Yu, W.; Shi, Z. Numerical investigation of the effect of axial clearance on the last stage of marine turbine. Ocean. Eng.
**2022**, 266, 112711. [Google Scholar] [CrossRef] - Li, R.; Wen, C.; Meng, X.; Xie, Y. Measurement of the friction force of sliding friction pairs in low-speed marine diesel engines and comparison with numerical simulation. Appl. Ocean. Res.
**2022**, 121, 103089. [Google Scholar] [CrossRef] - Knežević, V.; Orović, J.; Stazić, L.; Čulin, J. Fault Tree Analysis and Failure Diagnosis of Marine Diesel Engine Turbocharger System. J. Mar. Sci. Eng.
**2020**, 8, 1004. [Google Scholar] [CrossRef] - Zhang, H.; Chon, C.H.; Pan, X.; Li, D. Methods for counting particles in microfluidic applications. Microfluid. Nanofluidics
**2009**, 7, 739–749. [Google Scholar] [CrossRef] - Ma, L.; Shi, H.; Zhang, H.; Li, G.; Shen, Y.; Zeng, N. High-sensitivity distinguishing and detection method for wear debris in oil of marine machinery. Ocean Eng.
**2020**, 215, 107452. [Google Scholar] [CrossRef] - Zhu, X.; Zhong, C.; Zhe, J. Lubricating oil conditioning sensors for online machine health monitoring—A review. Tribol. Int.
**2017**, 109, 473–484. [Google Scholar] [CrossRef] [Green Version] - Jia, R.; Ma, B.; Zheng, C.; Wang, L.; Ba, X.; Du, Q.; Wang, K. Magnetic Properties of Ferromagnetic Particles under Alternating Magnetic Fields: Focus on Particle Detection Sensor Applications. Sensors
**2018**, 18, 4144. [Google Scholar] [CrossRef] [Green Version] - Bai, C.; Zhang, H.; Zeng, L.; Zhao, X.; Ma, L. Inductive Magnetic Nanoparticle Sensor Based on Microfluidic Chip Oil Detection Technology. Micromachines
**2020**, 11, 183. [Google Scholar] [CrossRef] [Green Version] - Islam, T.; Yousuf, M.; Nauman, M. A highly precise cross-capacitive sensor for metal debris detection in insulating oil. Rev. Sci. Instrum.
**2020**, 91, 25005. [Google Scholar] [CrossRef] - Rahman, O.; Islam, T.; Khera, N.; Khan, S.A. A Novel Application of the Cross-Capacitive Sensor in Re-al-Time Condition Monitoring of Transformer Oil. IEEE Trans. Instrum. Meas.
**2021**, 70, 9513212. [Google Scholar] [CrossRef] - Li, Y.; Zhang, P. An online de-noising method for oil ultrasonic wear debris signal: Fuzzy morphology component analysis. Ind. Lubr. Tribol.
**2018**, 70, 1012–1019. [Google Scholar] [CrossRef] - Ding, B.; He, L.-P.; Luo, J.-H.; Peng, B.-L.; Geng, X.-F.; Wang, P.-M. Determination of particle size of heavy oil in water dispersion system by ultrasonic attenuation method. J. Pet. Sci. Eng.
**2016**, 146, 764–769. [Google Scholar] [CrossRef] - Bordatchev, E.; Aghayan, H.; Yang, J. Object shape-based optical sensing methodology and system for condition monitoring of contaminated engine lubricants. Opt. Lasers Eng.
**2014**, 54, 128–138. [Google Scholar] [CrossRef] - Chunjiao, Z. The application and development of photoelectric sensor. In Intelligence Computation and Evolutionary Computation; Springer: Berlin/Heidelberg, Germany, 2013; pp. 671–677. [Google Scholar] [CrossRef]
- Gong, X.L.; Tian, H.X.; Sun, Y.L.; Wu, X.J. Influencing Factors on Measurement Results of Light Exinection Particle Counters. Lubr. Eng.
**2016**, 41, 133–135+148. [Google Scholar] - Liu, Z.; Liu, Y.; Zuo, H.; Wang, H.; Fei, H. A Lubricating Oil Condition Monitoring System Based on Wear Particle Kinematic Analysis in Microfluid for Intelligent Aeroengine. Micromachines
**2021**, 12, 748. [Google Scholar] [CrossRef] - Wang, J.; Bi, J.; Wang, L.; Wang, X. A non-reference evaluation method for edge detection of wear particles in ferrograph images. Mech. Syst. Signal Process.
**2018**, 100, 863–876. [Google Scholar] [CrossRef] - Jia, F.; Yu, F.; Song, L.; Zhang, S.; Sun, H. Intelligent Classification of Wear Particles Based on Deep Convolutional Neural Network. J. Phys. Conf. Ser.
**2020**, 1519, 12012. [Google Scholar] [CrossRef] - Wang, J.; Zhang, L.; Lu, F.; Wang, X. The segmentation of wear particles in ferrograph images based on an improved ant colony algorithm. Wear
**2014**, 311, 123–129. [Google Scholar] [CrossRef] - Wang, S.; Wu, T.; Wang, K.; Sarkodie-Gyan, T. Ferrograph Analysis with Improved Particle Segmen-tation and Classification Methods. J. Comput. Inf. Sci. Eng.
**2020**, 20, 21001. [Google Scholar] [CrossRef] - Palananda, A.; Kimpan, W. Classification of Adulterated Particle Images in Coconut Oil Using Deep Learning Approaches. Appl. Sci.
**2022**, 12, 656. [Google Scholar] [CrossRef] - Oktay, A.B.; Gurses, A. Automatic detection, localization and segmentation of nano-particles with deep learning in microscopy images. Micron
**2019**, 120, 113–119. [Google Scholar] [CrossRef] [PubMed] - Ying, X. An Overview of Overfitting and its Solutions. J. Phys. Conf. Ser.
**2019**, 1168, 22022. [Google Scholar] [CrossRef] - Hawkins, D.M. The problem of overfitting. J. Chem. Inf. Comput. Sci.
**2004**, 44, 1–12. [Google Scholar] [CrossRef] [PubMed] - Zhang, Q.; Yang, L.T.; Chen, Z.; Li, P. A survey on deep learning for big data. Inf. Fusion
**2018**, 42, 146–157. [Google Scholar] [CrossRef] - Kang, Y.D.; Lee, T.K. [Microwave, Antennas and Propagation] An Accurate Closed-form Green’s Function for the Planar Structure with General Sources. Inst. Electron. Eng. Korea Telecommun.
**2004**, 41, 417–424. [Google Scholar] - Sánchez-Larios, H.; Guillén-Burguete, S. Arc length associated with generalized distance functions. J. Math. Anal. Appl.
**2010**, 370, 49–56. [Google Scholar] [CrossRef] [Green Version] - Wang, M.; Sun, C.; Sowmya, A. Efficient corner detection based on corner enhancement filters. Digit. Signal Process.
**2022**, 122, 103364. [Google Scholar] [CrossRef] - Zhang, X.; Ji, X.H. An Improved Harris Corner Detection Algorithm for Noised Images. Adv. Mater. Res.
**2012**, 1566, 433–440. [Google Scholar] [CrossRef] - Zhou, X.; Wang, Y.; Xiao, C.; Zhu, Q.; Lu, X.; Zhang, H.; Ge, J.; Zhao, H. Automated Visual In-spection of Glass Bottle Bottom with Saliency Detection and Template Matching. IEEE Trans. Instrum. Meas.
**2019**, 68, 4253–4267. [Google Scholar] [CrossRef] - Sun, Y.; Mao, X.; Hong, S.; Xu, W.; Gui, G. Template Matching-Based Method for Intelligent Invoice Information Identification. IEEE Access
**2019**, 7, 28392–28401. [Google Scholar] [CrossRef] - Gruber, M.; Hsu, K.-Y. Moment-based image normalization with high noise-tolerance. IEEE Trans. Pattern Anal. Mach. Intell.
**1997**, 19, 136–139. [Google Scholar] [CrossRef]

**Figure 1.**Oil-particle image-detection platform: (

**a**) Small coaxial optical industrial microscope; (

**b**) Objective lens; (

**c**) CCD image sensor; (

**d**) Jetson Nano device.

**Figure 2.**Entire platform: (

**a**) Small coaxial optical industrial microscope; (

**b**) Objective lens; (

**c**) CCD image sensor; (

**d**) Jetson Nano device.

**Figure 3.**Grayscale processing of oil particle image: (

**a**) Original picture of oil particles; (

**b**) Grayscaled image.

**Figure 4.**Binarized image: (

**a**) Origin image; (

**b**) threshold = 90; (

**c**) threshold = 110; (

**d**) threshold = 130.

**Figure 9.**Oil-particle contour-extraction image after using the Canny edge detection algorithm: (

**a**) contours without morphological processing; (

**b**) morphologically processed contours.

**Figure 11.**Contour extraction image corresponding to different epsilon values after polygon fitting: (

**a**) Origin image; (

**b**) epsilon = 0; (

**c**) epsilon = 10; (

**d**) epsilon = 20; (

**e**) epsilon = 30; (

**f**) epsilon = 40.

**Figure 13.**Oil-particle distance-angle waveform: (

**a**) Spherical particles waveform; (

**b**) Flattened spherical particles waveform; (

**c**) Blocky particles waveform; (

**d**) Strip particle waveform.

**Figure 14.**First-order difference diagram of blocky particles and strip particles: (

**a**) Difference diagram of blocky particles; (

**b**) Difference diagram of strip particles.

Num. | Perimeter | Area | Actual Perimeter | Actual Area | Accuracy |
---|---|---|---|---|---|

1 | 1271.69 | 127,347.60 | 1234.43 | 120,931.89 | 95.84% |

2 | 1143.01 | 104,062.00 | 1172.89 | 109,847.60 | 96.09% |

3 | 689.98 | 36,521.59 | 676.00 | 34,237.42 | 95.63% |

4 | 863.31 | 59,155.59 | 901.37 | 63,473.31 | 94.49% |

5 | 610.33 | 30,435.25 | 614.18 | 31,738.44 | 97.63% |

6 | 890.22 | 58,435.97 | 964.18 | 62,685.67 | 92.77% |

7 | 633.52 | 32,279.05 | 613.52 | 30,628.58 | 95.68% |

8 | 826.42 | 54,848.61 | 790.75 | 49,607.21 | 92.46% |

9 | 624.20 | 32,386.46 | 652.71 | 34,573.96 | 94.65% |

10 | 570.47 | 27,420.73 | 552.97 | 26,196.30 | 96.08% |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Wang, C.; Yang, C.; Zhang, H.; Wang, S.; Yang, Z.; Fu, J.; Sun, Y.
Marine-Hydraulic-Oil-Particle Contaminant Identification Study Based on OpenCV. *J. Mar. Sci. Eng.* **2022**, *10*, 1789.
https://doi.org/10.3390/jmse10111789

**AMA Style**

Wang C, Yang C, Zhang H, Wang S, Yang Z, Fu J, Sun Y.
Marine-Hydraulic-Oil-Particle Contaminant Identification Study Based on OpenCV. *Journal of Marine Science and Engineering*. 2022; 10(11):1789.
https://doi.org/10.3390/jmse10111789

**Chicago/Turabian Style**

Wang, Chenyong, Chao Yang, Hongpeng Zhang, Shengzhao Wang, Zhaoxu Yang, Jingguo Fu, and Yuqing Sun.
2022. "Marine-Hydraulic-Oil-Particle Contaminant Identification Study Based on OpenCV" *Journal of Marine Science and Engineering* 10, no. 11: 1789.
https://doi.org/10.3390/jmse10111789