A battery detection method and device, electronic equipment and storage medium

By automatically detecting battery status and power using image processing technology, the problem of low precision and low efficiency caused by manual observation in existing battery detection methods is solved, and high precision and high efficiency of intelligent battery detection is achieved.

CN115880510BActive Publication Date: 2026-02-24LCFC HEFEI ELECTRONICS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211445643.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2026-02-24
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

Existing battery testing methods require manual observation of the battery management page, resulting in high error rates, low accuracy, and low efficiency.

Method used

By acquiring the desktop background image and the image to be detected of the electronic device, image processing technology is used to determine the battery detection area, and the battery status and power are automatically detected based on the area, including steps such as image difference, grayscale processing, threshold segmentation and dilation processing.

Benefits of technology

It enables intelligent battery testing without human intervention, improving the accuracy and efficiency of battery testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115880510B_ABST
    Figure CN115880510B_ABST
Patent Text Reader

Abstract

The application provides a battery detection method and device, electronic equipment and storage medium; the method comprises the following steps: acquiring a desktop background image and a to-be-detected image of an electronic equipment; determining a battery detection area of the to-be-detected image based on the desktop background image and the to-be-detected image; and determining a detection result of a battery of the electronic equipment based on the battery detection area. In this way, the battery can be intelligently detected, and the accuracy and efficiency of battery detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to battery detection technology, and in particular to a battery detection method and device, an electronic device, and a storage medium. BACKGROUND

[0002] With the rapid development and wide use of battery detection technology, people gradually use battery detection technology for battery detection, which has become the mainstream of battery detection technology application. However, in the process of battery detection, the existing battery detection method needs manual observation of the battery management page of the electronic device, has a high error probability, and the accuracy and efficiency of the battery detection method are low, and people hope to improve the accuracy and efficiency of the battery detection method.

[0003] Therefore, how to intelligently detect the battery to improve the accuracy and efficiency of the battery detection is a long-term pursuit. SUMMARY

[0004] The present application provides a battery detection method and device, an electronic device, and a storage medium.

[0005] According to a first aspect of the present application, a battery detection method is provided, which comprises: acquiring a desktop background image and a to-be-detected image of an electronic device; determining a battery detection region of the to-be-detected image based on the desktop background image and the to-be-detected image; and determining a detection result of a battery of the electronic device based on the battery detection region.

[0006] According to an embodiment of the present application, the acquisition of the desktop background image and the to-be-detected image of the electronic device comprises: the to-be-detected image comprises a desktop image with a battery management interface when the electronic device is in a charging state and a desktop image with a battery management interface when the electronic device is in an uncharged state; the desktop background image, the to-be-detected image, and a standard state of the battery of the electronic device are acquired; the standard state of the electronic device in the charging state is a charging state; and the standard state of the electronic device in the uncharged state is an uncharged state.

[0007] According to an embodiment of the present application, the determination of the battery detection region of the to-be-detected image based on the desktop background image and the to-be-detected image comprises: subtracting the to-be-detected image from the desktop background image to determine a first region of the to-be-detected image; determining the contour number of the first region and the aspect ratio of the first region; and in response to the contour number of the first region satisfying a preset contour number threshold and the aspect ratio of the first region satisfying a preset first aspect ratio threshold, determining the first region as the battery detection region.

[0008] According to an embodiment of the present application, the determining the detection result of the battery of the electronic device comprises: in response to the number of contours of the first region not satisfying the preset number threshold of contours, determining that the detection result of the battery of the electronic device is power system damage; or in response to the aspect ratio of the first region not satisfying the preset first aspect ratio threshold, determining that the detection result of the battery of the electronic device is power system damage.

[0009] According to an embodiment of the present application, the determining the detection result of the battery of the electronic device based on the battery detection region comprises: cropping the to-be-detected image based on the battery detection region to determine a battery management interface image; performing grayscale processing on the battery management interface image to obtain a grayscale image; performing grayscale threshold segmentation on the grayscale image based on a first grayscale threshold to determine a binary image corresponding to the grayscale image; performing inflation processing on the binary image to determine an inflation image corresponding to the binary image; determining a battery state detection region and a battery capacity detection region in the inflation image; determining a state detection result of the battery of the electronic device based on the battery state detection region; and determining a capacity detection result of the battery of the electronic device based on the battery capacity detection region.

[0010] According to an embodiment of the present application, the determining the battery state detection region and the battery capacity detection region in the inflation image comprises: determining coordinate values of contours of each contour region in the inflation image; sorting each contour region in descending order of the coordinate values to determine an order of the contour regions; in response to the contour region being ranked at an Nth position in the order of the contour regions and an aspect ratio of the contour region satisfying a preset second aspect ratio threshold, determining that the contour region is the battery state detection region; wherein N is a positive integer, and the Nth position is a position of the battery state detection region in the order of the contour regions; and determining the battery capacity detection region based on the battery state detection region and the order of the contour regions.

[0011] According to an embodiment of the present application, the determining the state detection result of the battery of the electronic device based on the battery state detection region comprises: determining a number of convex hull vertexes of the contour in the battery state detection region; in response to the number of convex hull vertexes being equal to a preset number threshold of convex hull vertexes, determining that a current state of the battery of the electronic device is an uncharged state; in response to the number of convex hull vertexes being greater than the preset number threshold of convex hull vertexes, determining that the current state of the battery of the electronic device is a charged state; in response to the current state being the same as a standard state, determining that the state detection result of the battery is a normal state; and in response to the current state being different from the standard state, determining that the state detection result of the battery is an abnormal state.

[0012] According to an embodiment of the present application, the battery level detection area is used to determine the battery level detection result of the battery of the electronic device, including: performing digital recognition on the battery level detection area to determine the battery level value of the battery of the electronic device; in response to the battery level value meeting a preset battery level threshold, determining that the battery level detection result of the battery is normal; and in response to the battery level value not meeting the preset battery level threshold, determining that the battery level detection result of the battery is abnormal.

[0013] According to a second aspect of the present application, a battery detection device is provided, including: an acquisition module configured to acquire a desktop background image and a to-be-detected image of an electronic device; a determination module configured to determine a battery detection area of the to-be-detected image based on the desktop background image and the to-be-detected image; and a detection module configured to determine a detection result of a battery of the electronic device based on the battery detection area.

[0014] According to an embodiment of the present application, the to-be-detected image includes a desktop image with a battery management interface when the electronic device is in a charging state and a desktop image with a battery management interface when the electronic device is in a non-charging state, and the acquisition module is configured to: acquire the desktop background image, the to-be-detected image, and a standard state of the battery of the electronic device; the standard state of the electronic device in the charging state is a charging state; and the standard state of the electronic device in the non-charging state is a non-charging state.

[0015] According to an embodiment of the present application, the determination module is configured to: subtract the to-be-detected image from the desktop background image to determine a first area of the to-be-detected image; determine the contour number of the first area and the aspect ratio of the first area; and in response to the contour number of the first area meeting a preset contour number threshold and the aspect ratio of the first area meeting a preset first aspect ratio threshold, determine that the first area is the battery detection area.

[0016] According to an embodiment of the present application, the detection module is configured to: in response to the contour number of the first area not meeting the preset contour number threshold, determine that the detection result of the battery of the electronic device is power system damage; or in response to the aspect ratio of the first area not meeting the preset first aspect ratio threshold, determine that the detection result of the battery of the electronic device is power system damage.

[0017] According to an embodiment of the present application, the detection module is configured to: crop the to-be-detected image based on the battery detection area to obtain a battery management interface image; perform grayscale processing on the battery management interface image to obtain a grayscale image; perform grayscale threshold segmentation on the grayscale image based on a first grayscale threshold to obtain a binary image corresponding to the grayscale image; perform dilation processing on the binary image to obtain a dilated image corresponding to the binary image; determine a battery state detection area and a battery power detection area in the dilated image; determine a state detection result of the battery of the electronic device based on the battery state detection area; and determine a power detection result of the battery of the electronic device based on the battery power detection area.

[0018] According to an embodiment of the present application, the detection module is configured to: determine coordinate values of each contour area in the dilated image; sort each contour area in descending order of the coordinate values to determine an order of the contour areas; determine that a contour area is the battery state detection area in response to the contour area being ranked at an Nth position in the order of the contour areas and a length-width ratio of the contour area satisfying a preset second length-width ratio threshold; wherein N is a positive integer, and the Nth position is a preset position of the battery state detection area in the order of the contour areas; and determine the battery power detection area based on the battery state detection area and the order of the contour areas.

[0019] According to an embodiment of the present application, the detection module is configured to: determine a number of convex hull vertices of the contour in the battery state detection area; determine that a current state of the battery of the electronic device is an uncharged state in response to the number of convex hull vertices being equal to a preset number of convex hull vertex threshold; determine that the current state of the battery of the electronic device is a charged state in response to the number of convex hull vertices being greater than the preset number of convex hull vertex threshold; determine that the state detection result of the battery is a normal state in response to the current state being the same as a standard state; and determine that the state detection result of the battery is an abnormal state in response to the current state being different from the standard state.

[0020] According to an embodiment of the present application, the detection module is configured to: perform digital recognition on the battery power detection area to determine a power value of the battery of the electronic device; determine that the power detection result of the battery is power normal in response to the power value satisfying a preset power threshold; and determine that the power detection result of the battery is power abnormal in response to the power value not satisfying the preset power threshold.

[0021] According to a third aspect of the present application, an electronic device is provided, comprising:

[0022] at least one processor; and

[0023] a memory in communication with the at least one processor; wherein

[0024] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present application.

[0025] According to a fourth aspect of the present application, a non-transitory computer readable storage medium storing computer instructions is provided, the computer instructions being used to cause the computer to perform the method described in the present application.

[0026] The method of the embodiments of the present application acquires a desktop background image of an electronic device and a to-be-detected image; determines a battery detection area of the to-be-detected image based on the desktop background image and the to-be-detected image; and determines a detection result of a battery of the electronic device based on the battery detection area. In this way, the battery can be intelligently detected, and the accuracy and efficiency of battery detection are improved.

[0027] It should be understood that the teachings of the present application do not require all the beneficial effects described above to be achieved, but specific technical solutions can achieve specific technical effects, and other embodiments of the present application can also achieve beneficial effects not mentioned above. BRIEF DESCRIPTION OF DRAWINGS

[0028] The above and other objects, features and advantages of the exemplary embodiments of the present application will be more apparent from the following detailed description taken in conjunction with the accompanying drawings, in which:

[0029] In the drawings, identical or corresponding reference numerals indicate identical or corresponding parts.

[0030] Figure 1 A processing flow diagram of the battery detection method provided by the embodiments of the present application is shown Figure 1 ;

[0031] Figure 2 A processing flow diagram of the battery detection method provided by the embodiments of the present application is shown Figure 2 ;

[0032] Figure 3 A processing flow diagram of the battery detection method provided by the embodiments of the present application is shown Figure 3 ;

[0033] Figure 4 A processing flow diagram of the battery detection method provided by the embodiments of the present application is shown Figure 4 ;

[0034] Figure 5 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application; Figure 5

[0035] Figure 6 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application; Figure 6

[0036] Figure 7 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application;

[0037] Figure 8 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application;

[0038] Figure 9 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application;

[0039] Figure 10 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application;

[0040] Figure 11 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application;

[0041] Figure 12 Fig. 1 shows a processing flow diagram of a battery detection method provided by an embodiment of the present application; DETAILED DESCRIPTION

[0042] In order to make the objectives, characteristics and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.

[0043] In the following description, “some embodiments” are described, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0045] ​​Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0046] A convex hull is a finite set of points S on a given space R, and is a convex object consisting of a finite number of poles in the finite set of points S.

[0047] In related technologies, current known battery testing solutions require manual observation of the electronic device's battery management page, which carries a high probability of error, resulting in low accuracy and efficiency. The need for manual observation of battery information during battery testing in related technologies easily leads to misjudgments, resulting in low accuracy and efficiency.

[0048] The battery testing methods provided by related technologies require manual observation of battery information during the testing process, which can easily lead to misjudgments, resulting in low accuracy and efficiency. The method of this application addresses this issue by acquiring a desktop background image and a test image of an electronic device; determining a battery testing area in the test image based on the desktop background image and the test image; and determining the battery testing result of the electronic device based on the battery testing area. This intelligently detects the battery, improving both accuracy and efficiency. Therefore, compared to related technologies that require manual observation of battery information during testing, the battery testing method of this application eliminates the need for manual observation, thus improving accuracy and efficiency.

[0049] The processing flow of the battery detection method provided in the embodiments of this application will be described. See [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic diagram of the battery detection method provided in the embodiments of this application. Figure 1 , will combine Figure 2 Steps S101-S103 shown will be explained.

[0050] Step S101: Obtain the desktop background image and the image to be detected of the electronic device.

[0051] In some embodiments, the electronic device may include various forms of digital computers, such as laptops, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also include various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. Acquiring the desktop background image and the image to be detected of the electronic device may include acquiring the desktop background image, the image to be detected, and the standard state of the electronic device's battery. The desktop background image may include the entire desktop image after the electronic device is powered on. The image to be detected may include a desktop image with a battery management interface when the electronic device is charging and a desktop image with a battery management interface when the electronic device is not charging. The image to be detected has the same resolution as the desktop background image. The standard state of the electronic device when it is charging may include a charging state; the standard state of the electronic device when it is not charging may include a non-charging state.

[0052] Step S102: Based on the desktop background image and the image to be detected, determine the battery detection area of ​​the image to be detected.

[0053] In some embodiments, step S102 may include: subtracting the image to be detected from the desktop background image to determine a first region of the image to be detected; determining the contour count and aspect ratio of the first region; and determining the first region as a battery detection region in response to the first region having a contour count that meets a preset contour count threshold and an aspect ratio that meets a preset first aspect ratio threshold. The first region may include non-zero pixel regions.

[0054] The first region I of the image to be detected is determined by subtracting the image to be detected from the desktop background image. d1 and I d2 In specific implementation, it can be expressed by the following formulas (1) and (2).

[0055] I d1 =||I Fg1 -I Bg || (1)

[0056] I d2 =||I Fg2 -I Bg || (2)

[0057] Among them, I Bg As the desktop background image, I Fg1 For the image to be detected when the electronic device is charging, I Fg2 For the image to be detected when the electronic device is not charging, I d1I is the first region of the image to be detected when the electronic device is in a charging state. d2 The first region of the image to be detected is the electronic device in an uncharged state.

[0058] If the number of contours in the first region meets a preset contour number threshold and the aspect ratio of the first region meets a preset first aspect ratio threshold, then the first region is determined to be a battery detection region. In specific implementation, the preset contour number threshold may include: a pre-set maximum number of contours in the first region. The preset first aspect ratio threshold may include: a preset aspect ratio of the first region corresponding to the resolution of the image to be detected. If the number of contours in the first region is equal to the preset contour number threshold and the aspect ratio of the first region is equal to the preset first aspect ratio threshold, then the first region is determined to be a battery detection region.

[0059] As an example, the first region of image 1 to be detected has a contour count of 1 and an aspect ratio of 16:9. The first region of image 2 to be detected has a contour count of 1 and an aspect ratio of 2:4. Image 1 and image 2 to be detected have the same resolution, and the preset contour count threshold is 1. The preset first aspect ratio threshold is 16:9. If the contour count of the first region of image 1 to be detected is equal to the preset contour count threshold and the aspect ratio of the first region is equal to the preset first aspect ratio threshold, then the first region of image 1 to be detected is determined to be the battery detection region of image 1 to be detected; if the contour count of the first region of image 2 to be detected is equal to the preset contour count threshold, but the aspect ratio of the first region is not equal to the preset first aspect ratio threshold, then the first region of image 2 to be detected is not the battery detection region of image 2 to be detected.

[0060] Step S103: Based on the battery detection area, determine the detection result of the battery of the electronic device.

[0061] In some embodiments, the battery detection results may include: power system damage, status detection results, and power level detection results. The status detection results may include normal and abnormal states, and the power level detection results may include normal and abnormal power levels.

[0062] In specific implementation, determining the detection result of the battery of the electronic device may include: in response to the fact that the number of contours in the first region does not meet a preset contour number threshold, determining that the detection result of the battery of the electronic device is that the power system is damaged; or, in response to the fact that the aspect ratio of the first region does not meet a preset first aspect ratio threshold, determining that the detection result of the battery of the electronic device is that the power system is damaged.

[0063] As an example, electronic device 3 has a contour count of 2 in the first region of image 3 to be detected and an aspect ratio of 16:9. Electronic device 4 has a contour count of 1 in the first region of image 4 to be detected and an aspect ratio of 2:4. Image 3 and image 4 to be detected have the same resolution, and the preset contour count threshold is 1. The preset first aspect ratio threshold is 16:9. If the contour count of the first region of image 3 to be detected is greater than the preset contour count threshold, then the detection result of the battery of electronic device 3 is determined to be a power system failure; if the aspect ratio of the first region of image 4 to be detected is not equal to the preset first aspect ratio threshold, then the detection result of the battery of electronic device 4 is determined to be a power system failure.

[0064] Regarding step S103, in specific implementation, firstly, based on the battery detection area, the image to be detected is cropped to determine the battery management interface image. Then, the battery management interface image is processed in grayscale to obtain a grayscale image. Based on a first grayscale threshold, the grayscale image is segmented by grayscale threshold to determine the corresponding binarized image. The binarized image is dilated to determine the corresponding dilated image. The battery status detection area and battery power detection area in the dilated image are determined. Finally, based on the battery status detection area, the battery status detection result of the electronic device is determined, and based on the battery power detection area, the battery power detection result of the electronic device is determined. The first grayscale threshold may include a preset grayscale value; this embodiment does not limit the specific grayscale value.

[0065] In some embodiments, the outline and circumscribed rectangle of the battery detection region are determined, and the image to be detected is cropped according to the determined outline and circumscribed rectangle to obtain a battery management interface image. The battery management interface image is then subjected to grayscale processing to obtain a grayscale image. A grayscale threshold segmentation is performed on the grayscale image with a grayscale value of 200 to obtain a binarized image with a grayscale value greater than or equal to 200. The binarized image is then dilated to determine the corresponding dilated image. The battery status detection region and battery power detection region are determined within the dilated image. Finally, based on the battery status detection region, the battery status detection result of the electronic device is determined, and based on the battery power detection region, the battery power detection result of the electronic device is determined.

[0066] To determine the battery status detection region and battery power detection region in the dilated image, in specific implementation, the coordinate values ​​of the contours corresponding to each contour region in the dilated image are determined. The contour regions are then sorted from largest to smallest coordinate value to determine their order. A contour region that is the Nth position in the sequence of contour regions and whose aspect ratio meets a preset second aspect ratio threshold is determined as the battery status detection region. Finally, based on the order of the battery status detection region and the contour regions, the battery power detection region is determined. Here, N is a positive integer, and the Nth position represents the preset position of the battery status detection region in the sequence of contour regions. The preset second aspect ratio threshold can include: the aspect ratio of the battery status detection region corresponding to a preset resolution of the image to be detected. The aspect ratio of the contour region meeting the preset second aspect ratio threshold can include: the aspect ratio of the contour region being equal to the preset second aspect ratio threshold.

[0067] As an example, the preset battery state detection region is positioned as the first in the sequence of the contour regions. The dilated image C includes contour region 1, contour region 2, and contour region 3. The aspect ratio of contour region 1 is 5:2, the aspect ratio of contour region 2 is 3:2, and the aspect ratio of contour region 3 is 15:4. The preset second aspect ratio threshold is 5:2.

[0068] Using the lower right corner of the dilated image C as the origin O, the horizontal direction to the left is the positive x-axis, and the vertical direction upwards is the positive y-axis, establishing an xOy coordinate system. The coordinates of contour region 1 (30), contour region 2 (11), and contour region 3 (20) in the dilated image C are determined. These contour regions are then sorted from largest to smallest coordinate value, with contour region 1 as the first, contour region 3 as the second, and contour region 2 as the third. Contour region 1 is ranked first in the sequence, and its aspect ratio of 5:2 equals the preset second aspect ratio threshold of 5:2; therefore, contour region 1 is determined as the battery status detection region. Finally, based on the position of the battery status detection region, contour region 3 is identified as the contour region with the closest x-coordinate and the same y-coordinate as the battery status detection region. Contour region 3's aspect ratio of 15:4 equals the preset aspect ratio of the battery power detection region of 15:4; therefore, contour region 3 is determined as the battery power detection region.

[0069] To determine the battery status of an electronic device based on a battery status detection region, in specific implementation, the number of vertices of the convex hull of the contour in the battery status detection region is first determined. If the number of convex hull vertices equals a preset threshold, the current state of the battery is determined to be uncharged; if the number of convex hull vertices is greater than the preset threshold, the current state is determined to be charged. Finally, if the current state is the same as the standard state, the battery status detection result is determined to be normal; if the current state is different from the standard state, the battery status detection result is determined to be abnormal. The preset threshold for the number of convex hull vertices may include a preset number of convex hull vertices; this embodiment does not limit the specific number of convex hull vertices.

[0070] As an example, electronic device A is in a charging state, and its standard state is charging. The preset threshold for the number of convex hull vertices is 6. The number of convex hull vertices in the contour of the battery state detection region corresponding to electronic device A is determined to be 10. Since the number of convex hull vertices corresponding to electronic device A is 10, which is greater than the preset threshold of 6, the current state of the battery of electronic device A is determined to be charging. The current state of the battery of electronic device A is the same as the standard state, both being charging, so the state detection result of the battery of electronic device A is determined to be normal.

[0071] Regarding the determination of battery power detection results for electronic devices based on a battery power detection area, in specific implementation, firstly, digital recognition is performed on the battery power detection area to determine the battery power value of the electronic device. In response to the power value meeting a preset power threshold, the battery power detection result is determined to be normal; in response to the power value not meeting the preset power threshold, the battery power detection result is determined to be abnormal. The preset power threshold may include: a preset minimum power value that can determine the battery power detection result as normal; this application embodiment does not limit the specific power value. A power value meeting the preset power threshold may include: a power value greater than or equal to the preset power threshold. A power value not meeting the preset power threshold may include: a power value less than the preset power threshold. Digital recognition may include: OCR (optical character recognition). Digital recognition may also include other digital recognition methods, which are not limited in this application embodiment.

[0072] As an example, electronic device B is in an uncharged state. The preset battery level threshold is 70%. OCR is performed on the battery level detection area corresponding to electronic device B, determining that the battery level of electronic device B is 80%. Since the battery level of electronic device B is 80%, which is greater than the preset battery level threshold of 70%, the battery level detection result for electronic device B is determined to be normal.

[0073] In some embodiments, the processing flow of the battery detection method is illustrated. Figure 2 ,like Figure 3 As shown, it includes:

[0074] Step S201: Subtract the image to be detected from the desktop background image to determine the first region of the image to be detected.

[0075] Step S202: Determine the outline number of the first region and the aspect ratio of the first region.

[0076] The specific explanations for steps S201 and S202, which involve subtracting the image to be detected from the desktop background image to determine the first region of the image to be detected, and further determining the contour count and aspect ratio of the first region, are the same as those for step S102 above, and will not be repeated here.

[0077] Following step S202, in specific implementations, the battery detection method may include determining whether the number of contours in the first region is equal to a preset contour number threshold, and determining whether the aspect ratio of the first region is equal to a preset first aspect ratio threshold.

[0078] In step S203a, in response to the fact that the number of contours in the first region meets a preset contour number threshold and the aspect ratio of the first region meets a preset first aspect ratio threshold, the first region is determined to be a battery detection region.

[0079] In step S203b, in response to the fact that the number of contours in the first region does not meet the preset contour number threshold, the detection result of the battery of the electronic device is determined to be a power system failure.

[0080] In step S203c, in response to the fact that the aspect ratio of the first region does not meet the preset first aspect ratio threshold, the detection result of the battery of the electronic device is determined to be a power system failure.

[0081] Regarding steps S203a-S203c, in specific implementation, when the number of contours in the first region of the image to be detected is equal to a preset contour number threshold and the aspect ratio of the first region is equal to a preset first aspect ratio threshold, the first region of the image to be detected is determined to be the battery detection region of the image to be detected. When the number of contours in the first region of the image to be detected is not equal to the preset contour number threshold and the aspect ratio of the first region is not equal to the preset first aspect ratio threshold, the detection result of the battery of the electronic device is determined to be a power system failure.

[0082] In some embodiments, the processing flow of the battery detection method is illustrated. Figure 3 ,like Figure 4 As shown, it includes:

[0083] Step S301: Based on the battery detection area, crop the image to be detected to determine the battery management interface image.

[0084] Step S302: Perform grayscale processing on the battery management interface image to obtain a grayscale image.

[0085] Step S303: Based on the first grayscale threshold, perform grayscale threshold segmentation on the grayscale image to determine the binarized image corresponding to the grayscale image.

[0086] Step S304: Perform dilation processing on the binarized image to determine the dilated image corresponding to the binarized image.

[0087] For the battery detection region in steps S301-S304, the image to be detected is cropped to determine the battery management interface image. The specific description of performing grayscale processing, grayscale threshold segmentation, and dilation processing on the battery management interface image to determine the dilated image is the same as that in step S103 above, and will not be repeated here.

[0088] Step S305: Determine the battery status detection area and battery power detection area in the dilatation image.

[0089] Step S306: Based on the battery status detection area, determine the battery status detection result of the electronic device.

[0090] Step S307: Based on the battery power detection area, determine the battery power detection result of the electronic device.

[0091] Regarding steps S305-S307, in specific implementations, the battery status detection area may include: the battery icon in the inflated image. Specifically, the number of vertices of the convex hull of the battery icon is 6 when the electronic device is not charging, and greater than 6 when the electronic device is charging. The battery power detection area may include: the power value icon to the right of the battery icon. The aspect ratio of the battery power detection area can be 1.5 times that of the battery status detection area. The current power value of the electronic device can be determined by digital recognition of the battery power detection area.

[0092] In some embodiments, the processing flow of the battery detection method is illustrated. Figure 4 ,like Figure 5 As shown, it includes:

[0093] Step S401: Determine the coordinate values ​​of the contours corresponding to each contour region in the dilated image.

[0094] Step S402: Sort each contour region according to its coordinate values ​​from largest to smallest to determine the order of the contour regions.

[0095] In step S403, in response to the fact that the contour region is the Nth position in the sequence of contour regions and the aspect ratio of the contour region meets the preset second aspect ratio threshold, the contour region is determined to be the battery state detection region.

[0096] Step S404: Determine the battery power detection area based on the order of the battery state detection area and the contour area.

[0097] The specific explanation of the steps S401-S404 for determining the battery state detection region and battery power detection region in the dilatation image is the same as that of step S103 above, and will not be repeated here.

[0098] In some embodiments, the processing flow of the battery detection method is illustrated. Figure 5 ,like Figure 6 As shown, it includes:

[0099] Step S501: Determine the number of convex hull vertices of the contour in the battery state detection area.

[0100] Following step S501, in specific implementations, the battery detection method may include determining the current state of the electronic device's battery based on the number of convex hull vertices and a preset threshold for the number of convex hull vertices.

[0101] Step S502: In response to the number of convex hull vertices being equal to a preset threshold for the number of convex hull vertices, the current state of the battery of the electronic device is determined to be an uncharged state.

[0102] Step S503: In response to the number of convex hull vertices being greater than a preset threshold for the number of convex hull vertices, the current state of the battery of the electronic device is determined to be a charging state.

[0103] Prior to step S504a, in specific implementation, the battery detection method may include: determining whether the current state is the same as the standard state.

[0104] Step S504a: In response to the current state being the same as the standard state, the battery state detection result is determined to be in a normal state.

[0105] Step S504b: In response to the difference between the current state and the standard state, the battery state detection result is determined to be an abnormal state.

[0106] As an example, regarding steps S501-S504b, in specific implementation, electronic device D is in a charging state, and its standard state is charging. The preset threshold for the number of convex hull vertices is 6. It is determined that the number of convex hull vertices in the contour of the battery state detection region corresponding to electronic device D is 6. Since the number of convex hull vertices 6 for electronic device D is equal to the preset threshold for the number of convex hull vertices 6, the current state of the battery of electronic device D is determined to be an uncharged state. Since the current state of the battery of electronic device D is different from the standard state, the state detection result of the battery of electronic device D is determined to be an abnormal state.

[0107] The specific descriptions of the number of convex hull vertices, the preset threshold for the number of convex hull vertices, the current state, and the standard state of the contour in steps S501-S504b are the same as those in step S103 above, and will not be repeated here.

[0108] In some embodiments, the processing flow of the battery detection method is illustrated. Figure 6 ,like Figure 7 As shown, it includes:

[0109] Step S601: Perform digital recognition on the battery power detection area to determine the battery power value of the electronic device.

[0110] Prior to step S602a, in specific implementation, the battery detection method may include: determining whether the battery level is greater than or equal to a preset battery level threshold.

[0111] In step S602a, in response to the battery level value meeting the preset battery level threshold, the battery level detection result is determined to be normal.

[0112] In step S602b, in response to the battery level not meeting the preset battery level threshold, the battery level detection result is determined to be abnormal.

[0113] Regarding steps S602a and S602b, in specific implementation, if the battery level is greater than or equal to a preset battery level threshold, the battery level detection result is determined to be normal. If the battery level is less than the preset battery level threshold, the battery level detection result is determined to be abnormal.

[0114] Figure 7 Image 1 shows the battery management interface of the battery detection method provided in this application embodiment.

[0115] refer to Figure 7 , Figure 8 Image of the battery management interface of a laptop when it is not charging.

[0116] Figure 8 Image 2 shows the battery management interface of the battery detection method provided in this application embodiment.

[0117] refer to Figure 8 , Figure 9 Image of the battery management interface of a laptop when it is charging.

[0118] Figure 9 This diagram illustrates an application scenario of the battery detection method provided in an embodiment of this application.

[0119] refer to Figure 9 This application provides a battery testing method for a laptop computer. The laptop is pre-installed with information processing software. A robotic arm, based on insertion / removal process information, inserts or removes the power adapter in the order specified in the insertion / removal process information. The information processing software reads the insertion / removal information and process information of the laptop's charging port in real time and determines the standard state of the image to be tested and the battery based on this information. The standard state when the laptop is charging is defined as the charging state; the standard state when the laptop is not charging is defined as the non-charging state.

[0120] The information processing software sends the image to be detected and the standard state of the battery to the algorithm processing software on the computer running the algorithm. The algorithm processing software, based on the image and the standard state of the battery, determines whether the current state of the laptop's battery is the same as the standard state, thus determining the battery's state detection result and its battery level detection result. Finally, the algorithm processing software sends the state detection result and battery level detection result back to the information processing software. The information processing software then displays the state detection result and battery level detection result on the display screen of the laptop being tested.

[0121] Understandable. Figure 9 The application scenarios of the battery detection method described in this application are only some exemplary implementations. The application scenarios of the battery detection method in this application include, but are not limited to, those described in the embodiments of this application. Figure 10 The application scenarios of the battery testing method shown are illustrated.

[0122] Figure 10 This diagram illustrates another application scenario of the battery detection method provided in this application embodiment.

[0123] refer to Figure 10 This application provides a battery detection method for a laptop computer, where the detection software receives the battery's standard state, an image to be detected, and a desktop background image. The standard state of the laptop computer when it is charging is defined as the charging state; the standard state of the laptop computer when it is not charging is defined as the non-charging state. The difference between the image to be detected and the desktop background image is calculated to determine the non-zero pixel areas of the image to be detected.

[0124] Determine the outline count and aspect ratio of the non-zero pixel region. Check if the outline count of the non-zero pixel region is equal to 1 and if the aspect ratio of the non-zero pixel region meets a first aspect ratio threshold. If the outline count of the non-zero pixel region is equal to 1 and the aspect ratio of the non-zero pixel region is equal to the preset first aspect ratio threshold, the non-zero pixel region is determined as the battery detection region of the image to be detected, and the battery management interface image is cropped according to the outline of the battery detection region. If the outline count of the non-zero pixel region is not equal to 1, the detection result of the laptop battery is determined to be a power system failure. If the aspect ratio of the non-zero pixel region is not equal to the preset first aspect ratio threshold, the detection result of the electronic device battery is determined to be a power system failure.

[0125] The battery management interface image is processed using grayscale processing, grayscale thresholding, and dilation to determine the corresponding dilated image. The battery status detection region and battery charge detection region within the dilated image are then identified.

[0126] Next, the number of vertices of the convex hull of the contour in the battery status detection area is determined. It is then checked whether the number of convex hull vertices meets a preset threshold. If it does, the current state of the electronic device's battery is determined to be uncharged; otherwise, the current state is determined to be charged. Then, it is checked whether the current state is the same as the standard state. If the current state is the same as the standard state, the battery status detection result is determined to be normal; if the current state is different from the standard state, the battery status detection result is determined to be abnormal. Abnormal states also indicate power system damage.

[0127] The battery power detection area is digitally identified to determine the battery power level of the electronic device. It is then determined whether the power level is greater than or equal to a preset power threshold. If the power level is greater than or equal to the preset power threshold, the battery power detection result is determined to be normal; if the power level is less than the preset power threshold, the battery power detection result is determined to be abnormal. The battery detection results for a laptop can include: status detection results and power level detection results. The status detection results can include: power system damage and normal status. The power level detection results can include: normal power level and abnormal power level.

[0128] Understandable. Figure 10 The application scenarios of the battery detection method described in this application are only some exemplary implementations. The application scenarios of the battery detection method in this application include, but are not limited to, those described in the embodiments of this application. Figure 11 The application scenarios of the battery testing method shown are illustrated.

[0129] The method in this embodiment of the application subtracts the image to be detected from the desktop background image to determine a first region of the image to be detected; determines the contour count and aspect ratio of the first region; and determines the first region as a battery detection region if the contour count of the first region meets a preset contour count threshold and the aspect ratio of the first region meets a preset first aspect ratio threshold. This allows the use of a software algorithm for battery detection, saving labor costs and improving the accuracy and efficiency of battery detection. The method in this embodiment of the application also determines a battery status detection region and a battery power detection region in a dilated image. This allows simultaneous detection of the laptop's battery status and battery power, saving labor costs and improving the accuracy and efficiency of battery detection. The method in this embodiment of the application determines the battery status detection result of an electronic device based on the battery status detection region and the battery power detection result of an electronic device based on the battery power detection region. This allows automatic determination of the laptop's battery status and battery power, with low requirements for physical hardware, strong adaptability, and reduced labor costs, thereby improving the accuracy and efficiency of battery detection.

[0130] Therefore, compared with the battery testing methods in related technologies that require manual observation of battery information during the battery testing process, the battery testing method of this application does not require manual observation of battery information, thereby improving the accuracy and efficiency of battery testing.

[0131] The following description continues to illustrate the exemplary structure of the battery detection device 90 provided in the embodiments of this application as a software module. In some embodiments, such as... Figures 1 to 11 As shown, the software modules in the battery detection device 90 may include: an acquisition module 901, used to acquire a desktop background image of the electronic device and an image to be detected; a determination module 902, used to determine the battery detection area of ​​the image to be detected based on the desktop background image and the image to be detected; and a detection module 903, used to determine the detection result of the battery of the electronic device based on the battery detection area.

[0132] In some embodiments, the image to be detected may include a desktop image with a battery management interface when the electronic device is charging and a desktop image with a battery management interface when the electronic device is not charging. In the process of acquiring the desktop background image and the image to be detected, the acquisition module 901 is specifically used to: acquire the desktop background image, the image to be detected, and the standard state of the battery of the electronic device; the standard state when the electronic device is charging is the charging state; the standard state when the electronic device is not charging is the not charging state.

[0133] In some embodiments, the determining module 902, in the process of determining the battery detection region of the image to be detected based on the desktop background image and the image to be detected, is specifically used to: subtract the image to be detected from the desktop background image to determine a first region of the image to be detected; determine the number of contours and the aspect ratio of the first region; and determine the first region as the battery detection region in response to the fact that the number of contours of the first region meets a preset contour number threshold and the aspect ratio of the first region meets a preset first aspect ratio threshold.

[0134] In some embodiments, the detection module 903, in determining the detection result of the battery of the electronic device, is specifically used to: determine that the detection result of the battery of the electronic device is a power system failure if the contour number of the first region does not meet a preset contour number threshold; or, determine that the detection result of the battery of the electronic device is a power system failure if the aspect ratio of the first region does not meet a preset first aspect ratio threshold.

[0135] In some embodiments, the detection module 903, in determining the battery detection result of the electronic device based on the battery detection region, specifically performs the following steps: cropping the image to be detected based on the battery detection region to determine a battery management interface image; performing grayscale processing on the battery management interface image to obtain a grayscale image; performing grayscale threshold segmentation on the grayscale image based on a first grayscale threshold to determine a binarized image corresponding to the grayscale image; performing dilation processing on the binarized image to determine a dilated image corresponding to the binarized image; determining the battery status detection region and the battery power detection region in the dilated image; determining the battery status detection result of the electronic device based on the battery status detection region; and determining the battery power detection result of the electronic device based on the battery power detection region.

[0136] In some embodiments, the detection module 903, in determining the battery status detection region and the battery power detection region in the dilated image, is specifically used to: determine the coordinate values ​​of the contours corresponding to each contour region in the dilated image; sort the contour regions according to their coordinate values ​​from largest to smallest to determine the order of the contour regions; in response to a contour region being the Nth position in the order of contour regions and the aspect ratio of the contour region satisfying a preset second aspect ratio threshold, then the contour region is determined to be the battery status detection region; where N is a positive integer, and the Nth position is the preset position of the battery status detection region in the order of contour regions; and determine the battery power detection region based on the order of the battery status detection region and the contour regions.

[0137] In some embodiments, during the process of determining the battery status detection result of the electronic device based on the battery status detection region, the detection module 903 is specifically used to: determine the number of convex hull vertices of the contour in the battery status detection region; determine that the current state of the battery of the electronic device is an uncharged state in response to the number of convex hull vertices being equal to a preset threshold number of convex hull vertices; determine that the current state of the battery of the electronic device is a charging state in response to the number of convex hull vertices being greater than the preset threshold number of convex hull vertices; determine that the battery status detection result is a normal state in response to the current state being the same as the standard state; and determine that the battery status detection result is an abnormal state in response to the current state being different from the standard state.

[0138] In some embodiments, the detection module 903, in the process of determining the battery power detection result of the electronic device based on the battery power detection area, is specifically used to: perform digital recognition on the battery power detection area to determine the battery power value of the electronic device; determine the battery power detection result as normal power in response to the power value meeting a preset power threshold; and determine the battery power detection result as abnormal power in response to the power value not meeting the preset power threshold.

[0139] It should be noted that the description of the device in this application embodiment is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, therefore it will not be repeated. For any technical details not covered in the battery detection device provided in this application embodiment, please refer to... Figure 12 The meaning is understood in accordance with the description of any of the accompanying drawings.

[0140] According to embodiments of this application, this application also provides an electronic device and a non-transitory computer-readable storage medium.

[0141] Figure 12 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of this application is shown. The electronic 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 electronic device may also represent various forms of mobile devices, such as personal digital processors, 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 application described and / or claimed herein.

[0142] like ​As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0143] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0144] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 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 801 performs the various methods and processes described above, such as the battery detection method. For example, in some embodiments, the battery detection method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the battery detection method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the battery detection method by any other suitable means (e.g., by means of firmware).

[0145] 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.

[0146] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may 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 functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0147] In the context of this application, 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 be, but is 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.

[0148] 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).

[0149] 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 embodiments 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.

[0150] 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.

[0151] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0152] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0153] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A battery testing method, characterized in that, The method includes: Acquire the desktop background image and the image to be detected of the electronic device; the image to be detected includes the desktop image of the electronic device with a battery management interface when the electronic device is charging and the desktop image of the electronic device with a battery management interface when the electronic device is not charging. The first region of the image to be detected is determined by subtracting the image to be detected from the desktop background image. Determine the outline number and aspect ratio of the first region; If the number of contours in the first region meets a preset contour number threshold and the aspect ratio of the first region meets a preset first aspect ratio threshold, then the first region is determined to be the battery detection region. Based on the battery detection area, the image to be detected is cropped to determine the battery management interface image; Determine the battery status detection region and battery power detection region in the dilatation image corresponding to the battery management interface image; Based on the battery status detection area, the battery status detection result of the electronic device is determined; Based on the battery power detection area, the battery power detection result of the electronic device is determined.

2. The method according to claim 1, characterized in that, The acquisition of the desktop background image and the image to be detected of the electronic device includes: Obtain the desktop background image, the image to be detected, and the standard state of the battery of the electronic device; The standard state in which the electronic device is in a charging state is the charging state; The standard state in which the electronic device is in an uncharged state is the uncharged state.

3. The method according to claim 1, characterized in that, The method further includes: If the number of contours in the first region does not meet the preset contour number threshold, the detection result of the battery of the electronic device is determined to be a power system failure. Alternatively, in response to the fact that the aspect ratio of the first region does not meet the preset first aspect ratio threshold, the detection result of the battery of the electronic device is determined to be that the power system is damaged.

4. The method according to claim 1, characterized in that, The process of determining the battery status detection region and battery power detection region in the dilated image corresponding to the battery management interface image includes: The battery management interface image is processed into a grayscale image. Based on a first grayscale threshold, the grayscale image is segmented by grayscale threshold to determine the binarized image corresponding to the grayscale image; The binarized image is dilated to determine the dilated image corresponding to the binarized image; Determine the battery status detection region and battery power detection region in the inflation image.

5. The method according to claim 4, characterized in that, Determining the battery status detection region and battery power detection region in the dilated image includes: Determine the coordinate values ​​of the contours corresponding to each contour region in the dilated image; The contour regions are sorted in descending order of their coordinate values ​​to determine their order. In response to the Nth position of the contour region in the order of the contour regions and the aspect ratio of the contour region satisfying a preset second aspect ratio threshold, the contour region is determined to be the battery state detection region; where N is a positive integer, and the Nth position is the preset position of the battery state detection region in the order of the contour regions; The battery power detection area is determined based on the order of the battery state detection area and the contour area.

6. The method according to claim 4, characterized in that, The step of determining the battery status detection result of the electronic device based on the battery status detection area includes: Determine the number of convex hull vertices of the contour in the battery state detection region; In response to the number of convex hull vertices being equal to a preset threshold for the number of convex hull vertices, the current state of the battery of the electronic device is determined to be an uncharged state. In response to the number of convex hull vertices being greater than a preset threshold for the number of convex hull vertices, the current state of the battery of the electronic device is determined to be a charging state; In response to the fact that the current state is the same as the standard state, the state detection result of the battery is determined to be a normal state; In response to the difference between the current state and the standard state, the state detection result of the battery is determined to be an abnormal state.

7. The method according to claim 4, characterized in that, The determination of the battery power detection result of the electronic device based on the battery power detection area includes: The battery power detection area is digitally identified to determine the battery power value of the electronic device. In response to the battery level value meeting a preset battery level threshold, the battery level detection result is determined to be normal. In response to the battery level not meeting the preset battery level threshold, the battery level detection result is determined to be abnormal.

8. A battery testing device, characterized in that, The battery testing device includes: The acquisition module is used to acquire the desktop background image and the image to be detected of the electronic device; the image to be detected includes the desktop image of the electronic device with a battery management interface when the electronic device is charging and the desktop image of the electronic device with a battery management interface when the electronic device is not charging. The determining module is used to subtract the image to be detected from the desktop background image to determine a first region of the image to be detected; determine the number of contours and the aspect ratio of the first region; and determine the first region as the battery detection region if the number of contours of the first region meets a preset contour number threshold and the aspect ratio of the first region meets a preset first aspect ratio threshold. The detection module is used to crop the image to be detected based on the battery detection area to determine the battery management interface image; determine the battery status detection area and the battery power detection area in the dilated image corresponding to the battery management interface image; determine the battery status detection result of the electronic device based on the battery status detection area; and determine the battery power detection result of the electronic device based on the battery power detection area.

9. The apparatus according to claim 8, characterized in that, The acquisition module is used for: The standard states of the desktop background image, the image to be detected, and the battery of the electronic device are obtained; the standard state when the electronic device is in a charging state is the charging state; the standard state when the electronic device is in a non-charging state is the non-charging state.

10. The apparatus according to claim 8, characterized in that, The detection module is used for: If the number of contours in the first region does not meet the preset contour number threshold, the detection result of the battery of the electronic device is determined to be a power system failure. Alternatively, in response to the fact that the aspect ratio of the first region does not meet the preset first aspect ratio threshold, the detection result of the battery of the electronic device is determined to be a power system failure.

11. The apparatus according to claim 8, characterized in that, The detection module is used for: The battery management interface image is processed into a grayscale image. Based on a first grayscale threshold, the grayscale image is segmented by grayscale threshold to determine the binarized image corresponding to the grayscale image; The binarized image is dilated to determine the dilated image corresponding to the binarized image; Determine the battery status detection region and battery power detection region in the inflation image.

12. The apparatus according to claim 11, characterized in that, The detection module is used for: Determine the coordinate values ​​of the contours corresponding to each contour region in the dilated image; The contour regions are sorted in descending order of their coordinate values ​​to determine their order. In response to the Nth position of the contour region in the order of the contour regions and the aspect ratio of the contour region satisfying a preset second aspect ratio threshold, the contour region is determined to be the battery state detection region; where N is a positive integer, and the Nth position is the preset position of the battery state detection region in the order of the contour regions; The battery power detection area is determined based on the order of the battery state detection area and the contour area.

13. The apparatus according to claim 11, characterized in that, The detection module is used for: Determine the number of convex hull vertices of the contour in the battery state detection region; In response to the number of convex hull vertices being equal to a preset threshold for the number of convex hull vertices, the current state of the battery of the electronic device is determined to be an uncharged state. In response to the number of convex hull vertices being greater than a preset threshold for the number of convex hull vertices, the current state of the battery of the electronic device is determined to be a charging state; In response to the fact that the current state is the same as the standard state, the state detection result of the battery is determined to be a normal state; In response to the difference between the current state and the standard state, the state detection result of the battery is determined to be an abnormal state.

14. The apparatus according to claim 11, characterized in that, The detection module is used for: The battery power detection area is digitally identified to determine the battery power value of the electronic device. In response to the battery level value meeting a preset battery level threshold, the battery level detection result is determined to be normal. In response to the battery level not meeting the preset battery level threshold, the battery level detection result is determined to be abnormal.

15. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.

16. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • RTC battery detection method and device, electronic equipment and storage medium

    CN112180257A

  • Pole piece area detection method, system and device, medium and defect detection method

    CN115063421A