USB camera plug test method, system, device and medium
By controlling the power supply and signal lines of a USB camera to simulate plugging and unplugging operations, and overlaying time-related information into the image, and combining this with the power-on time for judgment, the problem of insufficient test accuracy in scenarios where USB cameras are repeatedly plugged and unplugged is solved, achieving higher test accuracy and reliability.
Patent Information
- Application Number
- CN202611539329.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-30
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies lack sufficient accuracy in scenarios involving repeated plugging and unplugging of USB cameras, failing to accurately determine whether the image received by the host is the real-time image acquired after power-on, resulting in inconsistencies between test results and the actual working state of the camera.
By controlling the power supply and signal line status of the USB camera to simulate plugging and unplugging operations, the camera is powered on again, and time-related information is generated and superimposed on the test image. The time of power-on and image type are combined to make judgments, ensuring the real-time performance and consistency of image acquisition.
It improves the accuracy and reliability of USB camera plug-in/plug-out testing, accurately distinguishes between real-time and historical images, and ensures that test results are consistent with actual working conditions.
Smart Images

Figure CN123185346A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication equipment testing technology, and in particular to a USB camera plug-in / plug-out testing method, system, device, and medium. Background Technology
[0002] With the continuous expansion of video imaging services such as video conferencing, security monitoring, and industrial inspection, USB (Universal Serial Bus) cameras, which achieve power supply and data transmission through a universal serial bus interface and provide plug-and-play capabilities in accordance with the USB video device class standard, have become important terminals for acquiring and transmitting video images. In production line aging, fault reproduction, and actual use, USB cameras will repeatedly undergo insertion, removal, and re-enumeration. Whether they can provide the host with a video image corresponding to the current shooting scene after being reconnected directly affects the reliability of the image communication system.
[0003] In the testing of USB peripheral connections, existing technologies have developed some solutions. Application publication number CN104615524A discloses a method for testing the plugging and unplugging of a mobile terminal's USB interface. This method simulates plugging and unplugging by switching the USB connection line on and off using a relay, and judges the general functional status of the mobile terminal's USB interface based on feedback from the test equipment to verify whether the peripheral access and link response are normal. However, this technical solution uses the interface functional status as the basis for judgment. The interface functional status only reflects the connection and communication status of the USB link and has no correlation with whether the image returned by the camera is a real-time image captured after power-on. In scenarios where the USB camera is repeatedly plugged and unplugged, the image frames received by the host may come from historical images retained before power-on or images from the startup phase that have not yet corresponded to the current shooting scene. In this case, the interface functional status still shows as normal, and this solution judges it as normal, causing a deviation between the test judgment result and the actual working state of the camera. Therefore, existing technologies suffer from insufficient testing accuracy in scenarios where USB cameras are repeatedly plugged and unplugged. Summary of the Invention
[0004] To address the aforementioned shortcomings or drawbacks, this invention provides a USB camera plugging and unplugging test method, system, device, and medium, which can improve the test accuracy of USB cameras in scenarios involving repeated plugging and unplugging.
[0005] This invention provides a USB camera plug-in / plug-out testing method, comprising: controlling the on / off state of the power supply line and / or signal line of the USB camera to simulate the plug-in / plug-out operation of the USB camera, powering the USB camera back on, acquiring a test image, reading the current time as the generation time, generating time-sensitivity information based on the generation time and the image type of the test image, superimposing the time-sensitivity information onto the test image, and acquiring a target image obtained by acquiring the test image with superimposed time-sensitivity information after the USB camera is powered back on. Obtain the power-on time and extract the time-of-use information from the target image. Based on the time-of-use information and the power-on time, determine whether the target image is the image acquired after this power-on and matches the test image. If so, the USB camera plug-in / unplug test is considered passed.
[0006] According to a second aspect, this invention provides a USB camera plug-in / plug-out testing system, comprising a main control device and a display screen and a USB camera respectively connected to the main control device, wherein... The main control device is used to control the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera, so that the USB camera is powered on again, acquires the test image, and reads the current time as the generation time. Based on the generation time and the image type of the test image, it generates time-effect identification information, superimposes the time-effect identification information on the test image, and outputs the test image to the display screen. After the USB camera is powered on again, the target image is obtained by acquiring the test image with superimposed time-effect identification information, acquiring the power-on time, and extracting the time-effect identification information from the target image. Based on the time-effect identification information and the power-on time, it is determined whether the target image is the image acquired after this power-on and matches the test image. If so, the USB camera plugging and unplugging test is considered to have passed. The display screen is used to show the test images; The USB camera is used to capture test images on the display screen.
[0007] According to a third aspect, the present invention provides a master control device, comprising: at least one processing unit; and a storage unit communicatively connected to the at least one processing unit. The storage unit stores executable instructions that can be invoked by the at least one processing unit. When the executable instructions are executed by the at least one processing unit, the at least one processing unit causes it to execute any of the USB camera plug-in / plug-out testing methods described in the embodiments of the present invention.
[0008] According to another aspect of the present invention, a medium for storing executable instructions is provided, wherein the computer instructions are used to cause a computer to execute any of the USB camera plug-in / plug-out test methods in the embodiments of the present invention.
[0009] The technical solution of this invention provides a USB camera plug-in / plug-out testing method, which is implemented through six core steps: on / off control, identifier generation, identifier overlay, image acquisition, timing judgment, and result determination. Specifically, controlling the on / off state of the USB camera's power supply and / or signal lines simulates the plug-in / plug-out operation, allowing the USB camera to power on again. This creates a controllable power-on condition for the testing process, providing a clear power-on starting point for subsequent image acquisition. The test image is acquired, and the current time is read as the generation time. Based on the generation time and the image type of the test image, time-related identifier information is generated, binding the time dimension and image content dimension to the same data carrier, providing a verifiable data benchmark for distinguishing real-time images from historical images. The time-related identifier information is overlaid on the test image, ensuring that the test image is transmitted and... The acquisition process carries extractable time and type markers; after the USB camera is powered on again, the target image is obtained by acquiring the test image with superimposed time marker information, thus realizing the acquisition of the actual output image data of the USB camera; the power-on time is obtained, and the time marker information in the target image is extracted. Based on the time marker information and the power-on time, it is determined whether the target image is the image acquired after this power-on and matches the test image. Through the joint verification of the power-on time and the time marker information, the correspondence between the target image and this power-on is established; if so, the USB camera plug-in / unplug test is determined to be passed, and the test decision is completed.
[0010] In the existing technical solutions, the interface functional status is used as the criterion for judgment. The interface functional status only reflects the connection and communication status of the USB link, and has no corresponding relationship with whether the image returned by the USB camera is an image captured in real time after power-on. In scenarios where the USB camera is repeatedly plugged and unplugged, the image frames received by the host may come from historical images retained before power-on or images that have not yet corresponded to the current shooting scene during the startup phase. At this time, the interface functional status still shows normal, which leads to a deviation between the test judgment result and the actual working status of the USB camera, resulting in insufficient test accuracy. This invention generates time-sensitive information carrying the generation time and superimposes it on the test image. After acquisition, the time-sensitive information is extracted from the target image. Combined with the power-on time, it is determined whether the target image is an image captured after power-on and matches the test image. This changes the judgment criterion from the interface functional status to the verification of the timeliness and content consistency of the image data itself. Only when the target image meets both conditions of being captured after power-on and matching the test image is the test considered passed, thereby eliminating the interference of cached images before power-on and non-real-time images during the startup phase at the data level. Therefore, the technical solution of the present invention solves the problem that the existing technology uses the interface functional status as the basis for judgment, which leads to insufficient test accuracy in scenarios where USB cameras are repeatedly plugged and unplugged, and improves the accuracy and reliability of USB camera plugging and unplugging tests. Attached Figure Description
[0011] Figure 1 This is a flowchart of a USB camera plug-in / plug-out test method according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating a USB camera plug-in / plug-out test method in another embodiment of the present invention. Figure 3 This is a connection block diagram of a USB camera plug-in / plug-out test system according to an embodiment of the present invention; Figure 4 This is a flowchart of the relay control module in one embodiment of the present invention; Figure 5 This is a flowchart of the image generation module in one embodiment of the present invention; Figure 6 This is a flowchart of the image acquisition and recognition module in one embodiment of the present invention. Figure 7 This is a block diagram of the main control device used to implement embodiments of the present invention. Detailed Implementation
[0012] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0013] During the development of this invention, extensive experiments and data analysis revealed that in scenarios involving repeated plugging and unplugging of a USB camera, the images received by the host may originate from historical footage saved before power-on or from footage that has not yet been adapted to the current shooting scene during startup. In such cases, the interface function status may still appear normal. Relying solely on the interface function status is insufficient to determine whether the image was captured in real-time after power-on, leading to discrepancies between test results and the actual operating state of the USB camera. Based on these findings, this invention innovatively proposes this technical solution, which uses time-sensitivity information to bind image content to the generation time and makes a judgment based on the power-on time after acquisition.
[0014] Specifically, this invention, through experiments, reveals a technical flaw in the traditional USB camera plug-in / plug-out test method that uses interface functional status as the criterion: the interface functional status only reflects the connection and communication status of the USB link, and has no correlation with whether the image returned by the USB camera is an image acquired in real time after power-on. However, by overlaying time-sensitive information into the test image and extracting this information from the target image after acquisition, this invention determines whether the target image is an image acquired after power-on and matches the test image based on the time-sensitive information and the power-on time. This eliminates interference from non-real-time images, ensuring that the test results are consistent with the actual working state of the USB camera.
[0015] Therefore, the present invention provides a USB camera plug-in / plug-out test method according to the first aspect, which can be applied to a main control device. The main control device can simulate the plug-in / plug-out operation of a USB camera by controlling the on / off state of the power supply line and / or signal line of the USB camera, thereby powering the USB camera back on; acquire a test image and read the current time as the generation time; generate time-sensitive information based on the generation time and the image type of the test image; superimpose the time-sensitive information onto the test image; acquire a target image obtained by capturing the test image with superimposed time-sensitive information after the USB camera is powered back on; acquire the power-on time and extract the time-sensitive information from the target image; determine whether the target image is an image acquired after power-on and matches the test image based on the time-sensitive information and the power-on time; if the determination result is yes, the USB camera plug-in / plug-out test is deemed to have passed.
[0016] Specifically, the main control device can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.
[0017] like Figure 1 As shown, the method may include: Step S11: Control the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera and power on the USB camera again.
[0018] The power supply line refers to the power cable in the USB cable that provides power to the USB camera.
[0019] Signal lines refer to the data lines in a USB cable used to transmit enumeration, control, and image data.
[0020] The plugging and unplugging operation refers to simulating the action of unplugging a USB camera from the USB interface and then plugging it back in.
[0021] Re-powering refers to the process by which a USB camera receives power again after a power outage and completes device enumeration again.
[0022] Specifically, the control device disconnects the power supply line and / or signal line of the USB camera through a controllable switch, putting the line in an open state; after the line remains in the open state for a preset time, the control device reconnects the line, allowing the USB camera to regain power and triggering the device enumeration process.
[0023] Step S12: Obtain the test image and read the current time as the generation time. Generate time-sensitive information based on the generation time and the image type of the test image.
[0024] The test image refers to an image generated according to a preset pattern type and used to display the image captured by a USB camera. The pattern type of the test image is not limited to solid color patterns; it can also use any machine-readable pattern such as checkerboard patterns, striped patterns, gradient patterns, or character graphics.
[0025] The generation time refers to the time value read from the system clock when the time-sensitive information is generated.
[0026] Image type refers to the content category identifier of the test image, such as solid color pattern, checkerboard pattern, or striped pattern.
[0027] Timeliness identification information refers to machine-readable data containing image type and generation time, which is used to verify the timeliness and content consistency of the target image in subsequent steps.
[0028] Specifically, the control device acquires a pre-set image type, generates a test image based on the image type, and reads the current time as the generation time through the system clock; then, it combines the image type and the generation time into time-sensitive information according to a preset encoding rule.
[0029] Step S13: Overlay the timeliness identification information onto the test image.
[0030] Overlay refers to embedding time-sensitive information into a predetermined area of a test image in the form of graphics, characters, or coded symbols to generate a test image with overlaid time-sensitive information.
[0031] Specifically, the control device encodes the timeliness identification information into a graphic identifier and places this graphic identifier in the corner area of the test image to avoid obscuring the main content of the test image. The overlay position of the timeliness identification information in the test image is not limited to the lower right corner; it can be set in other blank areas of the test image according to testing requirements. The fault tolerance level of the QR code graphic used for the timeliness identification information can be set as needed according to the image quality of the display and acquisition links, so that it can still be reliably decoded even when there is local interference in the image.
[0032] Step S14: Obtain the target image obtained after the USB camera is powered on again and the test image with superimposed time-limited identification information is acquired.
[0033] The target image refers to one or more frames of image data acquired by the host from the USB camera after the USB camera captures a test image on the display screen with overlaid time-sensitive identification information.
[0034] Specifically, the test image with overlaid time-limited identification information is output to the display screen; the USB camera, after being powered on again, is aimed at the display screen to take a picture, and the captured video stream is transmitted to the host via the USB interface; the control device reads the current frame from the host's acquisition channel as the target image.
[0035] Step S15: Obtain the power-on time and extract the time-of-use identification information from the target image. Based on the time-of-use identification information and the power-on time, determine whether the target image is an image collected after this power-on and matches the test image.
[0036] Among them, the power-on time refers to the time value recorded when the control device controls the USB camera to power on again; matching means that the image type carried in the target image is consistent with the image type of the test image.
[0037] Specifically, the control device decodes the time-of-use information from the target image to obtain the generation time and image type; at the same time, it acquires the power-on time and the current system time; the control device determines whether the generation time is not earlier than the power-on time, whether the time interval between the current system time and the generation time is within a preset range, and whether the decoded image type is consistent with the image type of the test image; when all the above conditions are met, the target image is determined to be the image acquired after this power-on and that matches the test image.
[0038] Step S16: If yes, then the USB camera plug-in / unplug test is considered passed.
[0039] The plug-in / plug-out test passing means that the USB camera can output a real-time image that is consistent with the expected test image and is not buffered after being powered on again, indicating that the plug-in / plug-out function of the USB camera is normal.
[0040] Specifically, when the judgment result of step S15 is yes, the control device generates a test pass result and outputs the test pass result to the test interface or records it in the test log.
[0041] For example, the control device displays the test pass result on the test interface and records the power-on time, generation time, image type and judgment result corresponding to the plugging and unplugging operation.
[0042] This embodiment provides a USB camera plug-in / plug-out testing method, which is implemented through six core steps: on / off control, identifier generation, identifier overlay, image acquisition, comprehensive judgment, and result determination. Specifically, the on / off control step establishes a clear restart point for the USB camera; the identifier generation step binds the generation time with the image type as time-sensitive identifier information, providing a data benchmark for subsequent timeliness judgment; the identifier overlay step ensures that the time-sensitive identifier information is acquired by the USB camera along with the test image; the image acquisition step obtains the target image actually output by the USB camera; the comprehensive judgment step, based on the time-sensitive identifier information and the power-on time, determines whether the target image was acquired after the current power-on and matches the test image from two dimensions: timeliness and content consistency; and the result determination step outputs a test pass result when the judgment is successful. In this entire technical solution, this embodiment addresses the technical problem mentioned in the background art, where existing technologies use interface functional status as the judgment basis, leading to insufficient testing accuracy in scenarios involving repeated plugging and unplugging of USB cameras. By generating and overlaying time-sensitive identifier information, and combining the power-on time after acquisition to determine the timeliness and content consistency of the target image, this method solves the technical problem in existing technologies that cannot distinguish between real-time images after the current power-on and historical cached images. Therefore, the technical solution of this embodiment can improve the accuracy and reliability of USB camera plug-in / plug-out testing.
[0043] In some embodiments, the above-described control of the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera and power on the USB camera again may include: in response to a plugging and unplugging test command, cutting off the circuit of the power supply line and / or signal line, switching the circuit from an on state to an off state, and after the circuit is in the off state, connecting the circuit, switching the circuit from the off state to an on state, so as to trigger the USB camera to power on again.
[0044] Among them, the insertion / removal test command refers to the trigger signal generated by the main control device to initiate a insertion / removal simulation operation. A circuit is a conductive path formed by a power supply line or signal line, used to transmit electrical energy or data signals.
[0045] The connected state refers to the state where the circuit is closed and electrical energy or data signals can be transmitted normally.
[0046] A disconnected state refers to a state where the circuit is broken and the transmission of power or data signals is interrupted. Disconnecting the power supply circuit will interrupt the power supply to the USB camera, and disconnecting the signal circuit will interrupt the USB data link.
[0047] When at least one of the power supply and signal circuits is disconnected, the USB camera appears to be offline on the host side.
[0048] Specifically, the main control device is equipped with a relay control module. After receiving the plug-in / plug-out test command, the main control device sends a control signal to the relay control module. The relay control module, based on the control signal, controls a controllable switch connected in series in the power supply line and / or signal line to disconnect, switching the corresponding circuit from an on state to an off state. After the circuit is in the off state, the relay control module again controls the controllable switch to close, switching the corresponding circuit from an off state to an on state. The USB camera completes re-enumeration after power or data link restoration, thus achieving power-on again.
[0049] For example, in an image communication test scenario, the main control device sends a plug-in / plug-out test command to the relay control module. The relay control module first controls the relay contacts connected in series in the USB camera's power supply line to open, putting the power supply circuit in a suspended state. The host side detects that the USB camera is disconnected. After the suspended state continues for a preset time, the relay control module controls the relay contacts to close, switching the power supply circuit to an on state. The USB camera is then powered back and completes re-enumeration. The entire process requires no manual physical plugging or unplugging of the USB camera.
[0050] Therefore, according to the above implementation method, the main control device can automatically simulate the plugging and unplugging operation of the USB camera by controlling the on / off state of the circuit, making the plugging and unplugging process controllable and repeatable, and providing a clear power-on time for subsequent acquisition of target images after power-on.
[0051] In some embodiments, generating timeliness identification information based on the generation time and the image type of the test image includes: combining the generation time and the pattern type set for the test image to obtain timeliness identification information.
[0052] The pattern type refers to the content category identifier of the test image, and the pattern type has the same meaning as the image type described in the claims.
[0053] Combination refers to the operation of merging the pattern type and generation time into a single data unit according to predetermined encoding rules.
[0054] Pre-defined coding rules refer to pre-set data organization rules that specify the order and separation method of drawing types and generation times in timeliness identification information.
[0055] Specifically, the pattern type is converted into an identifier character, and the generation time is converted into a time character. Following a predetermined encoding rule, the identifier character and the time character are connected by a predetermined separator to obtain the time-sensitive information. The identifier character is a text symbol used to represent the pattern type; the time character is a text symbol used to represent the generation time; and the predetermined separator is a symbol used to distinguish the boundary between the identifier character and the time character.
[0056] Therefore, according to the above implementation method, the main control device can bind the pattern type and generation time in a structured manner to the same data carrier, providing a unified data format for subsequent extraction of timeliness identification information from the target image and for timeliness judgment and content matching.
[0057] In some embodiments, overlaying timeliness information onto a test image includes: overlaying timeliness information onto a predetermined area of the test image to obtain the test image.
[0058] The predetermined area refers to a pre-defined region within the test image designed to carry the timeliness identification information. This region can be located at the corners or blank areas of the test image to avoid obscuring the main content. Overlay refers to embedding the timeliness identification information into the predetermined area of the test image in a recognizable graphic form. The overlaid test image is still considered a test image and is used for subsequent output to the display screen for capture by the USB camera.
[0059] Specifically, the main control device encodes the timeliness identification information into a QR code graphic; determines a predetermined area in the test image; scales the QR code graphic to a size matching the predetermined area; and overlays the scaled QR code graphic onto the predetermined area, while retaining a quiet zone around the QR code graphic, resulting in a test image with the timeliness identification information superimposed. The quiet zone refers to the blank area around the QR code graphic that does not contain any graphic information. The position of the QR code graphic within the predetermined area is fixed to ensure that the USB camera can extract the timeliness identification information from the same position after acquiring the target image.
[0060] For example, the test image is a resolution test card pattern, and the predetermined area is located in the blank area at the lower right of the test image. The main control device encodes the time stamp information into a QR code graphic, places the QR code graphic in the aforementioned blank area, and reserves a quiet area around the QR code graphic to obtain a test image that can be displayed on the screen.
[0061] Therefore, according to the above implementation method, the main control device can embed the time-of-use identification information into the test image in a fixed position while maintaining the integrity of the main content of the test image, thus providing a stable recognition benchmark for the subsequent acquisition of target images and decoding of time-of-use identification information by the USB camera.
[0062] In some embodiments, determining whether the target image is an image acquired after power-on and matching the test image based on the time-of-use information and the power-on time includes: parsing the time-of-use information to obtain the pattern type and generation time of the test image, obtaining the current time as the determination time, and determining whether the target image is an image acquired after power-on and matching the test image based on the determination time, the power-on time, the generation time, and the pattern type of the test image. The USB camera plug-in / plug-out test method further includes: determining that the USB camera plug-in / plug-out test passes when the time interval between the current time and the generation time does not exceed a preset threshold, the generation time is not earlier than the power-on time, and the image type of the target image successfully matches the pattern type of the test image.
[0063] Here, parsing refers to the process of extracting time-related identification information from the target image and restoring it to the pattern type and generation time; the current time refers to the time value read from the system clock when the main control device performs the judgment operation, and the current time is used as the judgment time to participate in subsequent judgments; the preset threshold refers to a pre-set value used to limit the maximum allowable time interval between the judgment time and the generation time; a successful match means that the image type of the target image is consistent with the pattern type of the test image.
[0064] Specifically, the main control device decodes the time-of-use information in the target image to obtain the pattern type and generation time of the test image; the main control device reads the system clock to obtain the current time and uses the current time as the judgment time; the main control device performs three judgments: the first judgment checks whether the time interval between the judgment time and the generation time does not exceed a preset threshold, which is used to exclude the possibility of old images cached before the USB camera is powered on being captured; the second judgment checks whether the generation time is not earlier than the power-on time, which is used to exclude the possibility of test images generated before the USB camera is powered on being incorrectly captured; the third judgment checks whether the image type of the target image matches the pattern type of the test image, which is used to confirm that the target image corresponds to the test image used in this test. When all three judgments are satisfied, the main control device determines that the target image is an image captured after power-on and matches the test image, and determines that the USB camera plug-in / plug-out test has passed.
[0065] Therefore, according to the above implementation method, the main control device can comprehensively eliminate interference from historical cached images, images generated outside the current power-on period, and images with mismatched content by verifying the time relationship between the determination time, power-on time, and generation time, as well as the pattern type matching verification. This allows for accurate determination of whether the USB camera has successfully acquired the expected test image after the current power-on, thereby improving the accuracy and reliability of USB camera plug-in / plug-out testing.
[0066] In some embodiments, the USB camera plug-in / plug-out test method further includes: outputting test images to a display screen for display and acquisition by the USB cameras. The USB cameras are multiple, and the method further includes: controlling the on / off state of the power supply lines and / or signal lines of each USB camera; dividing the display screen into multiple display areas, each display area displaying a test image corresponding to one USB camera, with the time-of-use information in each display area containing the group identifier of the corresponding USB camera; acquiring the target image captured by each USB camera in the corresponding display area; and determining whether each USB camera has passed the test based on the time-of-use information in each target image and the power-on time of the corresponding USB camera.
[0067] The display screen refers to the display device used to provide image content to the USB camera; the display area refers to the sub-areas pre-divided on the display screen, and the display areas do not overlap with each other. Each display area is used to display the test image corresponding to one USB camera; the group identifier refers to the identification information used to distinguish different USB cameras. The group identifier, as part of the timeliness identification information, is combined with the pattern type and the generation time to generate timeliness identification information so that the test images in each display area can be distinguished.
[0068] Specifically, the main control device generates corresponding test images for multiple USB cameras, and overlays time-related identification information containing the corresponding group identifier into each test image; the main control device outputs the multiple test images to multiple display areas of the display screen, with each display area showing the test image corresponding to one USB camera; the main control device controls the on / off state of the power supply lines and / or signal lines of each USB camera, causing each USB camera to power on again; each USB camera aims at its corresponding display area on the display screen and takes a picture, and the main control device acquires the target image obtained by each USB camera in the corresponding display area; the main control device then... The system acquires the power-on time of each USB camera, reads the current time as the judgment time corresponding to each target image, and parses the time-of-fact information in each target image to obtain the pattern type, generation time, and group identifier corresponding to each target image. For each USB camera, the main control device determines whether the target image is the image acquired after the USB camera is powered on this time and matches the test image corresponding to the USB camera, based on the power-on time of the USB camera, the judgment time of the target image corresponding to the USB camera, the generation time, the pattern type, and the group identifier. When the determination result is yes, the USB camera is determined to have passed the plug-in / unplug test.
[0069] Therefore, according to the above implementation method, the main control device can enable multiple USB cameras to share the same display screen for parallel plug-in / plug-out testing. By dividing the display area and using the group identifier carried by the timeliness identifier information in each display area, crosstalk between target images captured by different USB cameras is avoided. The timeliness judgment is performed separately using the independent power-on time of each USB camera. Batch testing can be completed without the need for each USB camera to perform synchronous plug-in / plug-out operations, which significantly improves the efficiency and accuracy of USB camera plug-in / plug-out testing.
[0070] In some embodiments, after determining whether the target image is an image acquired after power-on and matching the test image, the USB camera plug-in / plug-out test method further includes: when the target image is not an image acquired after power-on and matching the test image, reacquiring the target image acquired by the USB camera and re-executing the determination step until the determination passes or the number of retries reaches a preset threshold; when the determination still fails after retries, obtaining the current time and determining the failure classification result based on whether the time interval between the current time and the generation time exceeds a preset threshold and whether the pattern type in the target image matches the pattern type in the test image. Among them, a time interval exceeding the preset threshold corresponds to a cache exception, and a pattern type mismatch corresponds to a data acquisition exception.
[0071] Among them, a time interval exceeding the preset threshold corresponds to a cache exception, and a pattern type mismatch corresponds to a collection exception.
[0072] The number of retries refers to the number of times the target image captured by the USB camera is reacquired and the judgment step is re-executed. The preset thresholds include the time interval threshold and the number of retries threshold. The time interval threshold is used to limit the maximum allowable time interval between the judgment time and the generation time, and the number of retries threshold is used to limit the maximum number of times the target image is reacquired and the judgment step is re-executed. The failure classification result refers to the classification information used to identify the reasons for the failure of the USB camera plug-in / unplug test. The failure classification result includes cache anomaly and acquisition anomaly. Cache anomaly means that the target image is a historical image cached before the USB camera was powered on again. Acquisition anomaly means that the target image does not correspond to the test image.
[0073] Specifically, when the judgment result indicates that the target image is not an image acquired after power-on and matches the test image, the test controller controls the USB camera to acquire the target image again and re-executes the judgment step; each time the judgment step is re-executed, the retry count increases by one; when the judgment passes, the test controller determines that the USB camera plug-in / unplug test has passed; when the retry count reaches the retry count threshold and the judgment still fails, the test controller stops retrying and obtains the current time as the judgment time; the test controller calculates the time interval between the judgment time and the generation time and determines whether the time interval exceeds the time interval threshold; the test controller determines whether the pattern type in the target image matches the pattern type in the test image; when the time interval exceeds the time interval threshold, the failed classification result is determined to be a cache anomaly; when the pattern type does not match, the failed classification result is determined to be an acquisition anomaly.
[0074] Therefore, according to the above implementation method, the main control device can automatically retry when the target image fails the judgment, thereby improving the fault tolerance of the test process. When the retry still fails, the failure classification result is determined by dual verification of time interval and pattern type, distinguishing between cache abnormality and acquisition abnormality, providing a basis for fault location in USB camera plug-in / plug-out testing, and further improving test accuracy and maintainability.
[0075] In some embodiments, the USB camera plug-in / plug-out test method further includes an exception handling and retry mechanism. After the USB camera is powered on again, the test controller polls the USB device nodes of the system, waiting for the USB camera enumeration to complete. If the USB camera enumeration is not detected within a preset enumeration time, the enumeration is deemed to have failed. When the USB camera enumeration is detected to be complete, the test controller outputs the test image to the display screen, waits for the display to stabilize, and discards the first few frames captured by the USB camera. In cases of acquisition failure, color mismatch, or QR code decoding failure, the test controller re-acquires the target image and re-executes the judgment within a preset retry threshold. If the judgment still fails within the preset retry threshold, the plug-in / plug-out test is deemed to have failed. The test controller records the number of failed rounds and the failure type, and outputs a test report.
[0076] Specifically, the test controller periodically reads the USB device node list by calling the system device query interface. After each read, the test controller checks whether the device identifier corresponding to the USB camera appears in the list. If no device identifier is detected within the preset enumeration time, the test controller determines that the enumeration has failed and records the failure type as enumeration failure. When a device identifier is detected, the test controller confirms that the USB camera enumeration is complete and outputs the test image to the display screen. Because there is a transition period after the display screen switches patterns, and the USB camera has an exposure stabilization and autofocus process in the initial stage of startup, the test controller discards the first few frames captured by the USB camera after the display stabilizes to avoid capturing transition frames before pattern switching or the first frame when exposure and focus are unstable. The test controller performs a judgment on each subsequent frame of target image. When a capture failure, color mismatch, or QR code decoding failure occurs, the test controller recaptures the target image and re-executes the judgment within a preset retry threshold until the judgment passes or the retry count reaches the preset retry threshold. If the judgment still fails after retrying, the test controller determines that the plug-in / unplug test has failed and determines the corresponding failure type based on the specific reason for the failure. When the failure type is "time expired," it corresponds to a cache anomaly, meaning the target image is a historical image cached before the USB camera was powered on again. When the failure type is "partial content anomaly," it corresponds to a capture anomaly, meaning the target image contains local capture defects, including dead pixel clusters, partial screen distortion, or interference bands. The test controller records the failure rounds and failure types, and summarizes all failure rounds and failure types into a test report.
[0077] For example, in a parallel testing scenario, after a USB camera successfully powers on and is enumerated, the test controller outputs the test image corresponding to that USB camera to the corresponding display area on the screen. After discarding the first few frames, the test controller repeatedly fails to decode the QR code. If the preset retry threshold is reached and the system still fails to pass the judgment, the test controller determines the failure type to be a missing QR code and records the failure round and failure type. Subsequently, the test controller summarizes the multiple failure rounds and failure types and outputs a test report. The test report displays information about cache anomalies due to time expiration and information about local acquisition defects due to partial content anomalies.
[0078] Therefore, according to this embodiment, the main control device can automatically perform enumeration waiting, retry and failure classification recording, eliminate the influence of interference frames in the initial stage of camera startup and display switching transition period, improve test fault tolerance through retry mechanism after stabilization, and accurately locate the cause of failure such as cache abnormality and local acquisition defects through detailed failure type classification and test report output, thereby improving the reliability and maintainability of USB camera plug-in and unplug test.
[0079] In one embodiment, Figure 2This displays a flowchart of the USB camera plug-in / plug-out testing method. Figure 2 In this context, the USB camera plug-in / plug-out test method may include: S101: Hardware Connection. Connect the USB camera to the host via a relay group. The relay group is connected in series with the 5V power supply line of the USB cable to control the power supply to the camera.
[0080] S102: Camera Positioning. Point the USB camera at the display screen, ensuring that the camera can clearly capture the desired image displayed on the screen.
[0081] S103: Simulated Power-On. The main control device controls the relay to close via serial port commands, turning on the 5V power supply line of the USB camera, simulating the camera being plugged in and powered on, and then waits for the camera enumeration to complete.
[0082] S104: Output the expected image. The main control device controls the image generation module to generate a test image containing time-related information and outputs it to the display screen. The time-related information can be a QR code.
[0083] S105: Data Acquisition and Recognition. The main control device reads the image data acquired by the camera through the host connected to the USB camera, and uses the image recognition module to identify the image content and the QR code it carries.
[0084] S106: Comparison and Judgment. The identified image content and QR code are compared with the expected output from S104: ① Image content comparison (whether the color / graphic / pattern features match the expectation; when multi-pattern arrangement is enabled, perform multi-dimensional verification at the region and feature levels for images other than the QR code); ② Time consistency comparison (determine whether the collected data is real-time new data after this power-on). If both pass, the power-on is considered normal; if either fails, it is handled according to the abnormal handling procedure.
[0085] S107: Traverse the test. Switch the output to the next specific image according to the test settings, and repeat S104~S106 until all predefined test image types have been traversed.
[0086] S108: Cyclic plugging and unplugging. Repeat S103~S107 to simulate repeated plugging and unplugging of the USB camera, complete the stability verification for the set number of times, and output a test report.
[0087] In the above process, S104~S107 constitute the closed loop of image acquisition verification after a single power-on, and S103~S108 constitute the outer loop of the plug-in / plug-out cycle test.
[0088] It should be understood that this embodiment uses a relay connected in series with the 5V power supply line of the USB connection cable as an example for illustrative purposes; however, the present invention may also employ other equivalent alternatives to control the on / off state of the power supply line or data line using a controllable switch as needed.
[0089] According to a second aspect, this invention provides a USB camera plug-in / plug-out testing system, comprising a main control device and a display screen and a USB camera respectively connected to the main control device, wherein... The main control device is used to control the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera, so that the USB camera is powered on again, acquires the test image, and reads the current time as the generation time. Based on the generation time and the image type of the test image, it generates time-effect identification information, superimposes the time-effect identification information on the test image, and outputs the test image to the display screen. After the USB camera is powered on again, the target image is obtained by acquiring the test image with superimposed time-effect identification information, acquiring the power-on time, and extracting the time-effect identification information from the target image. Based on the time-effect identification information and the power-on time, it is determined whether the target image is the image acquired after this power-on and matches the test image. If so, the USB camera plugging and unplugging test is considered to have passed. The display screen is used to show the test images; The USB camera is used to capture test images on the display screen.
[0090] In one embodiment, Figure 3 This displays a connection diagram of a USB camera plug-in / plug-out testing system. Figure 3 The USB camera plug-in / plug-out testing system includes a main control device, an image generation module, a relay control module, a relay group, an image acquisition and recognition module, a display screen, a USB camera, and a host unit housing the camera. The connection relationships are as follows: The main control device, as the core of the system, is connected to the relay control module via a serial port: the main control sends commands, the relay group performs on / off operations, controls the 5V power supply line of the USB camera, and realizes the power-on and power-off of the camera.
[0091] Test the main control unit's connection to the image generation module: generate the expected image according to the design, output it to the display screen, capture the content of the display screen with the USB camera, and return the captured image data to the host unit carrying the camera via the camera driver.
[0092] The test controller calls the image acquisition and recognition module: reads the data acquired by the camera from the host, recognizes the image content and QR code information, compares and judges them and returns the results, driving the test process to the next step.
[0093] Resource relationships when multiple groups are in parallel: Each group of USB cameras is equipped with an independent controllable switch channel for electrical on / off, while sharing the same display screen for image source. Each group only needs to ensure the autonomous closed loop of its own image, power-on and judgment, without the need to configure a separate screen for each group or to synchronize and schedule between groups.
[0094] In some embodiments, in addition to being connected in series with the 5V power supply line, the relay group can also control the on / off state of the D+ / D− data line, or the on / off state of the VBUS (Voltage Bus) and the data line as a whole, which can trigger the system to re-enumerate the device, equivalent to simulating plugging and unplugging. It should be noted that cutting off the VBUS is only equivalent to physical plugging and unplugging for bus-powered cameras. For self-powered cameras, the D+ / D− data line must be cut off or an independent power supply must be switched on and off in order to enable the device to be re-enumerated. All of the above substitutions are within the protection scope of this invention.
[0095] Universal serial bus hubs with independent port power supply control, programmable electronic switches, or power metal-oxide-semiconductor field-effect transistors can all replace discrete relay groups.
[0096] In one embodiment, Figure 4 This shows the flowchart of the relay control module. For example... Figure 4 As shown, the power supply line of the USB camera is controlled to simulate the plugging and unplugging of the USB camera, so that the USB camera can be powered on again. This includes using a serial port protocol relay control method to control the on / off state of the 5V power supply line of the USB connection cable.
[0097] Among them, serial protocol relay refers to a relay device that receives control commands through a serial communication interface and performs line switching actions; disconnect command refers to the command data used to control the relay to disconnect the 5V power supply line; conduct command refers to the command data used to control the relay to conduct the 5V power supply line; camera enumeration refers to the process by which a USB camera establishes a communication connection with the host computer that carries the camera after being powered on again and completes device identification and configuration.
[0098] Specifically, the test controller calls the serial communication initialization function to initialize the serial port parameters and establish a communication connection with the serial port protocol relay. The test controller then calls the serial port write function to send a disconnect command to the serial port protocol relay, controlling the relay to disconnect the 5V power supply line of the USB cable, thus switching the power supply line to an unplugged state to simulate the unplugging of the USB camera. The test controller then calls a delay function to wait for the preset duration of the simulated unplugging operation to maintain the unplugged state. Next, the test controller calls the serial port write function again to send a conduction command to the serial port protocol relay, controlling the relay to conduct the 5V power supply line of the USB cable, thus switching the power supply line to an on state to simulate the insertion of the USB camera. Finally, the test controller calls the delay function again to wait for the preset duration of camera enumeration to complete, allowing the USB camera to power on again.
[0099] Therefore, according to the above implementation method, the main control device can automatically control the on / off state of the USB camera power supply line through the serial port protocol relay to simulate the plugging and unplugging operation of the USB camera. This eliminates the need for manual physical plugging and unplugging, achieving automated control and good repeatability of the plugging and unplugging process, and providing a clear power-on time for subsequent acquisition of target images and execution of judgment steps.
[0100] In one embodiment, Figure 5 The flowchart shown is for the image generation module. It generates a test image based on test parameters, reads the current time as the generation time, generates time-sensitivity information based on the generation time and the image type of the test image, overlays the time-sensitivity information onto the test image, and outputs it to the display screen.
[0101] Among them, test parameters refer to the parameters used to determine the content attributes of the test image, including image type and resolution; test pattern set refers to a pre-set collection of various patterns, each pattern used to verify one or more basic acquisition capabilities of the USB camera; capability list refers to a pre-set list used to arrange the acquisition capabilities to be verified in this round of testing and the corresponding pattern sequence; content identifier refers to the text symbol used to represent the image type; timestamp refers to the text symbol used to represent the generation time, accurate to the second or millisecond; area / group number refers to the identification information used to distinguish different display areas or different USB camera groups; spatiotemporally unique expected image refers to the test image whose timeliness identifier information is unique in the time dimension and corresponds to the image type of the test image, used to distinguish real-time images from historical cached images in subsequent judgments; module size refers to the display size of a single black and white square in the QR code.
[0102] Specifically, the image generation module receives test parameters. It calls the "Create New Image" function from the image processing library to generate a monochrome background image of a specified resolution as the test image. The test image type includes a solid color pattern or a graphic pattern. Solid color patterns are one of red, green, blue, or yellow, while graphic patterns are one of checkerboard or striped patterns. Simultaneously, a string consisting of a content identifier and a timestamp is constructed, and the QR code generation library function is called to encode this string into a QR code. The "Image Paste" function is called to overlay the QR code graphic onto a specified position on the test image; the specified position is the blank area in the lower right corner of the test image. After overlaying, the "Image Display" function is called to output the final image to the display screen.
[0103] The QR code occupies only a corner of the test image, while the remaining large area is used to carry image content verification information. Each pattern encodes the verification information in the color or structural features of the image, focusing on identifying one or more basic acquisition capabilities of the USB camera. The test controller arranges the pattern sequence for this round according to the capability list and switches the image type round by round, so that each round of test image is composed of the current pattern and the QR code generated in the current round. Because the timestamp is accurate to the second or millisecond and is regenerated in each round of testing, the QR code content is unique in the time dimension, forming a spatiotemporally unique expected image.
[0104] The specific implementation steps based on the image processing library and QR code generation library are as follows: First, call the image processing library function to create a new monochrome background image of a specified resolution. Second, construct a string consisting of a content identifier and a timestamp. Third, call the data addition function in the QR code generation library function to add the string to the QR code generation instance. Fourth, call the generation function in the QR code generation library function to generate a QR code matrix. Fifth, call the image generation function in the QR code generation library function to generate the QR code. Sixth, call the image pasting function to paste the QR code to the specified position on the background image. Finally, call the image display function to output the final image to the display screen.
[0105] To overcome interference in the image acquisition link between the display screen and the camera, the following measures are taken: the QR code uses a high-contrast black and white color scheme to avoid color shift and misreading caused by the color channel; during testing, the exposure and gain of the USB camera are locked, automatic exposure and automatic white balance are disabled, and multiple frames are allowed to be continuously decoded, taking the decoding result with the highest frequency; the QR code is placed in a stable and uniform background area of the display screen, avoiding the edges of the image and known sensor dead pixels or dead zones; in parallel partitioning scenarios, the partition size and acquisition resolution are dynamically set according to the lower limit of QR code decodability and pattern feature recognition; optionally, the module size of the QR code is enlarged to adapt to the screen projection distance.
[0106] Therefore, the system can overlay the image type and generation time onto the test image in the form of a QR code, making the QR code unique in the time dimension. This provides a data benchmark for subsequent judgment of the timeliness and content consistency of the target image. Furthermore, robust measures are taken to improve the decoding success rate of the QR code in the screen and camera acquisition link, ensuring the feasibility and accuracy of USB camera plug-in / plug-out testing.
[0107] In one embodiment, Figure 6 The flowchart shown is for the image acquisition and recognition module. This module performs content recognition and timeliness information decoding on the target image, and comprehensively determines whether the target image was acquired after power-on and matches the test image.
[0108] Specifically, the image acquisition and recognition module calls the camera acquisition function to open the USB camera and set the acquisition resolution. The image acquisition and recognition module then calls the frame reading function to acquire one frame of data as the target image. If the frame reading function returns a false success flag, the exception handling process is initiated.
[0109] For solid color images, the image acquisition and recognition module calls the array reshaping function to convert the target image data into a one-dimensional pixel array, calls the mean calculation function to calculate the average color value of the target image, and calls the approximate comparison function to determine whether the deviation between the average color value and the expected color value is within the preset tolerance range. For graphic images, the image acquisition and recognition module calls the corresponding verification algorithm and expected image parameters based on the decoded image type identifier to perform feature comparison on the target image.
[0110] The image acquisition and recognition module calls the color space conversion function to convert the target image into a grayscale image, calls the QR code decoding function to traverse the decoding results, extracts the QR code content string from the decoding results, and parses out the image type and generation time in the format of "content identifier_timestamp".
[0111] Optionally, the image acquisition and recognition module performs multi-dimensional content verification. Based on the parsed image type, the corresponding verification algorithm and expected pattern parameters are called to perform region-level sampling and feature-level comparison of the image content outside the area where the QR code graphic is located in the target image. The comparison features include multi-color partitioning, grayscale bars, checkerboard corner points, and stripe features to identify whether the USB camera's capabilities in color reproduction, white balance, grayscale levels, sharpness, geometric distortion, etc., are normal.
[0112] The image acquisition and recognition module obtains the current time as the judgment time, combines the power-on time and the generation time to judge the timeliness of the target image, and outputs the test result by combining the content judgment result and the timeliness judgment result. When the image type of the target image successfully matches the image type of the test image, the multi-dimensional content verification is passed, the time interval between the judgment time and the generation time does not exceed the preset threshold, and the generation time is not earlier than the power-on time, the USB camera plug-in / plug-out test is judged to be passed.
[0113] Therefore, the image acquisition and recognition module can automatically complete the acquisition of target images, image content recognition, decoding of timeliness information, and comprehensive judgment. Through dual verification of content and timeliness dimensions, it improves the accuracy and reliability of the judgment results.
[0114] According to a third aspect, the present invention provides a master control device, comprising: at least one processing unit; and a storage unit communicatively connected to the at least one processing unit. The storage unit stores executable instructions that can be invoked by the at least one processing unit. When the executable instructions are executed by the at least one processing unit, the at least one processing unit causes it to execute any of the USB camera plug-in / plug-out testing methods based on timestamp QR code verification in the embodiments of the present invention.
[0115] According to another aspect of the present invention, a medium for storing executable instructions is provided, wherein the computer instructions are used to cause a computer to execute any of the USB camera plug-in / plug-out test methods based on timestamp QR code verification in the embodiments of the present invention.
[0116] Figure 7 A schematic block diagram of a master control device 600 that can be used to implement embodiments of the present invention is shown. The master control device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The master control device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0117] like Figure 7As shown, the main control device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 can also store various programs and data required for the operation of the main control device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0118] Multiple components in the main control device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard or mouse; an output unit 607, such as various types of displays or speakers; a storage unit 608, such as a hard disk or optical disk; and a communication unit 609, such as a network interface card (NIC), a modem, or a wireless transceiver. The communication unit 609 allows the main control device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0119] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as a USB camera plug-in / plug-out test method based on timestamp QR code verification. For example, in some embodiments, a USB camera plug-in / plug-out test method based on timestamp QR code verification can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the host device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of a USB camera plug-in / plug-out test method based on timestamp QR code verification described above can be performed. Alternatively, in other embodiments, the computing unit 601 may be configured, by any other suitable means (e.g., by means of firmware), to perform a USB camera plug-in / plug-out test method based on timestamp QR code verification.
[0120] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0122] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0124] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0125] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0126] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.
[0127] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for testing the plugging and unplugging of a USB camera, characterized in that, include: Control the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera and power on the USB camera again. Acquire a test image and read the current time as the generation time. Generate timeliness identification information based on the generation time and the image type of the test image. The timeliness identification information is superimposed on the test image; The target image is obtained by acquiring the test image with the time stamp information superimposed on it after the USB camera is powered on again; Obtain the power-on time and extract the time-of-use identification information from the target image. Based on the time-of-use identification information and the power-on time, determine whether the target image is an image collected after this power-on and matches the test image. If so, the USB camera plug-in / unplug test is considered passed.
2. The method according to claim 1, characterized in that, The control of the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera and restore power to the USB camera includes: In response to a plug-in / plug-out test command, the circuit of the power supply line and / or the signal line is disconnected, so that the circuit is switched from the connected state to the disconnected state. After the circuit is in the off state, the circuit is turned on, switching the circuit from the off state to the on state, thereby triggering the USB camera to power on again.
3. The method according to claim 1, characterized in that, The step of generating time-sensitive information based on the generation time and the image type of the test image includes: The time-of-age identification information is obtained by combining the generation time and the pattern type set in the test image.
4. The method according to claim 1, characterized in that, The step of overlaying the timeliness identification information onto the test image includes: The timeliness information is superimposed on a predetermined area of the test image to obtain the test image.
5. The method according to claim 1, characterized in that, The step of determining whether the target image is an image acquired after power-on and matching the test image based on the timeliness identifier information and the power-on time includes: The timeliness identifier information is parsed to obtain the pattern type of the test image and the generation time; The current time is obtained as the determination time, and based on the determination time, the power-on time, the generation time, and the pattern type of the test image, it is determined whether the target image is an image collected after this power-on and matches the test image; The method further includes: When the time interval between the current time and the generation time does not exceed a preset threshold, and the generation time is not earlier than the power-on time, and the image type of the target image matches the pattern type of the test image successfully, the USB camera plug-in / plug test is determined to be passed.
6. The method according to claim 1, characterized in that, The method further includes: The test image is output to the display screen for capture by the USB camera; The method further includes: (The USB cameras are multiple; the method also includes:) Control the on / off state of the power supply lines and / or signal lines of each of the USB cameras respectively; The display screen is divided into multiple display areas, each display area displays a test image corresponding to a USB camera, and the timeliness identification information in each display area includes the group identifier of the corresponding USB camera; The target images captured by each USB camera in the corresponding display area are obtained respectively. Based on the time stamp information in each target image and the power-on time of the corresponding USB camera, it is determined whether each USB camera has passed the test.
7. The method according to claim 1, characterized in that, After determining whether the target image is an image acquired after power-on and matching the test image, the method further includes: If the target image is not the image captured after power-on and matches the test image, the target image captured by the USB camera is reacquired, and the judgment step is re-executed until the judgment passes or the number of retries reaches the preset threshold. If the test still fails after retrying, the current time is obtained, and the failure classification result is determined based on whether the time interval between the current time and the generation time exceeds a preset threshold and whether the pattern type in the target image matches the pattern type in the test image. Among them, the time interval exceeding the preset threshold corresponds to a cache exception, and the pattern type mismatch corresponds to a collection exception.
8. A USB camera plug-in / plug-out testing system, characterized in that, The system includes a main control device and a display screen and a USB camera respectively connected to the main control device. The main control device is used to control the on / off state of the power supply line and / or signal line of the USB camera to simulate the plugging and unplugging operation of the USB camera, so that the USB camera is powered on again, acquires a test image, reads the current time as the generation time, generates time-sensitive information based on the generation time and the image type of the test image, superimposes the time-sensitive information onto the test image, and outputs the test image to the display screen for display. After the USB camera is powered on again, the target image obtained by acquiring the test image superimposed with the time-sensitive information is acquired, the power-on time is acquired, and the time-sensitive information in the target image is extracted. Based on the time-sensitive information and the power-on time, it is determined whether the target image is the image acquired after this power-on and matches the test image. If so, the USB camera plugging and unplugging test is determined to be passed. The display screen is used to display the test image; The USB camera is used to capture the test images on the display screen.
9. A master control device, characterized in that, include: At least one processing unit; and a storage unit communicatively connected to the at least one processing unit; The storage unit stores executable instructions that can be invoked by the at least one processing unit. When the executable instructions are executed by the at least one processing unit, the at least one processing unit causes the at least one processing unit to perform the method as described in any one of claims 1 to 7.
10. A medium for storing executable instructions, characterized in that, When the executable instruction is invoked by the processing unit, it causes the processing unit to perform the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
USB (universal serial bus) plug testing method for mobile terminal
CN104615524A
