Imaging stability detection method and device and storage medium
By comparing and detecting the edges and texture features of the target object in the image frame acquired by the camera, the accuracy problem of imaging stability detection in the prior art is solved, and effective evaluation and recognition of image frame stability is achieved.
Patent Information
- Application Number
- CN202411767760.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-04-22
AI Technical Summary
The prior art is difficult to effectively detect and identify imaging stability problems such as jitter, blur and loss in image frames acquired by the camera, affecting image quality and accuracy.
By obtaining the image frame of the target object and its corresponding edge feature template and/or texture feature template, the actual edge features and/or texture features of the target object in the image frame are extracted, and the comparison is performed to judge the imaging stability of the image frame.
Accurate detection of image frame imaging stability is realized, abnormal image frames can be identified, and the accuracy of imaging stability detection of image acquisition equipment can be improved.
Smart Images

Figure CN119865604A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of camera quality detection, and in particular to an imaging stability detection method, device and storage medium. Background Art
[0002] Images have a wide range of applications, and the quality of images directly affects the effectiveness of their application in various fields.
[0003] However, due to the influence of factors such as the environment, the camera itself, and image transmission, the images captured by the camera may have problems such as jitter, blur, and line loss, affecting the quality and accuracy of the image.
[0004] As the application scenarios of images become more and more extensive, the requirements for camera imaging stability are also getting higher and higher. A reliable and practical camera imaging stability detection solution has great reference value. Summary of the invention
[0005] In order to solve the above technical problems, the present application at least provides an imaging stability detection method, device and storage medium.
[0006] In a first aspect, the present application provides an imaging stability detection method, which includes: obtaining an image frame obtained by capturing an image of a target object, and obtaining an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge feature and texture feature of the target object in a normally imaged image; extracting the edge feature and / or texture feature of the target object in the image frame to obtain the actual edge feature and / or actual texture feature corresponding to the target object; comparing the actual edge feature with the edge feature template, and / or comparing the actual texture feature with the texture feature template to obtain a comparison result; judging the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame.
[0007] In one embodiment, an actual edge feature and an edge feature template are compared to obtain a comparison result, including: calculating the similarity between the actual edge feature and the edge feature template to obtain edge similarity; using the edge similarity as the comparison result; judging the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame, including: if the edge similarity is in a preset high threshold interval, judging that the imaging stability detection result of the image frame is passed; if the edge similarity is in a preset low threshold interval, judging that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0008] In one embodiment, the edge feature contains the number of breakpoints of the edge contour; the actual edge feature and the edge feature template are compared to obtain a comparison result, including: calculating the difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template to obtain a breakpoint number difference; using the breakpoint number difference as the comparison result; judging the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame, including: if the breakpoint number difference is in a preset low threshold interval, judging that the imaging stability detection result of the image frame is passed; if the breakpoint number difference is in a preset high threshold interval, judging that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0009] In one embodiment, actual texture features and texture feature templates are compared to obtain a comparison result, including: calculating the similarity between the actual texture features and the texture feature template to obtain texture similarity; using the texture similarity as the comparison result; judging the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame, including: if the texture similarity is in a preset high threshold interval, judging that the imaging stability detection result of the image frame is passed; if the texture similarity is in a preset low threshold interval, judging that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0010] In one embodiment, the texture feature contains the number of texture lines; the actual texture feature and the texture feature template are compared to obtain a comparison result, including: calculating the difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template to obtain a texture number difference; using the texture number difference as the comparison result; judging the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame, including: if the texture number difference is in a preset low threshold interval, judging that the imaging stability detection result of the image frame is passed; if the texture number difference is in a preset high threshold interval, judging that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0011] In one embodiment, the actual edge feature is compared with the edge feature template, and / or the actual texture feature is compared with the texture feature template to obtain a comparison result, including: calculating the similarity between the actual edge feature and the edge feature template to obtain edge similarity; and / or calculating the difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template to obtain a breakpoint number difference; and / or calculating the similarity between the actual texture feature and the texture feature template to obtain texture similarity; and / or calculating the difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template to obtain a texture number difference; edge similarity, and / or breakpoint number difference, and / or texture similarity are compared. similarity, and / or texture quantity difference, as a comparison result; judging the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame, including: scoring the image frame based on edge similarity to obtain an edge similarity score, and / or scoring the image frame based on the breakpoint quantity difference to obtain a breakpoint quantity score, and / or scoring the image frame based on texture similarity to obtain a texture similarity score, and / or scoring the image frame based on the texture quantity difference to obtain a texture quantity score; performing weighted summation on the edge similarity score, and / or the breakpoint quantity score, and / or the texture similarity score, and / or the texture quantity score to obtain an imaging stability score of the image frame; and using the imaging stability score as the imaging stability detection result of the image frame.
[0012] In one embodiment, there are multiple target objects contained in the image frame; weighted summation is performed on the edge similarity score, and / or the breakpoint number score, and / or the texture similarity score, and / or the texture number score to obtain the imaging stability score of the image frame, including: weighted summation of the edge similarity score, and / or the breakpoint number score, and / or the texture similarity score, and / or the texture number score of each target object to obtain the final score of each target object; the final score with the smallest value is selected as the imaging stability score of the image frame, or the weighted summation is performed on the final score of each target object to obtain the imaging stability score of the image frame.
[0013] In one embodiment, the method also includes: calculating the average grayscale value of the image frame, and / or obtaining the image resolution of the image frame; judging the imaging stability of the image frame based on the comparison result, and obtaining the imaging stability detection result of the image frame, including: judging the imaging stability of the image frame based on the comparison result, and the size relationship between the average grayscale value and a preset grayscale threshold and / or the size relationship between the image resolution and a preset resolution, and obtaining the imaging stability detection result of the image frame.
[0014] According to a second aspect of the present application, there is provided an imaging stability detection device, which includes: an image and template acquisition module, which is used to acquire an image frame obtained by acquiring an image of a target object, and to acquire an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge feature and texture feature of the target object in a normally imaged image; a feature extraction module, which is used to extract the edge feature and / or texture feature of the target object in the image frame, and obtain the actual edge feature and / or actual texture feature corresponding to the target object; a template comparison module, which is used to compare the actual edge feature with the edge feature template, and / or compare the actual texture feature with the texture feature template, and obtain a comparison result; and a stability judgment module, which is used to judge the imaging stability of the image frame based on the comparison result, and obtain an imaging stability detection result of the image frame.
[0015] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned imaging stability detection method.
[0016] A fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, which implement the above-mentioned imaging stability detection method when the program instructions are executed by a processor.
[0017] The above scheme obtains an image frame obtained by acquiring an image of the target object, and obtains an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge feature and the texture feature of the target object in a normally imaged image; extracts the edge feature and / or the texture feature of the target object in the image frame to obtain the actual edge feature and / or the actual texture feature corresponding to the target object; compares the actual edge feature with the edge feature template, and / or compares the actual texture feature with the texture feature template to obtain a comparison result; judges the imaging stability of the image frame based on the comparison result to obtain an imaging stability detection result of the image frame, which can effectively and accurately identify image frames with abnormalities and improve the accuracy of imaging stability detection of the image acquisition device.
[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0020] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0021] Figure 2 is a flow chart of an imaging stability detection method shown in an exemplary embodiment of the present application;
[0022] Figure 3 is a schematic diagram of an image acquisition scene shown in an exemplary embodiment of the present application;
[0023] Figure 4 is a flow chart of an imaging stability detection method shown in another exemplary embodiment of the present application;
[0024] Figure 5 is a block diagram of an imaging stability detection device shown in an exemplary embodiment of the present application;
[0025] Figure 6 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present application;
[0026] Figure 7 It is a schematic diagram of the structure of a computer-readable storage medium shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0027] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0028] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0029] The term "and / or" in this article is only an association information describing the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.
[0030] The imaging stability detection method provided in the embodiment of the present application is described below.
[0031] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include an image acquisition device 110 and a server 120, and the image acquisition device 110 and the server 120 are connected to each other for communication.
[0032] The number of the image acquisition device 110 may be one or more. The image acquisition device 110 may be a line array camera, an area array camera, etc., but is not limited thereto.
[0033] Server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0034] In one example, the server 120 can obtain image frames obtained by the image acquisition device 110 when acquiring images of the target object, and perform imaging stability detection on the image frames to obtain imaging stability detection results. Of course, the server 120 can store the imaging stability detection results locally, transmit them back to the image acquisition device 110, or transmit them to other terminals.
[0035] In one example, a client running a target application is installed in the image acquisition device 110. For example, the target application may be an application that provides an imaging stability detection function. The imaging stability detection is performed on the image frame according to the target application to obtain an imaging stability detection result. The server 120 may be a background server of the target application, which is used to provide background services for the client of the target application.
[0036] In the imaging stability detection method provided in the embodiment of the present application, the execution subject of each step can be the image acquisition device 110, such as the client of the target application installed and running in the image acquisition device 110, or the server 120, or the image acquisition device 110 and the server 120 interact and cooperate to execute, that is, part of the steps of the method are executed by the image acquisition device 110 and the other steps are executed by the server 120.
[0037] See also Figure 2 , Figure 2 is a flowchart of an imaging stability detection method shown in an exemplary embodiment of the present application. The imaging stability detection method can be applied to Figure 1 It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable.
[0038] like Figure 2As shown, the imaging stability detection method at least includes steps S210 to S240, which are described in detail as follows:
[0039] Step S210: Acquire an image frame obtained by capturing an image of the target object, and acquire an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge features and texture features of the target object in a normal imaging image.
[0040] The image acquisition device acquires the image frame by acquiring the image of the target object.
[0041] Among them, the target objects include but are not limited to commodities, preset targets, vehicles, plants, roads and other objects with obvious characteristic values, and this application does not limit this.
[0042] Take the image acquisition device as an industrial line array camera as an example, please refer to Figure 3 , Figure 3 A schematic diagram of an image acquisition scene is shown for an exemplary embodiment of the present application. Figure 3 As shown, the industrial line array camera is deployed relative to the roller mobile platform, and a target object is placed on the roller mobile platform. The industrial line array camera collects images of the target object placed on the object placement surface of the roller mobile platform and sends the collected image frames to the server.
[0043] It should be noted that the above-mentioned image acquisition scenarios are only exemplary descriptions. In actual applications, image frames acquired in more different scenarios can be obtained, or other types of image acquisition devices can be used for image frame acquisition. This application does not limit this.
[0044] Optionally, during the imaging stability detection of the image acquisition device, in order to improve the accuracy of the stability detection, the area ratio occupied by the target object within the acquisition field of view of the image acquisition device may be increased.
[0045] Furthermore, an edge feature template and / or a texture feature template corresponding to the target object is obtained, wherein the edge feature template and the texture feature template refer to the edge features and the texture features of the target object in a normal imaging image.
[0046] Exemplarily, image frames captured by the current image acquisition device within a historical time period are obtained, or image frames captured by other image acquisition devices are obtained, and these image frames are used as sample images. Images with stable imaging are selected from the sample images as template images, and edge features and / or texture features of the target object in the template image are extracted to obtain edge feature templates and / or texture feature templates.
[0047] Among them, images with stable imaging can be manually selected from sample images, or downstream image tasks can be performed on sample images to obtain task execution results, and the corresponding sample images with high accuracy of task execution results can be used as images with stable imaging. This application does not limit this.
[0048] Exemplarily, in response to a template input operation, an edge feature template and / or a texture feature template input by a user may be obtained.
[0049] Step S220: extracting edge features and / or texture features of the target object in the image frame to obtain actual edge features and / or actual texture features corresponding to the target object.
[0050] The edge features and / or texture features of the target object in the image frame are extracted to obtain the actual edge features and / or actual texture features corresponding to the target object, so as to know the pixels belonging to the edge and / or texture of the target object in the image frame.
[0051] For example, an image feature extraction neural network is pre-trained, and an image frame is input into the image feature extraction neural network to intercept the image area corresponding to the target object through the image feature extraction neural network, and edge features and / or texture features are extracted from the image area corresponding to the target object, and the actual edge features and / or actual texture features corresponding to the target object are output.
[0052] For another example, a mathematical algorithm is used to extract edge features and / or texture features, such as a Sobel operator, a Roberts operator, a Gaussian filter, etc., to extract edge features and / or texture features to obtain actual edge features and / or actual texture features corresponding to the target object.
[0053] Step S230: comparing the actual edge feature with the edge feature template, and / or comparing the actual texture feature with the texture feature template, to obtain a comparison result.
[0054] The actual edge features corresponding to the image frame are compared with the edge feature template to compare the similarities and / or differences between the actual edge features and the edge feature template to obtain a comparison result; and / or, the actual texture features corresponding to the image frame are compared with the texture feature template to compare the similarities and / or differences between the actual texture features and the texture feature template to obtain a comparison result.
[0055] Step S240: determining the imaging stability of the image frame based on the comparison result, and obtaining an imaging stability detection result of the image frame.
[0056] The imaging stability of the image frame is determined based on the comparison result.
[0057] For example, if the comparison results show that the actual edge features and the edge feature templates have more similarities and / or fewer differences, the imaging stability of the image frame is higher; conversely, if the comparison results show that the actual edge features and the edge feature templates have fewer similarities and / or more differences, the imaging stability of the image frame is lower; or, if the comparison results show that the actual texture features and the texture feature templates have more similarities and / or fewer differences, the imaging stability of the image frame is higher; conversely, if the comparison results show that the actual texture features and the texture feature templates have fewer similarities and / or more differences, the imaging stability of the image frame is lower.
[0058] Among them, the imaging stability of the image frame can be indicated by a specific numerical value, and the higher the numerical value, the higher the imaging stability of the image frame; the imaging stability of the image frame can also be indicated by a level, and the higher the level, the higher the imaging stability of the image frame; the imaging stability of the image frame can also be indicated by whether the stability test is passed or not, such as if the imaging stability of the image frame is high, the imaging stability test result of the image frame is passed; if the imaging stability of the image frame is low, the imaging stability test result of the image frame is failed. The present application does not limit the specific form of expression of the imaging stability test result.
[0059] In some embodiments, based on the imaging stability test results of each image frame, image frames whose imaging stability meets preset conditions are screened for downstream image processing tasks, such as screening image frames whose imaging stability is higher than a preset value or image frames whose imaging stability test results are passed, so as to intercept low-quality image frames.
[0060] In some embodiments, image frames whose imaging stability does not meet preset conditions are regarded as abnormal image frames, and alarm information is generated based on the abnormal image frames. The alarm information includes but is not limited to one or more combinations of the acquisition time of the abnormal image frames, the number of abnormal image frames within a preset time period, and abnormal image content of the abnormal image frames. This application does not limit this.
[0061] Next, some embodiments of the present application are described in detail.
[0062] Embodiment 1: Comparing the actual edge feature with the edge feature template to obtain a comparison result, including: calculating the similarity between the actual edge feature and the edge feature template to obtain edge similarity; and using the edge similarity as the comparison result.
[0063] Exemplarily, the edge feature is converted into an embedded expression vector, and an actual edge feature vector and an edge feature template vector are obtained respectively. The vector distance between the actual edge feature vector and the edge feature template vector is calculated to obtain the edge similarity.
[0064] Furthermore, the imaging stability of the image frame is judged based on the comparison result to obtain the imaging stability detection result of the image frame, including: if the edge similarity is in a preset high threshold interval, then the imaging stability detection result of the image frame is judged to be passed; if the edge similarity is in a preset low threshold interval, then the imaging stability detection result of the image frame is judged to be failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0065] The higher the edge similarity between the actual edge feature vector and the edge feature template vector, the more complete the edge features of the target object in the image frame and the higher the imaging stability of the image frame. Therefore, if the edge similarity is in the preset high threshold range, the imaging stability test result of the image frame is judged to be passed; if the edge similarity is in the preset low threshold range, the imaging stability test result of the image frame is judged to be failed.
[0066] For example, the preset high threshold interval is [0.8, 1], and the preset low threshold interval is [0, 0.8).
[0067] Embodiment 2: An edge feature contains the number of breakpoints of an edge contour; comparing an actual edge feature with an edge feature template to obtain a comparison result, including: calculating the difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template to obtain a difference in the number of breakpoints; and using the difference in the number of breakpoints as the comparison result.
[0068] If a row of pixels is lost in the image, the edge of the target object in the image frame will be truncated, resulting in a large number of edge breakpoints.
[0069] The number of breakpoints of the edge contour of the target object in the actual edge feature is counted, and the number of breakpoints of the edge contour of the target object that can be extracted from the edge feature template extracted from the normal imaging image is counted.
[0070] The difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template is calculated to obtain the breakpoint number difference.
[0071] Furthermore, the imaging stability of the image frame is judged based on the comparison result to obtain the imaging stability detection result of the image frame, including: if the difference in the number of breakpoints is in a preset low threshold interval, then the imaging stability detection result of the image frame is judged to be passed; if the difference in the number of breakpoints is in a preset high threshold interval, then the imaging stability detection result of the image frame is judged to be failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0072] The smaller the difference in the number of breakpoints between the actual edge feature vector and the edge feature template vector, the more complete the edge features of the target object in the image frame and the higher the imaging stability of the image frame. Therefore, if the difference in the number of breakpoints is in the preset low threshold range, the imaging stability test result of the image frame is judged to be passed; if the difference in the number of breakpoints is in the preset high threshold range, the imaging stability test result of the image frame is judged to be failed.
[0073] For example, the preset low threshold interval is [0, 20], and the preset high threshold interval is (20, +∞).
[0074] Embodiment 3: Comparing the actual texture feature with the texture feature template to obtain a comparison result, including: calculating the similarity between the actual texture feature and the texture feature template to obtain texture similarity; and using the texture similarity as the comparison result.
[0075] Exemplarily, the texture feature is converted into an embedded expression vector, and an actual texture feature vector and a texture feature template vector are obtained respectively. The vector distance between the actual texture feature vector and the texture feature template vector is calculated to obtain the texture similarity.
[0076] Furthermore, the imaging stability of the image frame is judged based on the comparison result to obtain the imaging stability detection result of the image frame, including: if the texture similarity is in a preset high threshold interval, it is judged that the imaging stability detection result of the image frame is passed; if the texture similarity is in a preset low threshold interval, it is judged that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0077] The higher the texture similarity between the actual texture feature vector and the texture feature template vector, the more complete the texture features of the target object in the image frame and the higher the imaging stability of the image frame. Therefore, if the texture similarity is in the preset high threshold range, the imaging stability test result of the image frame is judged to be passed; if the texture similarity is in the preset low threshold range, the imaging stability test result of the image frame is judged to be failed.
[0078] For example, the preset high threshold interval is [0.7, 1], and the preset low threshold interval is [0, 0.7).
[0079] Embodiment 4: The texture feature contains the number of texture lines; comparing the actual texture feature and the texture feature template to obtain a comparison result, including: calculating the difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template to obtain a texture number difference; and using the texture number difference as the comparison result.
[0080] If a row of pixels is lost in the image, the texture of the target object in the image frame will be truncated, resulting in an increase in texture lines.
[0081] The number of texture lines of the target object in the actual texture features is counted, and the number of texture lines of the target object that can be extracted from the texture feature template extracted from the normal imaging image is counted.
[0082] The difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template is calculated to obtain a texture number difference.
[0083] Furthermore, the imaging stability of the image frame is judged based on the comparison result to obtain the imaging stability detection result of the image frame, including: if the texture quantity difference is in a preset low threshold interval, then the imaging stability detection result of the image frame is judged to be passed; if the texture quantity difference is in a preset high threshold interval, then the imaging stability detection result of the image frame is judged to be failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
[0084] The smaller the texture quantity difference between the actual texture feature vector and the texture feature template vector, the more complete the texture features of the target object in the image frame and the higher the imaging stability of the image frame. Therefore, if the texture quantity difference is in the preset low threshold range, the imaging stability test result of the image frame is judged to be passed; if the texture quantity difference is in the preset high threshold range, the imaging stability test result of the image frame is judged to be failed.
[0085] For example, the preset low threshold interval is [0, 100], and the preset high threshold interval is (100, +∞).
[0086] It should be noted that the preset high threshold interval and the preset low threshold interval in the above-mentioned embodiments can be set based on experience, or can be flexibly set according to actual application scenarios, such as flexibly setting the preset high threshold interval and the preset low threshold interval according to the image quality requirements of the downstream image processing task, the type of the target object, the light of the current image acquisition scene, etc. For example, the higher the image quality requirements of the downstream image processing task, the larger the minimum value of the preset high threshold interval corresponding to the edge similarity and texture similarity; the type of the target object indicates that the smoother the edge of the target object, the smaller the maximum value of the preset low threshold interval corresponding to the breakpoint number difference; the weaker the light of the previous image acquisition scene, the larger the maximum value of the preset low threshold interval corresponding to the texture number difference. This application does not limit this.
[0087] Embodiment 5: The actual edge features and edge feature templates may be compared from multiple dimensions, and / or the actual texture features and texture feature templates may be compared, and the imaging stability of the image frame may be comprehensively judged based on the comparison results from multiple dimensions.
[0088] Specifically, the similarity between the actual edge feature and the edge feature template is calculated to obtain the edge similarity; and / or, the difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template is calculated to obtain the breakpoint number difference; and / or, the similarity between the actual texture feature and the texture feature template is calculated to obtain the texture similarity; and / or, the difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template is calculated to obtain the texture number difference; the edge similarity, and / or the breakpoint number difference, and / or the texture similarity, and / or the texture number difference are taken as the comparison result.
[0089] The specific calculation process can be found in the above-mentioned embodiments 1 to 4, and this application will not go into details here.
[0090] Furthermore, the imaging stability of the image frame is judged based on the comparison result to obtain the imaging stability detection result of the image frame, including: scoring the image frame based on edge similarity to obtain an edge similarity score, and / or scoring the image frame based on the difference in the number of breakpoints to obtain a breakpoint number score, and / or scoring the image frame based on texture similarity to obtain a texture similarity score, and / or scoring the image frame based on the difference in the number of textures to obtain a texture number score; performing weighted summation of the edge similarity score, and / or the breakpoint number score, and / or the texture similarity score, and / or the texture number score to obtain an imaging stability score of the image frame; and using the imaging stability score as the imaging stability detection result of the image frame.
[0091] Among them, the edge similarity is directly proportional to the edge similarity score, the texture similarity is directly proportional to the texture similarity score, the difference in the number of breakpoints is inversely proportional to the number of breakpoints score, and the difference in the number of textures is inversely proportional to the number of textures score.
[0092] The edge similarity score, and / or the breakpoint quantity score, and / or the texture similarity score, and / or the texture quantity score are weightedly summed to obtain an imaging stability score of the image frame.
[0093] Among them, the weight parameters used in the weighted summation can be set based on experience or calculated flexibly. Of course, the weight parameters corresponding to the edge similarity score, and / or the breakpoint quantity score, and / or the texture similarity score, and / or the texture quantity score can also be flexibly calculated according to actual conditions.
[0094] For example, the weight parameters are flexibly set according to the type of the target object. For example, if the type of the target object indicates that the edge of the target object is smoother, the weight parameters corresponding to the edge similarity score and the breakpoint quantity score are larger; if the type of the target object indicates that the texture of the target object is more obvious, the weight parameters corresponding to the texture similarity score and the texture quantity score are larger.
[0095] In some embodiments, after obtaining edge similarity, and / or breakpoint number difference, and / or texture similarity, and / or texture number difference, if the edge similarity is in a preset low threshold interval, and / or the breakpoint number difference is in a preset high threshold interval, and / or the texture similarity is in a preset low threshold interval, and / or the texture number difference is in a preset high threshold interval, then it is judged that the imaging stability test result of the image frame is failed; if the edge similarity is in the preset high threshold interval, and the breakpoint number difference is in the preset low threshold interval, and the texture similarity is in the preset high threshold interval, and the texture number difference is in the preset low threshold interval, then it is judged that the imaging stability test result of the image frame is passed.
[0096] Since the image frame may contain one or more target objects, if there is one target object, the comparison result between the target object and the template can be directly used as the imaging stability detection result of the image frame. If there are multiple target objects, the step of obtaining the imaging stability detection result of the image frame may include:
[0097] The minimum value of the imaging stability scores of the target objects is selected as the imaging stability score of the image frame; alternatively, the imaging stability score of each target object is averaged to obtain the imaging stability score of the image frame; alternatively, if there is any target object whose edge similarity is in a preset low threshold interval, and / or the difference in the number of breakpoints is in a preset high threshold interval, and / or the texture similarity is in a preset low threshold interval, and / or the difference in the number of textures is in a preset high threshold interval, then it is determined that the imaging stability test result of the image frame is failed.
[0098] For example, the edge similarity score, and / or breakpoint quantity score, and / or texture similarity score, and / or texture quantity score of each target object are weightedly summed to obtain the final score of each target object; the final score with the smallest value is selected as the imaging stability score of the image frame, or the final score of each target object is weightedly summed to obtain the imaging stability score of the image frame.
[0099] The weight parameter used in the weighted sum calculation of the final score of each target object may be set based on experience or flexibly based on the actual scenario.
[0100] For example, according to the area of each target object in the image frame, the weight parameters used for weighted summation calculation of the final score of each target object are set respectively. The larger the area proportion of the target object in the image frame, the larger the weight parameter used for weighted summation calculation of the final score.
[0101] In some embodiments, the method also includes: calculating the average grayscale value of the image frame, and / or obtaining the image resolution of the image frame; judging the imaging stability of the image frame based on the comparison result, and the size relationship between the average grayscale value and a preset grayscale threshold and / or the size relationship between the image resolution and a preset resolution, to obtain an imaging stability detection result of the image frame.
[0102] Exemplarily, the mean of the grayscale values corresponding to each pixel of the image frame is calculated to obtain the average grayscale value of the image frame, and / or the length (number of pixel rows) and width (number of pixel columns) of the image frame are obtained to obtain the image resolution of the image frame.
[0103] Then, the imaging stability of the image frame is judged based on the comparison result, the size relationship between the average grayscale value and the preset grayscale threshold and / or the size relationship between the image resolution and the preset resolution, and the imaging stability detection result of the image frame is obtained.
[0104] For an example, see Figure 4 , Figure 4 A flowchart of an imaging stability detection method is shown as another exemplary embodiment of the present application. Figure 4 As shown, including:
[0105] Step S410: Acquire an image frame obtained by an image acquisition device performing image acquisition on a target object;
[0106] Step S420: comparing the actual edge features and / or actual texture features of the target object obtained by extracting the image frame with the edge feature template and / or texture feature template of the target object to obtain a comparison result;
[0107] Step S430: judging whether the image frame matches the template according to the comparison result, if it matches, executing step S440, if it does not match, executing step S460;
[0108] For example, if the edge similarity of the target object is within a preset low threshold interval, and / or the difference in the number of breakpoints is within a preset high threshold interval, and / or the texture similarity is within a preset low threshold interval, and / or the difference in the number of textures is within a preset high threshold interval, it is determined that the image frame does not match the template;
[0109] Step S440: determine whether the average gray value of the image frame is greater than a preset gray threshold, if not, execute step S450, if yes, execute step S470;
[0110] Step S450: determining whether the image resolution of the image frame is equal to the preset resolution, if so, proceeding to step S410, if not, proceeding to step S480;
[0111] Step S460: generating an image mismatch warning message;
[0112] Step S470: generating gray value abnormality warning information;
[0113] Step S480: Generate alarm information of resolution abnormality.
[0114] The imaging stability detection method provided by the present application obtains an image frame obtained by image acquisition of a target object, and obtains an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge feature and the texture feature of the target object in a normally imaged image; the edge feature and / or the texture feature of the target object in the image frame are extracted to obtain the actual edge feature and / or the actual texture feature corresponding to the target object; the actual edge feature and the edge feature template are compared, and / or the actual texture feature and the texture feature template are compared to obtain a comparison result; the imaging stability of the image frame is judged based on the comparison result to obtain an imaging stability detection result of the image frame, which can effectively and accurately identify image frames with abnormalities and improve the accuracy of imaging stability detection of image acquisition equipment.
[0115] Figure 5 FIG. 1 is a block diagram of an imaging stability detection device shown in an exemplary embodiment of the present application. Figure 5 As shown, the exemplary imaging stability detection device 500 includes:
[0116] The image and template acquisition module 510 is used to acquire an image frame obtained by acquiring an image of the target object, and to acquire an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge features and texture features of the target object in a normal imaging image;
[0117] A feature extraction module 520 is used to extract edge features and / or texture features of a target object in an image frame to obtain actual edge features and / or actual texture features corresponding to the target object;
[0118] The template comparison module 530 is used to compare the actual edge feature with the edge feature template, and / or compare the actual texture feature with the texture feature template to obtain a comparison result;
[0119] The stability judgment module 540 is used to judge the imaging stability of the image frame based on the comparison result, and obtain the imaging stability detection result of the image frame.
[0120] It should be noted that the imaging stability detection device provided in the above embodiment and the imaging stability detection method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In practical applications, the imaging stability detection device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0121] See also Figure 6 , Figure 6 6 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 600 includes a memory 601 and a processor 602, and the processor 602 is used to execute program instructions stored in the memory 601 to implement the steps in any of the above-mentioned imaging stability detection method embodiments. In a specific implementation scenario, the electronic device 600 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 600 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.
[0122] Specifically, the processor 602 is used to control itself and the memory 601 to implement the steps in any of the above-mentioned imaging stability detection method embodiments. The processor 602 may also be referred to as a central processing unit (CPU). The processor 602 may be an integrated circuit chip having signal processing capabilities. The processor 602 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 602 may be implemented by an integrated circuit chip.
[0123] See also Figure 7 , Figure 7 The computer-readable storage medium 700 stores program instructions 710 that can be executed by a processor, and the program instructions 710 are used to implement the steps in any of the above-mentioned imaging stability detection method embodiments.
[0124] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0125] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0126] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0127] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
Claims
1. An imaging stability detection method, characterized in that: The method comprises: Acquire an image frame obtained by performing image acquisition on a target object, and acquire an edge feature template and / or a texture feature template corresponding to the target object; wherein the edge feature template and the texture feature template refer to the edge feature and texture feature of the target object in a normal imaging image; Extracting edge features and / or texture features of the target object in the image frame to obtain actual edge features and / or actual texture features corresponding to the target object; Comparing the actual edge feature with the edge feature template, and / or comparing the actual texture feature with the texture feature template, to obtain a comparison result; The imaging stability of the image frame is judged based on the comparison result to obtain an imaging stability detection result of the image frame.
2. The method according to claim 1, characterized in that Comparing the actual edge feature with the edge feature template to obtain a comparison result includes: Calculating the similarity between the actual edge feature and the edge feature template to obtain edge similarity; Taking the edge similarity as a comparison result; The determining the imaging stability of the image frame based on the comparison result to obtain the imaging stability detection result of the image frame includes: If the edge similarity is within a preset high threshold range, it is determined that the imaging stability detection result of the image frame passes; If the edge similarity is in a preset low threshold interval, it is determined that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
3. The method according to claim 1, characterized in that The edge feature includes the number of breakpoints of the edge contour; comparing the actual edge feature with the edge feature template to obtain a comparison result, including: Calculating the difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template to obtain a breakpoint number difference; Taking the difference in the number of breakpoints as a comparison result; The determining the imaging stability of the image frame based on the comparison result to obtain the imaging stability detection result of the image frame includes: If the difference in the number of breakpoints is within a preset low threshold range, it is determined that the imaging stability test result of the image frame passes; If the difference in the number of breakpoints is within a preset high threshold interval, it is determined that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
4. The method according to claim 1, characterized in that: Comparing the actual texture feature with the texture feature template to obtain a comparison result includes: Calculating the similarity between the actual texture feature and the texture feature template to obtain texture similarity; Taking the texture similarity as a comparison result; The determining the imaging stability of the image frame based on the comparison result to obtain the imaging stability detection result of the image frame includes: If the texture similarity is within a preset high threshold range, it is determined that the imaging stability detection result of the image frame passes; If the texture similarity is in a preset low threshold interval, it is determined that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
5. The method according to claim 1, characterized in that The texture feature includes the number of texture lines; comparing the actual texture feature with the texture feature template to obtain a comparison result, including: Calculating the difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template to obtain a texture number difference; Taking the texture quantity difference as the comparison result; The determining the imaging stability of the image frame based on the comparison result to obtain the imaging stability detection result of the image frame includes: If the texture quantity difference is within a preset low threshold range, it is determined that the imaging stability detection result of the image frame passes; If the texture quantity difference is in a preset high threshold interval, it is determined that the imaging stability detection result of the image frame is failed; wherein the minimum value of the preset high threshold interval is greater than the maximum value of the preset low threshold interval.
6. The method according to claim 1, characterized in that The comparing the actual edge feature with the edge feature template, and / or comparing the actual texture feature with the texture feature template to obtain a comparison result, includes: Calculating the similarity between the actual edge feature and the edge feature template to obtain edge similarity; and / or, calculating a difference between the number of breakpoints of the edge contour in the actual edge feature and the number of breakpoints of the edge contour in the edge feature template to obtain a breakpoint number difference; and / or, calculating the similarity between the actual texture feature and the texture feature template to obtain texture similarity; and / or, calculating a difference between the number of texture lines in the actual texture feature and the number of texture lines in the texture feature template to obtain a texture number difference; Taking the edge similarity, and / or the breakpoint quantity difference, and / or the texture similarity, and / or the texture quantity difference as a comparison result; The determining the imaging stability of the image frame based on the comparison result to obtain the imaging stability detection result of the image frame includes: Scoring the image frame based on the edge similarity to obtain an edge similarity score, and / or scoring the image frame based on the breakpoint quantity difference to obtain a breakpoint quantity score, and / or scoring the image frame based on the texture similarity to obtain a texture similarity score, and / or scoring the image frame based on the texture quantity difference to obtain a texture quantity score; Performing weighted summation on the edge similarity score, and / or the breakpoint quantity score, and / or the texture similarity score, and / or the texture quantity score to obtain an imaging stability score of the image frame; The imaging stability score is used as an imaging stability detection result of the image frame.
7. The method according to claim 6, characterized in that The number of target objects contained in the image frame is multiple; the weighted sum of the edge similarity score, and / or the breakpoint quantity score, and / or the texture similarity score, and / or the texture quantity score is obtained to obtain the imaging stability score of the image frame, including: Performing weighted summation on the edge similarity score, and / or the breakpoint quantity score, and / or the texture similarity score, and / or the texture quantity score of each target object, respectively, to obtain a final score for each target object; The final score with the smallest value is selected as the imaging stability score of the image frame, or the final score of each target object is weightedly summed to obtain the imaging stability score of the image frame.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Calculating an average grayscale value of the image frame, and / or obtaining an image resolution of the image frame; The determining the imaging stability of the image frame based on the comparison result to obtain the imaging stability detection result of the image frame includes: Based on the comparison result, and the size relationship between the average grayscale value and the preset grayscale threshold and / or the size relationship between the image resolution and the preset resolution, the imaging stability of the image frame is judged to obtain the imaging stability detection result of the image frame.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the steps in the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and the program instructions can be executed by a processor to implement the steps in the method according to any one of claims 1 to 8.