A device interface self-matching method for automatic detection of mobile phones
By matching the serial port and USB interface of the detection device, using the mapping table and the method of crawling camera frame data in parallel, the problem of inconsistency between the serial port number of the detection device and the device number is solved, and no manual operation matching for automated detection is achieved.
Patent Information
- Application Number
- CN202111673510.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-12-31
AI Technical Summary
In second-hand mobile phone transactions, since the serial port of the detection device is inserted into different USB interfaces, the serial port number will change, and the USB camera will be inserted into different USB interfaces will also have the same situation, and the port and device numbers on different PCs will also be inconsistent, resulting in difficulty in automated detection. .
By matching the sub-serial port of the serial bus with the motor sub-equipment, and using the serial port name + motor equipment mapping table in the system program, create 3 threads to capture camera frame data in parallel, find the gradient of the center area, compare the difference before and after, and find The matching relationship between the camera and the motor.
It realizes the rapid matching of the serial port and the USB interface of the detection device, and solves the problem of inconsistent serial port number changes and device number without manual operation.
Smart Images

Figure CN114268688B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of mobile phone detection, in particular to a device interface self-matching method for automatic detection of mobile phones. Background Art
[0002] Appearance defect detection technology in second-hand mobile phone transactions is of great significance for mobile phone commodity valuation and quality assessment. In the field of industrial inspection, the objects to be inspected generally have flat surfaces and small sizes.
[0003] Since the serial port of the detection device is plugged into different USB interfaces, the serial port number will change. The same situation will occur when the USB camera is plugged into different USB interfaces. The port and device numbers on different PCs will also be inconsistent. Summary of the invention
[0004] The purpose of the present invention is to provide a device interface self-matching method for automatic detection of mobile phones, so as to solve the problem proposed in the above background technology that the serial port number of the detection device will change when the serial port is inserted into different USB interfaces, the same situation will occur when the USB camera is inserted into different USB interfaces, and the port and device numbers on different PCs will also be inconsistent.
[0005] To achieve the above object, the present invention provides the following technical solution: a device interface self-matching method for automatic detection of a mobile phone, comprising the following steps:
[0006] S1, matching the sub-serial port of the serial bus with the motor sub-device;
[0007] S2, matching the serial port name + motor device mapping table in the system program of this solution to obtain a mapping table of motor device + serial port number;
[0008] S3, first turn on the top panel light and initialize the 3-way camera;
[0009] S4, then reset the positions of the two depth-of-field adjustment motors to 0;
[0010] S5, create 3 threads to capture frame data of 3 cameras in parallel, capturing one frame for each thread;
[0011] S6, then change the motor 1 to a new position (such as the midpoint of the lead screw), grab one frame each time, calculate the gradient of the central area respectively, and compare the difference before and after;
[0012] S7, re-matching the next round to find the matching relationship between the corresponding camera and the motor.
[0013] Preferably, if there are initialization failures, communication failures, image capture failures, no matches, and other abnormalities during matching, the exception handling mechanism will be triggered and an alarm will be sounded to exit the program.
[0014] Preferably, the matching method in step S1 is to call the Windows device management API to obtain a mapping table between the serial port name and the serial port number based on the characteristic that the sub-serial port name will not change.
[0015] Preferably, if the threshold value is reached in step S6, it indicates that the camera and the motor are matched successfully.
[0016] Compared with the prior art, the beneficial effects of the present invention are: the matching method in the present invention can quickly match the serial port of the detection device with the USB interface, solving the problem that the serial port number will change when the serial port of the detection device is inserted into different USB interfaces, the same situation will occur when the USB camera is inserted into different USB interfaces, and the port and device numbers on different PCs will also be inconsistent, and the whole process does not require manual operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of the self-matching method of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] See also Figure 1 The present invention provides a technical solution: a device interface self-matching method for automatic detection of a mobile phone, comprising the following steps:
[0020] S1, matching the sub-serial port of the serial bus with the motor sub-device;
[0021] S2, matching the serial port name + motor device mapping table in the system program of this solution to obtain a mapping table of motor device + serial port number;
[0022] S3, first turn on the top panel light and initialize the 3-way camera;
[0023] S4, then reset the positions of the two depth-of-field adjustment motors to 0;
[0024] S5, create 3 threads to capture frame data of 3 cameras in parallel, capturing one frame for each thread;
[0025] S6, then change the motor 1 to a new position (such as the midpoint of the lead screw), grab one frame each time, calculate the gradient of the central area respectively, and compare the difference before and after;
[0026] S7, re-matching the next round to find the matching relationship between the corresponding camera and the motor.
[0027] If there are any exceptions during the matching process, such as initialization failure, communication failure, image capture failure, or no match, the exception handling mechanism will be triggered and an alarm will be issued to exit the program.
[0028] The matching method in step S1 is to call the Windows device management API to obtain a mapping table between the serial port name and the serial port number based on the characteristic that the sub-serial port name will not change.
[0029] If the threshold value is reached in step S6, it indicates that the camera and the motor are matched successfully.
[0030] To sum up: the matching method in the present invention can quickly match the serial port of the detection device with the USB interface, solving the problem that the serial port number will change when the serial port of the detection device is inserted into different USB interfaces, the same situation will occur when the USB camera is inserted into different USB interfaces, and the port and device numbers on different PCs will also be inconsistent. The entire process does not require manual operation.
[0031] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A device interface self-matching method for automatic detection of a mobile phone, characterized in that: The steps include: S1, matching the sub-serial port of the serial bus with the motor sub-device; S2, matching with the serial port name + motor device mapping table to obtain a mapping table of motor device + serial port number; S3, first turn on the top panel light and initialize the 3-way camera; S4, then reset the positions of the two depth-of-field adjustment motors to 0; S5, creating three threads to capture frame data of three cameras in parallel, capturing one frame for each camera, namely: the first camera captures image frame_00, the second camera captures image frame_10, and the third camera captures image frame_20; S6, then transform the first motor to the midpoint position of the lead screw, and capture one frame each, namely: the first camera captures the image frame_01, the second camera captures the image frame_11, and the third camera captures the image frame_21; Calculate the gradient of the central area respectively, and compare the difference between the first camera captured image frame_00 and the first camera captured image frame_01, the difference between the second camera captured image frame_10 and the second camera captured image frame_11, and the difference between the third camera captured image frame_20 and the third camera captured image frame_21; If the threshold range is reached, it indicates that the camera and motor are matched successfully; S7, re-matching the next round to find the matching relationship between the corresponding camera and the motor.
2. The device interface self-matching method for automatic detection of mobile phones according to claim 1, characterized in that: If there are any exceptions during the matching process, such as initialization failure, communication failure, image capture failure, and no match, the exception handling mechanism will be triggered and an alarm will be issued to exit the program.
3. The device interface self-matching method for automatic detection of mobile phones according to claim 1, characterized in that: The matching method in step S1 is to call the Windows device management API to obtain a mapping table between the serial port name and the serial port number based on the characteristic that the sub-serial port name will not change.
Citation Information
Patent Citations
Motion recognition method and device of camera module and electronic equipment
CN110740312A
CCD camera clear imaging automatic focusing device and method
CN112162375A