A Machine Vision Development Framework For Product
A Machine Vision Development Framework For Product
sciences
Article
A Machine Vision Development Framework for Product
Appearance Quality Inspection
Qiuyu Zhu * , Yunxiao Zhang , Jianbing Luan and Liheng Hu
Abstract: Machine vision systems are an important part of modern intelligent manufacturing systems,
but due to their complexity, current vision systems are often customized and inefficiently developed.
Generic closed-source machine vision development software is often poorly targeted. To meet the
extensive needs of product appearance quality inspection in industrial production and to improve the
development efficiency and reliability of such systems, this paper designs and implements a general
machine vision software framework. This framework is easy to adapt to different hardware devices
for secondary development, reducing the workload in generic functional modules and program
architecture design, which allows developers to focus on the design and implementation of image-
processing algorithms. Based on the MVP software design principles, the framework abstracts and
implements the modules common to machine vision-based product appearance quality inspection
systems, such as user management, inspection configuration, task management, image acquisition,
database configuration, GUI, multi-threaded architecture, IO communication, etc. Using this frame-
work and adding the secondary development of image-processing algorithms, we successfully apply
the framework to the quality inspection of the surface defects of bolts.
of developing free software for the quantification of staining intensity [6]. Ruggieri et al.
proposed a machine learning-based framework called VULMA [7]. VULMA obtained
good results on the vulnerability analysis of buildings using photographs. Schindelin et al.
implemented Fiji [8], an open-source software platform focused on bio-image analysis as
an effective collaboration platform between computer science and biological research. The
above platform systems are application-specific, whereas general-purpose machine vision
platform systems for product appearance quality inspections are still relatively rare.
At present, HALCON, VisionPro, and NI Vision are the commonly used commercial
vision development software [9]. HALCON is a mature standard machine vision algorithm
package developed by MVtec. VisionPro is machine vision software from Cognex that
provides rapid application development capabilities for drag-and-drop operations. NI
Vision was designed by the NI Corporation for engineers and scientists developing machine
vision and scientific imaging applications. In addition to the high commercial costs, their
high versatility also means that surface detection is not targeted enough. Some requirements
of the appearance quality inspection of industrial products, such as task configuration, a
database, multi-thread architecture, etc., need to be implemented separately. We hope to
achieve a new balance between universality and pertinence in surface defect detection.
A framework is a kind of semi-finished software with specific functions. Based
on the functionality and architecture provided by the framework, developers need to
develop their own software for specific business logic and requirements. Frameworks
can reduce a lot of basic code-writing work, which increases the efficiency and speed of
development. Vision software frameworks have been proposed by researchers in some
areas, but software frameworks for product appearance quality inspections in industrial
automation applications are still relatively lacking.
Wotawa et al. proposed a framework for the automatic generation of system tests based
on vision and image recognition and demonstrated an industrial imaging application based
on this framework [10]. However, the framework still lacks interaction with automated
devices and is far from ready for industrial automation applications. Mönck et al. presented
an open source framework for animal tracking that provides programmers with the core
features essential for tracking software [11], such as video IO, graphics overlays, and mouse
and keyboard interfaces, allowing researchers to accelerate their research. Rodríguez et al.
proposed a real-time computer vision software framework that supports multi-threading
and GUIs [12]. Heuss et al. introduced a skill-based software framework that allows for
the flexible configuration of industrial robot functions [13], reducing the effort and time
required to develop industrial robot applications.
Based on the MVP design principle, we applied the modularity concept to develop
the visual product appearance quality inspection software framework. After the modular
design, the visual inspection software is abstracted into several general modules. The
framework supports embedded algorithms and other special modules. We think that
researchers should focus on the design of schemes and quality detection algorithms in the
development of practical project applications.
In practical applications, after embedding several image-processing detection algo-
rithms, as well as deep learning detection networks, we successfully apply the framework
to bolt quality inspection and part condition recognition. Our main contributions can be
summarized as follows:
(1) According to the idea of modularization and decoupling, a reusable general appear-
ance quality inspection software framework is designed and implemented based
on MVP.
(2) According to the requirements of appearance quality inspections, the inspection task
configuration and database function are designed and implemented.
(3) According to the requirements of real-time detection, a multi-threaded inspection
software system architecture is designed and implemented.
(4) The software framework is successfully applied to the surface defect quality inspection
of bolts and part condition recognition.
Appl. Sci. 2022, 12, 11565 3 of 25
visual light
sources
industrial
cameras
sirens
The performance of the computer can be adjusted according to the task requirements.
The computer is connected to automated machinery via IO communication devices. The
alarm can be configured according to the task demands, whose alarm signal can be given
by the computer or the automation equipment.
The industrial camera is the information acquisition device of the machine vision
quality inspection software. Its imaging results directly affect the design of algorithms
during image processing. Most industrial cameras are based on CCD [16] or CMOS [17,18]
chips. Specific scenarios usually require the selection of the appropriate camera vendor,
type, and parameters according to the inspection needs of the target product.
Visual light sources are used to highlight the subject, weaken the background, enhance
features, and make the camera obtain a higher-quality image. It is necessary to choose the
proper machine vision light source solution in the design of the scheme [19,20], such as a
flat light source, hemispherical light source, ring light source, multiple light sources, etc.
IO communication devices are usually used for communication between the vision
software host computer and electromechanical devices. Common communication meth-
ods use serial ports or network interfaces [21,22]. With the continuous development of
technology, more and more protocol technologies have appeared in the field of industrial
communication [23]. Considering simplicity and adequacy, serial ports and Modbus proto-
cols are widely used for communication in industrial applications [24]. The IO modules
within the software framework support the standard Modbus protocol by default.
MVP is Model-View-Presenter, and Figure 3 shows the relationships within the MVP
model. In MVP, the View and Model are not allowed to interact directly, whereas the
Presenter must be used as a bridge and has permission to access both the Model and the
View. When the View responds to an operation of the user, the corresponding interface of
the Model is accessed through the Presenter, and when the data results need to be fed back
to the user, the updates on the View are also made through the Presenter. Compared with
MVC, MVP further reduces the coupling of code between the View and the data model.
Controller
Model View
Figure 2. MVC.
Presenter
(Controller)
Model View
Figure 3. MVP.
DetectType Process
Algorithm
Launcher View Interface DetectType Regulation
SingleBaseDatabase
DataBase
Login Register Interface
View View Log
Camera
DomainController SoftTriggerCamera
Interface
Main
User Attribute
View UserCache
Interface User Authority
The View subsystem is mainly used to accept users’ input and display the processing
results. The framework completes the relevant interaction logic within the corresponding
functions triggered by the View functional component after receiving operations such
as selection, input, and click. Configuration information and detection data need to be
obtained by calling the corresponding interface through the Controller subsystem.
The Controller subsystem is mainly used for the control between the View subsystem
and the Model subsystem, making the View subsystem call the camera, detection algorithm,
etc., and the Model subsystem obtains the results and the data is displayed on the View in
a unified and orderly management implementation. After the instruction is issued by the
View subsystem, the instruction goes through the Controller to execute the corresponding
data model functions. The main class “DomainController” in the Controller subsystem con-
tains the upper layer interfaces of all modules. When modifying the UI layout, developers
need to access “DomainController” to execute the corresponding function after the view
component receives the click, selection, input, etc. In addition, the singleton pattern [27]
is followed in the implementation of the Controller. The Controller keeps its own unique
instance, which strictly controls when and how “clients” access it, reducing code coupling
and improving maintainability.
The Model subsystem mainly provides the machine vision algorithm module, database
control module, camera module, and communication module. Specifically, the algorithm
module can be embedded with suitable algorithms according to actual needs. The database
control module is mainly responsible for data storage and reading. The underlying driver
for the camera module needs to be implemented by selecting the corresponding vendor’s
SDK. IO communication protocols can be changed to UART, S7, and other protocols by
modifying the corresponding underlying code as needed, whereas the default protocol is
Modbus. The upper-layer code does not need to be changed.
Table 1 lists the main modules of the View subsystem and the Model subsystem and
their functions, which are discussed in the third subsection.
and unsuitable for pipeline scenarios with high requirements for inspection efficiency.
Therefore, the design of the software framework includes a thread-pooling technique for
concurrent task processing.
A thread pool is a form of concurrent multitasking [28]. A thread pool contains several
work sub-threads and a task queue. The work sub-threads will take out tasks for processing
in a pre-emptive manner. The main advantage of a thread pool is the higher efficiency
of the system in multitasking scenarios and the decreased coupling of the code with the
separation of threads and tasks.
As shown in Figure 5, the main thread, which is the thread started by the main
function, is only responsible for the basic work of the GUI display, image acquisition,
and IO communication. The specific image-processing task is delivered to a worker sub-
thread of the thread pool for processing and the result is returned to the main thread when
finished. The thread pool is constructed by initializing a number of work sub-threads equal
to mMaxThreadNum and preparing a task queue. By default, mMaxThreadNum = 8. In
practical application scenarios, it can be reset to a suitable number according to the demand
and performance of the computer.
Thread
Pool
Main
Thread Add an image
processing task
UI display
Image capture
IO communication free Busy work threads
...
mMaxThreadNum
The logic implemented by default within each view class includes a GUI display,
jumping between multiple views and actions (selection, input, click, and other operations
to call the camera or database). The operation commands and corresponding functions
need to be reconnected within the view class when modifying the view. Simply, the “main”
function in the main thread instantiates the view class and the software is ready for normal
operation. The task-processing thread pool is constructed automatically when the detection
algorithm module is loaded.
each module, which reduces code coupling, improves readability, and reduces the difficulty
of secondary development.
This section introduces the interfaces of each module and the parts that need to
be replaced by the developer in the secondary development. According to the builder
pattern [27], a class with the name “base” is usually declared in each module, and the
core interface is declared inside the class using pure virtual functions. In secondary
development, the implementation of the core interface is ensured despite the complex
changes and business logic faced by the newly created object. The decoupling of the code
between the interface and the implementation improves the maintainability of the code.
task_info *_results
model_name
PK id:int(16) PK id
PK id:int(8)
PK task_number:varchar(24) PK task_id:int(16)
name:varchar(16)
model_id:int(8) test_result:int(8)
task_create_time:datetime test_time:datetime
task_quantity:int(16) user_id:varchar(24)
user_info
task_already_finish_quantity:int(16) image:varchar(200)
PK id:int(32)
task_already_finish_ok_quantity:int(16) Check1:int(8)
PK user_id:varchar(24)
task_already_finish_ng_quantity:int(16) Check2:int(8)
user_passward:varchar(24)
Check3:int(8)
user_true_name:varchar(24)
Check4:int(8)
user_production_line:varchar(24)
Check5:int(8)
user_authority:varchar(24)
Check6:int(8)
The inspection configuration mainly creates a new detection data model uniquely
determined by the “model_id”. The model contains a series of configurations, as de-
scribed in Section 3.6. The inspection configuration class consists of five tables: the
inspection configuration name table(model_name), the local marker coordinates table
for storing the detection location(model_block), the marker frame-associated camera in-
dex table(camera_to_model_block_indx), the camera index-associated marker frame ta-
Appl. Sci. 2022, 12, 11565 8 of 25
x1:int(16) param1:int(10)
y1:int(16) param2:int(10)
x2:int(16) Check2:int(10)
y2:int(16) Check3:int(10)
param3:int(10)
model_block_to_camera_indx model_camera_to_block_indx
param4:int(10)
PK model_id:int(16) PK model_id:int(16)
Check4:int(10)
PK block_idx:int(16) PK camera_idx:int(8)
param5:int(10)
camera_idx:int(8) block_idx:int(32)
Check5:int(10)
param6:int(10)
param7:int(10)
Check6:int(10)
Task management is mainly to associate the detection model with the number of users
and products (the number of detections) and determine a task uniquely identified by the
“task_id”, as described in Section 3.6. The task management class mainly consists of a user
information table, a task information table, and a task–user association information table.
The internal relationships are shown in Figure 8.
task_info task_and_user_info
PK id:int(16) PK id:int(16)
PK task_number:varchar(24) task_number:varchar(24)
model_id:int(8) user_id:varchar(24)
task_create_time:datetime task_quantity:int(16)
task_quantity:int(16) already_finish_quantity:int(16)
task_already_finish_quantity:int(16) no_finish_quantity:int(16)
task_already_finish_ok_quantity:int(16) already_finish_ok_quantity:int(16)
task_already_finish_ng_quantity:int(16) already_finish_ng_quantity:int(16)
user_info
PK id:int(32)
PK user_id:varchar(24)
user_passward:varchar(24)
user_true_name:varchar(24)
user_production_line:varchar(24)
user_authority:varchar(24)
Appearance quality
inspection software
User management
System
Inspection administrator
configuration
Task management
Image algorithm
Super Technical staff
administrator
Log management
Product
Inspection
Common staff
As shown in Figure 13, the wavelet transform was used for the thread part of the
damage detection. The results of the wavelet transform were used to detect the bright
spots to determine whether they were damaged or not. The Haar wavelet was used to
decompose the image and the column wavelet transform showed the contour information of
the thread, which had little value for detection, so the column transform wavelet transform
was discarded. As seen in Figure 14, the effect of the superposition of the three-level
wavelet row transform and three-level wavelet diagonal transform showed that the wavelet
response in the defective part was obvious. After binarization, the maximum white area
was found. If the area was greater than a given threshold, it was considered thread damage.
As shown in Figure 15, low-pass filtering was used for the thread portion of the dirty
thread detection. A sliding window was used to calculate the relative grayscale mean of
the low-pass filtering results to determine if they were dirty. The image was subjected to a
column DCT transformation and the high-frequency part was filtered out (N = 1000, 0–32
was retained). As shown in Figure 16, it is clear that the gray value of the left dirty part
is lower than the gray value of its neighborhood. A sliding window of 40 × 40 was used
to check the gray value in the window. When the difference from the average value was
below the threshold, dirt was detected.
As shown in Figures 17 and 18, the two types of defects, bolt head damage and defects
in the sphere, had various forms. So, a deep-learning model was used to detect whether the
bolt was defective or not. “Defects in the sphere” refers to scratches, dirt, or poor plating
on the spherical surface of the ring below the threads. “Bolt head damage” refers to the
presence of scratches, dirt, or poor plating on the six planes or six ribs below the sphere.
The thread length was measured by the change in the average gray level of the rows.
The thread pitch was measured by cropping the thread boundary and projecting it onto
the line. To calculate the thread pitch, the boundary area of the thread should be trimmed
and its gray value should be projected onto the edge line. After the DCT transformation
(N = 1000) was performed on the projection results, the principal frequency was obtained
and the pixel pitch of the threads was determined. In addition, because the low-frequency
signal was large but the frequency corresponding to the thread pitch could not be so low,
the low-frequency component of the projection sequence was filtered out by the first-order
difference before the DCT transformation. Figure 19 shows the region of interest at the
thread edge. As can be seen in Figure 20, the main frequency is at k = 34, then the pixel
spacing is 2000/34 = 58.8.
As shown in Figure 21, the bore gap used the connectivity of the region to detect
whether the circle at the bottom of the bore was connected to the bore wall by a gap.
Normally, the grain of the inner hexagon should not be connected to the outside. We took
out the outer ring image and used corrosion and expansion for morphological processing.
Finally, the flooding algorithm checked whether the inner and outer rings were connected.
As seen in Figure 22, the absence of letters in the bore was also detected by the YOLOv4
neural network. For the setting of the YOLOv4 training parameters, the input image was
resized to 128 × 128, the optimizer used was Adam, the learning rate was set to 0.001, and
the epoch was set to 300. The dataset included 285 side images and 272 inner-hole images
and was completed by LabelImg annotation. The data enhancement methods included
brightness adjustment (brightness adjustment to 80–150% of the original image), Gaussian
noise addition (Gaussian factor 0 3.0), scaling (80–105% of the original image), and rotation
(−10 to 10 degrees around the image center). The training set and test set were divided
by 9:1. Figure 23 and Figure 24 show the partial test results of the inner hole and the side,
Appl. Sci. 2022, 12, 11565 15 of 25
respectively. Table 2 shows the results for the test set. In addition, to ensure that the letters
in the input image remained basically horizontal, the letter image in the inner hole was
rotated by Radon transform after edge extraction before input. The letter orientation was
kept positive by the difference in the width of the letter contour between the upper and
lower lines.
As shown in Figure 25, the inner hole was determined to be soiled by averaging
the gray level of the area outside the letter. For another type of soiling with a small and
scattered percentage, the soiling was determined by detecting the number of small contours
after a morphological top-hat operation for the area other than the letters.
In the inspection task, nine detection subtasks for the four camera images were exe-
cuted concurrently through the thread pool. In this scenario, the detection time for each
bolt must not exceed 1000 ms. We chose an i7-9700 computer with 4G RAM for the project,
which can have good real-time performance and guarantee accuracy. Table 3 gives the
times for the side-camera and bore-hole camera tasks, which were both less than 1000 ms.
Because the input picture of a neural network has low resolution, the GPU was not used.
In fact, we tried to use the GPU, but since the data copying between the video memory and
the RAM was small but frequent, the computing speed barely improved.
Test Camera Test 1 (s) Test 2 (s) Test 3 (s) Average Time (s) Result
side camera 0.459 0.431 0.422 0.437 Qualified
bore camera 0.741 0.783 0.796 0.773 Qualified
The detection accuracy mainly depends on the detection algorithm. Better algorithms
embedded in the framework can achieve higher accuracy. The accuracy results obtained by
our algorithm for 100 images of each defect detection type are shown in Table 4. The system
is stable, and there will be no need to restart the industrial computer under normal working
conditions because of software problems. The software can work continuously for 24 h and
the number of failures is no more than one per week. The GUI of bolt quality inspection
was partially modified according to the actual requirements, as shown in Figure 26.
Appl. Sci. 2022, 12, 11565 17 of 25
Precision Recall
thread bruises 0.940 0.980
dirty thread 0.961 0.980
defects in the sphere 0.980 1.000
bolt-head damage 0.943 1.000
bore gap 0.846 0.880
missing letters 1.000 1.000
dirty bore 0.904 0.940
In the application, the PLC and the host computer used the Modbus protocol to complete
the communication and the PLC sent the photo signal after the camera was in place. After the
photo was taken, the signal at the end of the photo was returned and the robot arm started
to move to the next position. At the same time, the image was loaded into the task queue.
Part state determination was performed concurrently through the thread pool. After the 12
positions were photographed, the PLC only needed to wait for the processing time of a single
picture and the status of all parts was given. Obviously, this application is much simpler
than bolt detection, but the GUI, communication, camera, database module, and thread pool
are still needed. Instead of repeating the development according to the business logic, our
framework only needed to add the rotation of the image and deployment of Resnet18.
Specifically, we cut out the parts of the two contact positions of the part, as shown
in Figure 32–35 (the lower side is flipped to make it consistent). Each part was judged
twice. We used ResNet18 to complete the judgment after OpenCV rotated and cropped
the image and adjusted the size to 64*64. For ResNet18 training, the optimizer used Adam,
the learning rate was set to 2e-5, and the data enhancement modes were brightness offset,
contrast offset, hue offset (random maximum offset was set to 0.5), and Gaussian blur
(kernel size was 11, sigma was 0.1–3.0). The number of iterations was set to 120.
Appl. Sci. 2022, 12, 11565 19 of 25
We collected and marked 2072 left-facing part pictures, 2072 right-facing part pictures,
1368 missing part pictures, and 456 wrong part pictures. We divided the training set and
test set by 8:2. The accuracy of the test set reached 99.982%. The single reasoning cost
of the model was 0.07364 s on a computer with an i5-10400 CPU and 16GB RAM. Each
part needed to be cut and reasoned twice, taking less than 200 ms in total. Based on the
model in this paper, the network model trained by libtorch was deployed, which reduced
the business logic development task of appearance quality inspection and provided great
convenience for the industrial vision system to quickly complete the part state judgment.
In future research work, the GUI interactivity can be improved and enhanced and
different basic view types can be preprogrammed for different task requirements. As a
general-purpose machine vision-based inspection software framework, preconfiguring more
communication protocols and basic image-processing algorithms for secondary developers
is an important optimization aspect. Further decoupling the code and providing a library of
functions for secondary developers to use will be the focus of our future research.
Author Contributions: Conceptualization, Q.Z, Z.Y., and L.J.; methodology, Q.Z.; software, Q.Z., Y.Z.,
J.L., and H.L.; validation, Q.Z., Y.Z., and L.H.; formal analysis, Q.Z.; investigation, Z.Q.; resources,
Q.Z.; data curation, Q.Z.; writing—original draft preparation, Q.Z. and Y.Z.; writing—review and
editing, Q.Z.; visualization, Q.Z.; supervision, Q.Z.; project administration, Q.Z.; funding acquisition,
Q.Z. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Data Availability Statement: No new data were created or analyzed in this study. Data sharing is
not applicable to this article. However, the code presented in this study is available on request from
the corresponding author.
Acknowledgments: Not applicable.
Conflicts of Interest: The authors declare no conflicts of interest.
Sample Availability: Samples of the code are available from the authors.
Abbreviations
The following abbreviations are used in this manuscript:
Appendix A
Function Description
void insertSingleRowData (const char *table,
Insert a row of data into the specified table.
std::vector<std::string> &data);
void insertSingleRowData (const char *table,
Delete all data in the specified table.
std::vector<std::string> &data);
void deleteAndReplaceNewData (const char *table, Delete all data in the specified table and re-write the data as a
std::vector<std::vector<std::string>> &data); replacement.
void deleteAndReplaceSatisfiedNewData (const char *table,
std::vector<std::vector<std::string>> &data, const char Delete the eligible data in the specified table and re-write the
*factorColName, std::string &factorColValue, bool data as a replacement.
isNeedQuotationMarks = false);
void deleteAndReplaceSatisfiedNewData (const char *table,
Delete the eligible data in the specified table and re-write the
std::vector<std::vector<std::string>> &data, onst char
data as a replacement.
*factorColName, int &factorColValue);
std::vector<std::vector<std::string>> queryAllData (const Retrieve the first “colNum” column data of all data in the
char * table, const int colNum); specified table.
void createTargetTable (const char *tableName, Create a table, with the table name and column names
std::vector<std::string> &colName); determined by the parameters.
void deleteTabel (const char *table); Delete the specified table.
bool findTargetTable (const char *table); Query whether the specified table exists in the current database.
int findColNumsFromTargetTable (const char *table); Query the number of columns of data in the specified table.
int findRowNumsFromTargetTable (const char *table); Query the number of rows of data in the specified table.
std::vector<std::vector<std::string>> queryAllData (const
char * table, const int colNum, onst char *factorColName, Query the data in the specified table and return the data that
std::string factorColValue, const char *orderColNum = “id”, match the conditions.
bool isNeedQuotationMarks = false);
std::vector<std::vector<std::string>> queryAllData (const Query the data in the specified table and return the data that
char * table, const int colNum, const char *orderColNum); match the conditions.
Function Description
The relevant initialization necessary for specific
bool init ();
protocols.
bool close (); End operations necessary for specific protocols.
void writeUnitToClient (unsigned int Client,
Send single communication unit data.
unsigned int addr, transmissionUnit value);
void writeContinueUnitToClient(unsigned int
Client, unsigned int addr, int length, Send “length” unit data continuously.
transmissionUnit* value);
void readFromClient (unsigned int Client,
Receive “length” units data starting from
unsigned int addr, int length,
“addr” of the lower computer.
transmissionUnit* data);
void readWithWrite (unsigned int Client, int
Send “length” unit data continuously, and
writeAddr, int writeLength, transmissionUnit*
receive “readLength” unit data from the lower
wtiteData, int readAddr, int readLength,
computer starting from “readAddr”.
transmissionUnit* readData);
Appl. Sci. 2022, 12, 11565 22 of 25
Function Description
void setCameraGrabFinishSignal (int Send camera capture completion signal to the
mCameraIndex); lower computer.
bool close (); End operations necessary for specific protocols.
void setCameraResultSignal(int Send the processing result of the picture to the
mCameraIndex, int mResult); lower computer.
Read the trigger signal sent by the lower
bool getCameraTriggerSignal();
computer.
Table A4. Functions within the SingleSoftTrigglerCamera class that need to be re-implemented using
the camera SDK.
Function Description
bool getSingleImage (cv::Mat &
Take a single picture.
singleMat);
cv::Size getCameraSize (); Return camera image size.
bool init (); Required initialization operations for the camera.
bool close (); Required camera shutdown operations.
bool PrintDeviceInfo (); Print camera-related information.
Convert the image storage supported by the SDK to the
bool Convert2Mat (cv::Mat & srcImg);
OpenCV library cv::Mat form and return.
int RGB2BGR (unsigned char*
pRgbData, unsigned int nWidth, Converting RGB images to BGR images.
unsigned int nHeight);
Function Description
Get the number of cameras currently connected to the
int getCameraNums (void);
system.
cv::Size getCameraSize (int
Get the captured image size of the specified camera.
cameraIdx);
bool getSingleImage (int cameraIdx,
Command the specified camera to take pictures.
cv::Mat &singleMat);
Function Description
Preprocessing or algorithm testing
void Check1TestSettingPreprocess1 (cv::Mat &src);
required in the detection
int Check1TestSettingPreProcess2 (cv::Mat &src); configuration.
Function Description
model_id id x1 y1 x2 y2
0 5 753 1232 1347 1750
0 4 688 1019 1436 1262
0 3 843 162 1291 1055
0 2 750 1239 1339 1740
0 1 679 1017 1443 1265
0 0 841 158 1287 1065
id Name
0 boltTest
References
1. Zhang, X.; Zhang, J.; Ma, M.; Chen, Z.; Yue, S.; He, T.; Xu, X. A high precision quality inspection system for steel bars based on
machine vision. Sensors 2018, 18, 2732. https://doi.org/10.3390/s18082732.
2. Vogel-Heuser, B.; Diedrich, C.; Fay, A.; Jeschke, S.; Kowalewski, S.; Wollschlaeger, M.; et al. Challenges for software engineering
in automation. J. Softw. Eng. Appl. 2014, 7, 440–451. https://doi.org/10.4236/jsea.2014.75041.
3. Răileanu, S.; Borangiu, T.; Anton, F.; Anton, S. Open source machine vision platform for manufacturing and robotics. IFAC-
PapersOnLine 2021, 54, 522–527. https://doi.org/10.1016/j.ifacol.2021.08.060.
4. Akcay, S.; Ameln, D.; Vaidya, A.; Lakshmanan, B.; Ahuja, N.; Genc, U. Anomalib: A Deep Learning Library for Anomaly
Detection. arXiv 2022, arXiv:2202.08341.
5. Dawkins, M.; Sherrill, L.; Fieldhouse, K.; Hoogs, A.; Richards, B.; Zhang, D.; Prasad, L.; Williams, K.; Lauffenburger,
N.; Wang, G. An open-source platform for underwater image and video analytics. In Proceedings of the 2017 IEEE
Winter Conference on Applications of Computer Vision (WACV), Santa Rosa, CA, USA, 24–31 March 2017; pp. 898–906.
https://doi.org/10.1109/WACV.2017.105.
6. Prasad, K.; Prabhu, G.K. Image analysis tools for evaluation of microscopic views of immunohistochemically stained specimen in
medical research–a review. J. Med. Syst. 2012, 36, 2621–2631. https://doi.org/10.1007/s10916-011-9737-7.
7. Ruggieri, S.; Cardellicchio, A.; Leggieri, V.; Uva, G. Machine-learning based vulnerability analysis of existing buildings. Autom.
Constr. 2021, 132, 103936. https://doi.org/10.1016/j.autcon.2021.103936.
8. Schindelin, J.; Arganda-Carreras, I.; Frise, E.; Kaynig, V.; Longair, M.; Pietzsch, T.; Preibisch, S.; Rueden, C.; Saalfeld,
S.; Schmid, B.; et al. Fiji: an open-source platform for biological-image analysis. Nat. Methods 2012, 9, 676–682.
https://doi.org/10.1038/nmeth.2019.
9. Wang, T.; Luo, F. Positioning control system based on computer vision. In Proceedings of the 2016 2nd Interna-
tional Conference on Control, Automation and Robotics (ICCAR), Hong Kong, China, 28–30 April 2016; pp. 108–111.
https://doi.org/10.1109/ICCAR.2016.7486708.
10. Wotawa, F.; Klampfl, L.; Jahaj, L. A framework for the automation of testing computer vision systems. In Proceedings of the
2021 IEEE/ACM International Conference on Automation of Software Test (AST), Madrid, Spain, 20–21 May 2021; pp. 121–124.
https://doi.org/10.1109/AST52587.2021.00023.
11. Mönck, H.J.; Jörg, A.; von Falkenhausen, T.; Tanke, J.; Wild, B.; Dormagen, D.; Piotrowski, J.; Winklmayr, C.; Bierbach, D.;
Landgraf, T. BioTracker: an open-source computer vision framework for visual animal tracking. arXiv 2018, arXiv:1803.07985.
12. Rodríguez, A.L.; López-de Teruel, P.E.; Ruiz, A.; García-Mateos, G.; Fernandez-Maimo, L. QVision, a Development Framework
for Real-time Computer Vision and Image Processing Research. In Proceedings of the IPCV, Las Vegas, NV, USA, 14–17 July 2008;
pp. 408–414.
13. Heuss, L.; Gonnermann, C.; Reinhart, G. An extendable framework for intelligent and easily configurable skills-based industrial
robot applications. Int. J. Adv. Manuf. Technol. 2022, 120, 6269–6285. https://doi.org/10.1007/s00170-022-09071-w.
14. Malamas, E.N.; Petrakis, E.G.; Zervakis, M.; Petit, L.; Legat, J.D. A survey on industrial vision systems, applications and tools.
Image Vis. Comput. 2003, 21, 171–188. https://doi.org/10.1016/S0262-8856(02)00152-X.
15. Banús, N.; Boada, I.; Xiberta, P.; Toldrà, P. Design and deployment of a generic software for managing industrial vision systems.
IEEE Trans. Autom. Sci. Eng. 2022, 19, 2171–2186. https://doi.org/10.1109/TASE.2021.3078787.
16. Zhang, B.; Huang, W.; Gong, L.; Li, J.; Zhao, C.; Liu, C.; Huang, D. Computer vision detection of defective apples using automatic
lightness correction and weighted RVM classifier. J. Food Eng. 2015, 146, 143–151. https://doi.org/10.1016/j.jfoodeng.2014.08.024.
17. Lee, S.H.; Yang, C.S. A real time object recognition and counting system for smart industrial camera sensor. IEEE Sens. J. 2017,
17, 2516–2523. https://doi.org/10.1109/JSEN.2017.2671457.
Appl. Sci. 2022, 12, 11565 25 of 25
18. Su, C.; Hu, J.l.; Hua, D.; Cui, P.y.; Ji, G.y. Micro Image Surface Defect Detection Technology Based on Machine Vision Big Data
Analysis. In Proceedings of the International Conference on Advanced Hybrid Information Processing, Binzhou, China, 26–27
September 2020; Springer: Cham, Switzerland, 2021; pp. 433–441. https://doi.org/10.1007/978-3-030-67874-6_40.
19. Song, L.; Li, X.; Yang, Y.; Zhu, X.; Guo, Q.; Yang, H. Detection of micro-defects on metal screw surfaces based on deep
convolutional neural networks. Sensors 2018, 18, 3709. https://doi.org/10.3390/s18113709.
20. Block, S.B.; da Silva, R.D.; Dorini, L.B.; Minetto, R. Inspection of imprint defects in stamped metal surfaces using deep learning
and tracking. IEEE Trans. Ind. Electron. 2020, 68, 4498–4507. https://doi.org/10.1109/TIE.2020.2984453.
21. Cao, L.G.; Xiang, M.; Feng, H.; Wang, Y.Y. Size-sorting and measurement system of safety belt pin based on machine vision. Appl.
Mech. Mater. 2015, 741, 709–713. https://doi.org/10.4028/www.scientific.net/AMM.741.709.
22. Tahir, M.; Latiff, I.; Gul, M.; Alam, M.; Mazliham, M. An evaluation of ethernet based signal exchange among several machines in
automation industry. In Proceedings of the 2017 International Conference on Engineering Technology and Technopreneurship
(ICE2T), Kuala Lumpur, Malaysia, 18–20 September 2017; pp. 1–4. https://doi.org/10.1109/ICE2T.2017.8215948.
23. Wollschlaeger, M.; Sauter, T.; Jasperneite, J. The future of industrial communication: Automation networks in the era of the
internet of things and industry 4.0. IEEE Ind. Electron. Mag. 2017, 11, 17–27. https://doi.org/10.1109/MIE.2017.2649104.
24. Shu, F.; Lu, H.; Ding, Y. Novel modbus adaptation method for IoT gateway. In Proceedings of the 2019 IEEE 3rd Information
Technology, Networking, Electronic and Automation Control Conference (ITNEC), Chengdu, China, 15–17 March 2019; pp.
632–637. https://doi.org/10.1109/ITNEC.2019.8729209.
25. Li, D.D.; Liu, X.Y. Research on MVP design pattern modeling based on MDA. Procedia Comput. Sci. 2020, 166, 51–56.
https://doi.org/10.1016/j.procs.2020.02.012.
26. Moutaouakkil, A.; Mbarki, S. MVC Frameworks Modernization Approach. Int. J. Adv. Comput. Sci. Appl. 2019, 10.
https://doi.org/10.14569/IJACSA.2019.0101043.
27. Gamma, E.; Helm, R.; Johnson, R.; Johnson, R.E.; Vlissides, J.; Booch, G. Design Patterns: Elements of Reusable Object-Oriented
Software; Addison-Wesley: Boston, USA, 1995.
28. Williams, A. C++ Concurrency in Action; Simon and Schuster: New York, NY, USA, 2019.
29. Eng, L.Z. Qt5 C++ GUI Programming Cookbook; Packt Publishing Ltd.: Birmingham, UK, 2016.
30. Bharath, S.; Khusi, C.; Ritu, R.; Maity, S.; Kumar, M.M. IoT Based Sorting Machine Using MQTT Protocol and MySQL. In
Proceedings of the 2021 International Conference on Artificial Intelligence and Machine Vision (AIMV), Gandhinagar, India,
24–26 September 2021; pp. 1–6. https://doi.org/10.1109/AIMV53313.2021.9670950.
31. Taylor, J.T.; Taylor, W.T. Design Theory for Embedded Programming. In Patterns in the Machine; Springer: Berkeley, CA, USA,
2021; pp. 25–42. https://doi.org/10.1007/978-1-4842-6440-9_3.