Battery string area detection method, device and equipment
By mapping the image to be detected to a one-dimensional target image, the start and end positions of the battery string region are determined, solving the problem of inaccurate segmentation of the battery string region in the prior art, and realizing accurate segmentation and efficient defect detection of the battery string region.
Patent Information
- Application Number
- CN202511695489.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-17
AI Technical Summary
Existing technologies cannot accurately segment cell string regions, resulting in low accuracy and efficiency in photovoltaic module defect detection.
By mapping the image to be detected to a one-dimensional target image, the start and end positions of the battery string region are determined and converted into positions in the image to be detected, thereby accurately segmenting the battery string region.
It achieves accurate and reliable segmentation of battery string regions, improves the accuracy and efficiency of defect detection, and adapts to battery string morphology extraction under complex working conditions.
Smart Images

Figure CN121544555A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine vision technology, and in particular to a method, apparatus and equipment for detecting battery string regions. Background Technology
[0002] In photovoltaic (PV) module manufacturing, the cell string is the core component. The integrity of the cell string directly affects the output power and lifespan of the PV module. Missing defects such as microcracks and poor soldering will accelerate the power degradation of the PV module and trigger systemic risks such as hot spot effects. Therefore, it is necessary to use methods such as machine vision inspection to detect defects in the cell string. The prerequisite for defect detection is the accurate segmentation of the cell string area, allowing for defect detection using machine vision and other methods within that area.
[0003] For example, suppose a battery string consists of 15 cells. Cells 1-15 form battery string 1, cells 16-30 form battery string 2, and so on. Therefore, it's necessary to precisely segment the battery string region of battery string 1 so that it completely includes cells 1-15 and excludes other cells. Similarly, it's necessary to precisely segment the battery string region of battery string 2 so that it completely includes cells 16-30 and excludes other cells, and so on.
[0004] However, there is no effective way to accurately segment the battery string region. Problems such as inaccurate segmentation of the battery string region exist, which in turn lead to the inability to complete defect detection. Summary of the Invention
[0005] This application provides a method for detecting a battery string region, the method comprising: Obtain the image of the target battery string to be detected; A one-dimensional target image of the target battery string is generated based on the image to be detected, and the first start position and the first end position of the battery string region of the target battery string are determined from the one-dimensional target image; The first start position and the first end position are converted into a second start position and a second end position in the image to be detected, and the battery string region corresponding to the target battery string is determined from the image to be detected based on the second start position and the second end position.
[0006] This application provides a detection device for a battery string region, the device comprising: The acquisition module is used to acquire the image to be detected of the target battery string; The generation module is used to generate a one-dimensional target image of the target battery string based on the image to be detected; The determining module is used to determine the first starting position and the first ending position of the battery string region of the target battery string from the one-dimensional target image. The processing module is configured to convert the first starting position and the first ending position into a second starting position and a second ending position in the image to be detected, and to determine the battery string region corresponding to the target battery string from the image to be detected based on the second starting position and the second ending position.
[0007] This application provides an electronic device, including: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the battery string region detection method of the above example of this application.
[0008] This application provides a computer program product, which includes a computer program that, when executed by a processor, implements the battery string region detection method of the above example of this application.
[0009] This application provides a machine-readable storage medium storing machine-executable instructions that can be executed by a processor; wherein the processor is configured to execute the machine-executable instructions to implement the battery string region detection method of the above example of this application.
[0010] As can be seen from the above technical solutions, in this embodiment, the image to be detected of the target battery string can be mapped into a one-dimensional target image. The start and end positions of the battery string region can be determined in the one-dimensional target image, thereby finding the accurate location of the battery string region. After converting the start and end positions into the start and end positions in the image to be detected, the battery string region corresponding to the target battery string can be determined from the image to be detected. In this way, the battery string region can be accurately segmented, the battery string region is accurate and reliable, the battery string boundary segmentation accuracy is high, and the accurate extraction of the battery string shape under complex working conditions is realized, providing an accurate data foundation for subsequent defect detection. Defect detection can be completed based on the battery string region. Attached Figure Description
[0011] Figure 1 This is a flowchart illustrating a method for detecting battery string regions in one embodiment of this application. Figure 2 This is a flowchart illustrating a method for detecting battery string regions in one embodiment of this application. Figure 3A This is a schematic diagram of the image to be detected in one embodiment of this application; Figure 3B This is a schematic diagram of a partial image of the image to be detected in one embodiment of this application; Figure 3C This is a schematic diagram of a morphologically processed image in one embodiment of this application; Figure 3D This is a schematic diagram of a downsampled image in one embodiment of this application; Figure 4A This is a schematic diagram of a one-dimensional initial image in one embodiment of this application; Figure 4B This is a schematic diagram of a portion of the pixels of a one-dimensional initial image in one embodiment of this application; Figure 4C This is a schematic diagram of differential filtering operation in one embodiment of this application; Figure 4D This is a schematic diagram of a one-dimensional target image according to one embodiment of this application; Figure 4E This is a schematic diagram of a portion of a one-dimensional target image in one embodiment of this application; Figure 5A This is a schematic diagram of the image to be detected in one embodiment of this application; Figure 5B This is a schematic diagram of a downsampled image in one embodiment of this application; Figure 5C This is a schematic diagram illustrating the positioning of the foreground and background regions in one embodiment of this application. Figure 5D This is a schematic diagram of the image to be detected in one embodiment of this application; Figure 5E This is a schematic diagram of the operating parameters in one embodiment of this application; Figure 6 This is a flowchart illustrating a method for detecting battery string regions in one embodiment of this application. Figure 7 This is a schematic diagram of the structure of a battery string region detection device in one embodiment of this application; Figure 8 This is a hardware structure diagram of an electronic device according to one embodiment of this application. Detailed Implementation
[0012] This application proposes a method for detecting battery string regions; see [link to relevant documentation]. Figure 1 The diagram shown is a flowchart of a method for detecting the battery string region. This method may include: Step 101: Obtain the image of the target battery string to be detected.
[0013] Step 102: Generate a one-dimensional target image of the target battery string based on the image to be detected, and determine the first start position and the first end position of the battery string region of the target battery string from the one-dimensional target image.
[0014] Step 103: Convert the first starting position and the first ending position into the second starting position and the second ending position in the image to be detected. Based on the second starting position and the second ending position, determine the battery string region corresponding to the target battery string from the image to be detected. That is, the region between these two positions is taken as the battery string region.
[0015] For example, generating a one-dimensional target image of the target battery string based on the image to be detected may include, but is not limited to: performing a downsampling operation on the image to be detected to obtain a downsampled image; projecting the downsampled image along a configured projection direction to form a one-dimensional initial image; performing a differential filtering operation on the one-dimensional initial image to obtain a one-dimensional target image; wherein, the one-dimensional target image may include multiple gradient response values, and the point with the largest absolute value of the gradient response value is the edge point of the battery string region of the target battery string.
[0016] For example, downsampling an image to be detected to obtain a downsampled image may include, but is not limited to, performing morphological processing on the image to be detected to obtain a morphologically processed image; wherein the image to be detected may include a main grid line, and the size of the structured element corresponding to the morphological processing may not be less than the configured pixel width value of the main grid line, and the shape of the structured element may include a rectangle or an intersection. Downsampling is then performed on the morphologically processed image to obtain the downsampled image.
[0017] For example, determining the first start position and the first end position of the battery string region of the target battery string from a one-dimensional target image may include, but is not limited to: selecting multiple candidate gradient response values from all gradient response values of the one-dimensional target image; wherein the absolute value of each candidate gradient response value is not less than a preset threshold; then, the first start position and the first end position may be determined; wherein the gradient response value of the first start position may be a negative minimum value among the multiple candidate gradient response values, and the gradient response value of the first end position may be a positive maximum value among the multiple candidate gradient response values.
[0018] For example, before determining the first starting position and the first ending position, non-maximum suppression can be applied to the first type of gradient response values among the multiple candidate gradient response values, and non-maximum suppression can also be applied to the second type of gradient response values among the multiple candidate gradient response values. Based on the non-maximum suppression, the first starting position and the first ending position can be determined. Here, the first type of gradient response value is a negative value, and the second type of gradient response value is a positive value; the gradient response value at the first starting position is the negative minimum among all first type gradient response values, and the gradient response value at the first ending position is the positive maximum among all second type gradient response values.
[0019] For example, when determining the first starting position and the first ending position, the first starting position and the first ending position can satisfy the following constraints: there is a positive maximum value in front of the first starting position along the battery string arrangement direction, or there is no positive maximum value in front of the first starting position, and the first starting position does not exceed the effective area of the image; there is a negative minimum value behind the first ending position along the battery string arrangement direction, or there is no negative minimum value behind the first ending position, and the first ending position does not exceed the effective area of the image; the target distance between the first starting position and the first ending position is not less than the configured minimum spacing value, and the target distance between the first starting position and the first ending position is not greater than the configured maximum spacing value.
[0020] For example, a first reference position and a second reference position can also be determined. The first reference position is the end position of the previous battery string in the target battery string, and the second reference position is the start position of the next battery string in the target battery string. The gradient response value of the first reference position is the positive maximum value forward of the first start position along the battery string arrangement direction, and the gradient response value of the second reference position is the negative minimum value backward of the first end position along the battery string arrangement direction. Based on the first reference position and the first start position, a foreground / background region of the target battery string is determined, and based on the first end position and the second reference position, a background / background region of the target battery string is determined. If the features of the foreground / background region satisfy the constraint conditions, and the features of the background / background region satisfy the constraint conditions, then the first start position and the first end position are determined as the start and end positions of the battery string region; otherwise, the operation of determining the first start position and the first end position is returned.
[0021] For example, the foreground and background regions include a one-dimensional foreground and background region in a one-dimensional target image, which is the region between a first reference position and a first starting position; the process of determining whether the features of the foreground and background regions satisfy the constraint conditions includes: if the width of the one-dimensional foreground and background region is within a distance constraint interval, determining that the features of the one-dimensional foreground and background region satisfy the constraint conditions; wherein, the distance constraint interval is determined based on a configured fixed number of pixels, or based on the target distance between the first starting position and the first ending position.
[0022] For example, the foreground and background regions include a two-dimensional foreground and background region in the image to be detected; the first reference position is converted into a third reference position in the image to be detected, and the first starting position is converted into a second starting position in the image to be detected, the two-dimensional foreground and background region is the region between the third reference position and the second starting position; the process of determining whether the features of the foreground and background region satisfy the constraint conditions may include: determining grayscale feature values based on the grayscale values of each pixel in the two-dimensional foreground and background region; if the grayscale feature values satisfy a set threshold, determining that the features of the two-dimensional foreground and background region satisfy the constraint conditions; wherein, the grayscale feature values include at least one of grayscale average value, grayscale standard deviation, and grayscale contrast; if the grayscale average value is not less than a brightness threshold, the grayscale average value satisfies the set threshold; if the grayscale standard deviation is not greater than a standard deviation threshold, the grayscale standard deviation satisfies the set threshold; if the grayscale contrast is not less than a contrast threshold, the grayscale contrast satisfies the set threshold.
[0023] For example, converting the first start position and the first end position into a second start position and a second end position in the image to be detected includes: converting the first start position and the first end position into a third start position and a third end position based on the mapping relationship between the one-dimensional initial image and the one-dimensional target image; converting the third start position and the third end position into a fourth start position and a fourth end position based on the projection direction, wherein the fourth start position includes multiple pixel positions in the downsampled image and the fourth end position includes multiple pixel positions in the downsampled image; and converting the fourth start position and the fourth end position into a second start position and a second end position based on the mapping relationship between the downsampled image and the image to be detected.
[0024] As can be seen from the above technical solutions, in this embodiment, the image to be detected of the target battery string can be mapped into a one-dimensional target image. The start and end positions of the battery string region can be determined in the one-dimensional target image, thereby finding the accurate location of the battery string region. After converting the start and end positions into the start and end positions in the image to be detected, the battery string region corresponding to the target battery string can be determined from the image to be detected. In this way, the battery string region can be accurately segmented, the battery string region is accurate and reliable, the battery string boundary segmentation accuracy is high, and the accurate extraction of the battery string shape under complex working conditions is realized, providing an accurate data foundation for subsequent defect detection. Defect detection can be completed based on the battery string region.
[0025] The technical solutions described above in the embodiments of this application will be explained below in conjunction with specific application scenarios.
[0026] In the manufacturing processes of photovoltaic modules, battery strings are core components that require machine vision inspection to detect defects. Accurate segmentation of the battery string region is a prerequisite for defect detection. However, there is currently no effective method for accurately segmenting the battery string region. For example, a region of interest (ROI) can be pre-configured; however, when the battery string position shifts, the ROI cannot correspond to the battery string region, resulting in inaccurate segmentation. Furthermore, the segmentation misclassification rate is relatively high due to interference from complex background factors such as main grid lines, sub-grid lines, and cell spacing. Additionally, the need for image processing on a two-dimensional image leads to high processing time and low segmentation efficiency.
[0027] In response to the above findings, this application proposes a method for detecting battery string regions. This method can achieve adaptive segmentation of battery string regions based on dynamic visual positioning, accurately segment the battery string regions, and accurately extract the battery string morphology under complex working conditions, providing a precise data foundation for subsequent defect detection.
[0028] This application proposes a method for detecting battery string regions, which can be applied to electronic devices. For example, the electronic device can be a camera, where the camera captures images and the battery string region is detected based on those images. Alternatively, the electronic device can be a battery string detection device, where the camera captures images and sends them to the battery string detection device, which then detects the battery string region based on the images. See also... Figure 2 The diagram shown is a flowchart of a method for detecting battery string regions. This method may include: Step 201: Obtain the image of the target battery string to be detected.
[0029] For example, a transmission device holds multiple battery cells, and a camera is positioned on top of the device. As the transmission device moves from left to right (or from right to left), or from top to bottom (or bottom to top), the battery cells sequentially pass through the camera's field of view, allowing the camera to capture images of each battery cell. For instance, assuming a battery string contains 15 battery cells, and there are a total of M battery cells (e.g., 1500 battery cells), each battery cell sequentially passes through the camera's field of view. When battery cell 1 passes through the camera's field of view, the camera captures its image; when battery cell 2 passes through the camera's field of view, the camera captures its image, and so on.
[0030] Considering the limited field of view of the camera, a complete image of all battery cells is not obtained through a single image acquisition. Instead, multiple image acquisitions are performed, and the acquired images are stitched together to obtain a complete image of all battery cells. For example, after acquiring image 1 of battery cell 1, image 1 is used as the stitched image. After acquiring image 2 of battery cell 2, image 2 is stitched with the stitched image to update the stitched image. This process continues until images 1500 of 1500 battery cells are acquired, which are then stitched with the stitched image to update the stitched image. This way, a complete image can be obtained. Of course, the above is just an example of obtaining a complete image. A single frame can include the entire area of a battery cell, or it can include only a portion of a battery cell. The number of battery cells in a single frame can also be more than one; there are no restrictions, as long as a complete image can be obtained through stitching.
[0031] The stitching process continues as each battery cell sequentially passes through the camera's field of view. During stitching, a battery string region detection method can be performed. Based on this, the stitched image at the current moment can be used as the image to be detected; that is, each time the battery string region detection method is performed, the stitched image at the current moment is used as the image to be detected. Alternatively, the battery string region detection method can be performed after the stitching process is complete. Based on this, the complete image including all battery cells can be called the image to be detected.
[0032] For example, when determining the battery string region of battery string a1 (e.g., battery cells 1-15) based on the image to be detected, battery string a1 is referred to as the target battery string. The image to be detected only needs to include the complete battery string region of battery string a1. If the image to be detected does not yet include the complete battery string region of battery string a1, the image continues to be stitched until the complete battery string region of battery string a1 is included. When determining the battery string region of battery string a2 (e.g., battery cells 16-30) based on the image to be detected, battery string a2 is referred to as the target battery string. When determining the battery string region of battery string a3 (e.g., battery cells 31-45) based on the image to be detected, battery string a3 is referred to as the target battery string, and so on, that is, each battery string is sequentially used as the target battery string.
[0033] In summary, the image to be detected of the target battery string can be obtained. The target battery string is any battery string among all battery strings, and the target battery string may include at least one battery cell, such as 15 battery cells.
[0034] The battery string can be a photovoltaic (PV) cell string or other types of battery strings; there are no restrictions on the type of battery string. For example, the battery string can include HJT (heterojunction) type PV cells, or TopCon (tunneling oxide passivated contact) type PV cells, or BC (back contact) type PV cells.
[0035] The camera can be either a high-resolution or low-resolution camera; taking a high-resolution camera as an example, the camera is positioned at a fixed location and captures images of the battery cells as they move within its field of view, obtaining images of the battery cells (one battery string will correspond to multiple images, meaning multiple images are obtained through multiple shots). Because the camera is high-resolution, it can obtain high-definition images of the battery cells, ensuring that even the fine details on the surface of the battery string are clearly displayed, facilitating defect detection.
[0036] Step 202: Perform morphological processing on the image to be detected to obtain the morphologically processed image.
[0037] For example, see Figure 3A The image shown is a schematic diagram of the image to be detected. This image is a captured image of a battery string. A partial image of this image is extracted. See [link to relevant documentation]. Figure 3B The image shown is a schematic diagram of a local portion of the image to be detected. Figure 3B In the image, the white horizontal lines represent the main grid lines, the thinner white vertical lines represent the secondary grid lines, the thicker white vertical lines represent the gaps between battery cells, and the thickest white area represents the gaps between adjacent battery strings. In summary, the image to be detected contains gaps between adjacent battery strings, gaps between cells, main grid lines, and secondary grid lines. The gaps between adjacent battery strings are the locations to be detected, while the gaps between cells, main grid lines, and secondary grid lines are the locations of interference.
[0038] For example, grid lines, serving as the electrode network on the front or back of the battery, utilize the high conductivity of metal to smoothly move these photogenerated charge carriers to the external circuit. The main grid lines, as a crucial part of the electrode connection, are primarily responsible for current transmission and connect to the fine grid lines (or sub-grid lines). The fine grid lines further refine the current collection area, thereby ensuring a uniform current distribution across the cell surface.
[0039] Considering the interference from cell spacing, main grid lines, and sub-grid lines, morphological processing can be performed on the image to be detected. Morphological processing is used to eliminate interfering features such as cell spacing (i.e., the spacing between cell sheets), main grid lines, and sub-grid lines, and to eliminate background texture of the battery string, thereby improving the detection accuracy of the battery string region.
[0040] When performing morphological processing on the image to be detected, morphological erosion or morphological opening operations can be performed on the image to be detected. There are no restrictions on the morphological processing method.
[0041] See Figure 3C The image shown is a schematic diagram of the morphologically processed image (after erosion). Figure 3C It can be seen that after morphological processing, the spacing between the main grid lines, the sub-grid lines, and the solar cells is basically eliminated.
[0042] For example, to ensure the erosion effect of morphological processing, the size of the structured element corresponding to the morphological processing can be no less than the configured pixel width of the main grid line. For the structured element, morphological processing has two inputs and one output: the input is the image to be detected and the kernel (i.e., the structured element), and the output is the morphologically processed image. The kernel is a small region, which can be 3x3, 5x5, or 7x7 in size. The structure of the structured element can be rectangular, elliptical, cross-shaped, etc. By using structured elements with different structures, morphological operations can be performed on images with different features.
[0043] The pixel width of the main grid line is known and can be pre-configured. This allows the structured element's size to be greater than or equal to the pixel width of the main grid line. Regarding the shape of the structured element, it can include a rectangle or a cross shape (i.e., a cross shape).
[0044] For example, the size of the structured element corresponding to the morphological processing can also be small, such as smaller than the pixel width of the main grid line. The smaller structured element can be used to iterate the erosion operation multiple times, that is, the smaller structured element is used to perform multiple morphological processing on the image to be detected to ensure the erosion effect.
[0045] Step 203: Perform a downsampling operation on the morphologically processed image to obtain a downsampled image. Alternatively, the image to be detected can be downsampled directly to obtain a downsampled image.
[0046] For example, see Figure 3C As shown, slight white vertical lines still exist in the battery string region of the image after morphological processing, mainly due to incomplete erosion. However, due to the time constraints of image processing algorithms in industrial scenarios and the large overall image size, increasing the morphological filter kernel size or the number of iterations will significantly increase the algorithm's processing time. Therefore, in this embodiment, a downsampling operation (i.e., downsampling scaling) can be performed on the morphologically processed image to eliminate background grid lines (i.e., main grid lines and sub-grid lines) and the spacing between battery cells. See [link to documentation]. Figure 3DThe image shown is a schematic diagram of the downsampled image. Downsampling eliminates the main grid lines, sub-grid lines, and inter-cell spacing in the background of the battery string. In summary, morphological erosion and downsampling can eliminate grid line interference and improve localization robustness in complex backgrounds.
[0047] For example, when downsampling a morphologically processed image, the downsampling ratio can be pre-configured, such as 64 or 32. The downsampling operation is performed on the morphologically processed image based on this ratio, and the implementation method of this downsampling operation is not limited. For instance, when the downsampling ratio is 64, the width of the downsampled image is 1 / 64 of the width of the morphologically processed image, and the height of the downsampled image is 1 / 64 of the height of the morphologically processed image, meaning the morphologically processed image is reduced by a factor of 64.
[0048] Step 204: Project the downsampled image along the configured projection direction into a one-dimensional initial image.
[0049] For example, after downsampling, the battery string region in the image becomes a single black area. In this embodiment, the start and end positions of the battery string region can be determined using a one-dimensional image, i.e., the start and end positions are found based on the one-dimensional image. Based on this, the downsampling image can be projected along a specified projection direction into a one-dimensional initial image, which can also be called a one-dimensional initial signal. In other words, the downsampling image can be projected along a specified projection direction into a one-dimensional initial signal.
[0050] See Figure 4A The diagram shows a schematic of a one-dimensional initial image (one-dimensional initial signal). The downsampled image (i.e., the two-dimensional image) has a width of W and a height of H. After being projected into a one-dimensional initial image, the one-dimensional initial image has a width of W and a height of 1, meaning that the one-dimensional initial image includes the gray values of W pixels.
[0051] The projection direction (specified projection direction) can be configured according to actual needs. The projection direction can be the positive direction of the image Y-axis, i.e., the 90-degree direction. The projection direction can also be other directions, such as the 10-degree direction, the 20-degree direction, etc. There are no restrictions on the projection direction.
[0052] For example, for W horizontal pixels in a downsampled image, the projection direction of each horizontal pixel corresponds to H vertical pixels. For instance, if the positive Y-axis of the image is used as the projection direction, the projection direction of each horizontal pixel can correspond to a column of vertical pixels in the downsampled image. For example, the projection direction of the first horizontal pixel can correspond to the H vertical pixels in the first column, the projection direction of the second horizontal pixel can correspond to the H vertical pixels in the second column, and so on.
[0053] When projecting the downsampled image along the projection direction into a one-dimensional initial image, for the first horizontal pixel of the downsampled image, the gray value of that horizontal pixel is determined based on the gray values of the H vertical pixels corresponding to the projection direction. For example, the average of the gray values of the H vertical pixels is used as the gray value of the horizontal pixel; similarly, the average of the gray values of the H vertical pixels in the first column is used as the gray value of the first horizontal pixel. This process is repeated for each horizontal pixel, and the gray values of all horizontal pixels together form the one-dimensional initial image, which consists of the gray values of W horizontal pixels.
[0054] See Figure 4B The image shown is a schematic diagram illustrating the extraction of grayscale values from a portion of a one-dimensional initial image. Figure 4B The pixels in the image are those near the starting position of the battery string region. The grayscale values of these pixels are 212, 212, 210, 22, and 22, respectively, indicating that the starting position is a transition edge from white to black. The pixels near the ending position of the battery string region reflect that the ending position is also a transition edge from black to white.
[0055] Step 205: Perform differential filtering on the one-dimensional initial image to obtain a one-dimensional target image. Combined with steps 201-205, this involves generating a one-dimensional target image of the target battery string based on the image to be detected. Steps 201-205 are merely examples; the goal is simply to generate a one-dimensional target image based on the image to be detected.
[0056] For example, a differential filter can be used to perform differential filtering on the projected one-dimensional initial image to obtain a one-dimensional target image, which can also be called a first-order differential response signal. For instance, the differential filter can be a first-order differential filter, allowing for first-order differential filtering of the one-dimensional initial image to obtain the one-dimensional target image. Alternatively, the differential filter can be a center-difference filter, allowing for center-difference filtering of the one-dimensional initial image to obtain the one-dimensional target image. Or, the differential filter can be a weighted differential filter, allowing for weighted differential filtering of the one-dimensional initial image to obtain the one-dimensional target image. Or, the differential filter can be a Gaussian difference filter, allowing for Gaussian difference filtering of the one-dimensional initial image to obtain the one-dimensional target image. Of course, the above are just a few examples, and the specific type of differential filter used is not limited in this embodiment.
[0057] For example, see Figure 4CThe diagram illustrates a differential filtering operation. The first row represents the projected image, i.e., the initial one-dimensional image. The second row represents the projected data, i.e., the grayscale value of each pixel in the initial one-dimensional image. The third row is a waveform diagram, which reflects the grayscale value of each pixel. The fourth row represents the projected data. The fifth row represents the filtering parameters used in the differential filter. The sixth row represents the filtering result, i.e., the result obtained by performing a differential filtering operation on the projected data using the filtering parameters. This filtering result is the one-dimensional target image (also known as the first-order differential response signal or gradient response signal). The seventh row is a waveform diagram, which reflects the gradient response value (i.e., the first-order differential response value) of each pixel in the one-dimensional target image.
[0058] For example, when performing a differential filtering operation on a one-dimensional initial image to obtain a one-dimensional target image, the one-dimensional target image may include multiple gradient response values (i.e., gradient values or gradient magnitudes), meaning that the pixel value of each pixel in the one-dimensional target image is a gradient response value. Figure 4C It can be seen that the edge points in the one-dimensional initial image are the points with the largest absolute values of the gradient response (i.e., the dashed vertical lines in the figure). Thus, the points with the largest absolute values of the gradient response in the one-dimensional target image are the edge points of the battery string region of the target battery string.
[0059] For example, after performing a differential filtering operation on a one-dimensional initial image to obtain a one-dimensional target image (first-order differential response signal), see... Figure 4D The image shown is a schematic diagram of a one-dimensional target image. Analysis is performed by cropping a portion of the one-dimensional target image. (See also...) Figure 4E The image shown is a schematic diagram of a partial one-dimensional target image.
[0060] See Figure 4E As shown, when the size of the differential filter kernel is 3, the first-order differential filter kernel can be [-1 0]. [1] Assuming the gray values of the pixels in the one-dimensional initial image are 34, 212, 212, 210, 22, 22, 21 respectively, then the gradient response values of these pixels in the one-dimensional target image after differential filtering of the one-dimensional initial image can be 189 (-1X23+0X34+1X212), 178 (-1X34+0X212+1X212), -2 (-1X212+0X212+1X210), -190 (-1X212+0X210+1X22), -188 (-1X210+0X22+1X22), -1 (-1X22+0X22+1X21), 0 (-1X22+0X21+1X22). Some gradient response values are shown here.
[0061] From the one-dimensional initial image and the one-dimensional target image, it can be seen that the termination position of the previous battery string region (i.e., the transition edge from black to white) corresponds to a sharp increase in grayscale value, manifested as the grayscale value of adjacent pixels jumping from 34 to 212. The gradient response value (first-order difference response value) at this termination position is +189 (positive direction maximum). The starting position of the current battery string region (i.e., the transition edge from white to black) corresponds to a sharp decrease in grayscale value, manifested as the grayscale value of adjacent pixels jumping from 210 to 22. The gradient response value at this starting position is -190 (negative direction minimum). Therefore, the extreme points of the gradient response value can correspond to the edge positions of the battery string region. That is, the negative direction minimum (the point with the most negative gradient response value) can correspond to the starting position of the battery string (the edge from white to black, where the grayscale value drops sharply), and the positive direction maximum (the point with the most positive gradient response value) can correspond to the termination position of the battery string (the edge from black to white, where the grayscale value rises sharply).
[0062] Based on the above principle, in this embodiment, the first starting position and the first ending position of the battery string region of the target battery string can be determined from the one-dimensional target image. The gradient response value of the first starting position can be a negative minimum value, and the gradient response value of the first ending position can be a positive maximum value. This will be explained below.
[0063] Step 206: Select multiple candidate gradient response values from all gradient response values of the one-dimensional target image; wherein, for each candidate gradient response value, the absolute value of the candidate gradient response value is not less than a preset threshold.
[0064] For example, after obtaining a one-dimensional target image, local extrema can be searched. These local extrema are candidate gradient response values, and these candidate gradient response values include positive maxima and negative minima. For instance, if a candidate gradient response value is a local extremum greater than 0, then the candidate gradient response value is a positive maxima; if a candidate gradient response value is a local extremum less than 0, then the candidate gradient response value is a negative minima.
[0065] For example, a preset threshold can be set to filter out low-response points and retain candidate local extrema (including positive maxima and negative minima). Based on this, the absolute value of each gradient response value in the one-dimensional target image can be calculated. If the absolute value of the gradient response value is not less than the preset threshold, then the gradient response value is considered a local extrema and retained as a candidate gradient response value. After performing the above processing on each gradient response value of the one-dimensional target image, multiple candidate gradient response values can be obtained.
[0066] Step 207: Perform non-maximum suppression on the first type of gradient response value among the multiple candidate gradient response values, and perform non-maximum suppression on the second type of gradient response value among the multiple candidate gradient response values.
[0067] For example, after selecting multiple candidate gradient response values from all gradient response values of a one-dimensional target image, the extreme points of all candidate gradient response values can be classified. Negative candidate gradient response values are called Class I gradient response values (i.e., Class I gradient response values are negative), and positive candidate gradient response values are called Class II gradient response values (i.e., Class II gradient response values are positive). Based on this, non-maximum suppression (NMS) can be applied to these two types of extreme points respectively.
[0068] For example, non-maximum suppression (NMS) can be applied to the first type of gradient response values among multiple candidate gradient response values, retaining the point with the largest gradient magnitude in the neighborhood and suppressing insignificant extrema. Since the first type of gradient response value is negative, NMS retains smaller candidate gradient response values. For instance, if there are two first type gradient response values, "-190" and "-188", NMS can retain the candidate gradient response value "-190", meaning that the absolute value of the candidate gradient response value "-190" is larger.
[0069] For example, non-maximum suppression (NMS) can be applied to the second type of gradient response values among multiple candidate gradient response values, retaining the point with the largest gradient magnitude in the neighborhood and suppressing insignificant extrema. Since the second type of gradient response value is positive, NMS retains a larger candidate gradient response value. For instance, if there are two second type of gradient response values, "190" and "188", then NMS can retain the candidate gradient response value "190", meaning that the absolute value of the candidate gradient response value "190" is larger.
[0070] Step 208: Determine the first start position and the first end position of the battery string region of the target battery string from the one-dimensional target image, and determine the first reference position and the second reference position from the one-dimensional target image. The first reference position may be the end position of the battery string region of the preceding battery string of the target battery string, and the second reference position may be the start position of the battery string region of the following battery string of the target battery string.
[0071] For example, after non-maximum suppression, extreme point pairing and coarse localization of the battery string region can be performed. During the extreme point pairing and coarse localization of the battery string region, extreme points after non-maximum suppression can be paired according to edge polarity and adjacent constraints to obtain the first starting position and the first ending position of the battery string region of the target battery string, the ending position of the battery string region of the previous battery string (i.e., the first reference position) and the starting position of the battery string region of the next battery string (the second reference position).
[0072] In one possible implementation, when determining the first starting position and the first ending position, the gradient response value at the first starting position can be a negative minimum among multiple candidate gradient response values; that is, the gradient response value at the first starting position is a negative minimum among all first-type gradient response values (i.e., first-type gradient response values after non-maximum suppression). The gradient response value at the first ending position can be a positive maximum among multiple candidate gradient response values; that is, the gradient response value at the first ending position is a positive maximum among all second-type gradient response values (i.e., second-type gradient response values after non-maximum suppression).
[0073] For example, a positive maximum corresponds to a jump in grayscale from low to high (a black-to-white edge), and the terminating position of the battery string region in the target battery string is a black-to-white edge (the battery string region is black, while the spacing between battery strings is white). Therefore, the terminating position of the battery string region in the target battery string corresponds to a jump in grayscale from low to high, and thus, the terminating position corresponds to a positive maximum in the gradient response value. Based on this, the gradient response value at the first terminating position can be a positive maximum among all second-type gradient response values.
[0074] For example, a negative minimum corresponds to a jump in grayscale from high to low (a white-to-black edge). The starting position of the target battery string's region is a white-to-black edge (the spacing between battery strings is white, while the battery string region is black). Therefore, the starting position of the target battery string's region corresponds to a jump in grayscale from high to low. Thus, the starting position corresponds to a negative minimum in the gradient response values. Based on this, the gradient response value at the first starting position can be a negative minimum among all first-type gradient response values.
[0075] In one possible implementation, when determining the first starting position and the first ending position, the gradient response value at the first starting position is a negative minimum among multiple candidate gradient response values (all first-type gradient response values), and there is a positive maximum ahead of the first starting position along the battery string arrangement direction (the positive maximum corresponds to the ending position of the previous battery string). The gradient response value at the first ending position is a positive maximum among multiple candidate gradient response values (all second-type gradient response values), and there is a negative minimum behind the first ending position along the battery string arrangement direction (the negative minimum corresponds to the starting position of the next battery string).
[0076] For example, the region before the starting position of the target battery string can be the ending position of the previous battery string, and the region after the ending position of the target battery string can be the starting position of the next battery string. Based on this, the extreme points after non-maximum suppression are paired according to edge polarity and adjacent constraints: If a positive maximum point (the termination position of the previous battery string) exists in front of a certain negative minimum point (candidate starting position) (along the direction of the battery string arrangement), then the negative minimum point is determined to be the starting position of the target battery string. Based on this, the gradient response value of the first starting position is a negative minimum, and there is a positive maximum point in front of the first starting position, which corresponds to the termination position of the previous battery string.
[0077] If a negative minimum point (the starting position of the next battery string) exists behind a positive maximum point (candidate termination position) (along the direction of the battery string arrangement), then the positive maximum point is determined to be the termination position of the target battery string. Based on this, the gradient response value of the first termination position is a positive maximum, and a negative minimum point exists behind the first termination position, which corresponds to the starting position of the next battery string.
[0078] In one possible implementation, when determining the first starting position and the first ending position, the gradient response value at the first starting position is the negative minimum of all first-type gradient response values, and there is a positive maximum value preceding the first starting position (the positive maximum value corresponds to the ending position of the previous battery string). The gradient response value at the first ending position is the positive maximum of all second-type gradient response values, there is no negative minimum value following the first ending position, and the first ending position does not exceed the effective image area. Alternatively, the gradient response value at the first starting position is the negative minimum of all first-type gradient response values, there is no positive maximum value preceding the first starting position, and the first starting position does not exceed the effective image area. The gradient response value at the first ending position is the positive maximum of all second-type gradient response values, and there is a negative minimum value following the first ending position. Alternatively, the gradient response value at the first starting position is the negative minimum of all first-type gradient response values, there is no positive maximum value preceding the first starting position, and the first starting position does not exceed the effective image area. The gradient response value at the first termination position is the positive maximum value among all second-type gradient response values. There are no negative minimum values after the first termination position, and the first termination position does not exceed the effective area of the image.
[0079] For example, in some application scenarios, the image to be detected may only contain the target battery string, but not the preceding and following battery strings, or the image to be detected may only contain the target battery string and the preceding battery string, but not the following battery string, or the image to be detected may only contain the target battery string and the following battery string, but not the preceding battery string.
[0080] If there is no positive maximum point in front of a certain negative minimum point (candidate starting position) (along the direction of the battery string arrangement), and the position of this negative minimum point does not exceed the effective area of the image (such as not the image boundary), then this negative minimum point is directly determined as the starting position of the target battery string, that is, there is no preceding battery string of the target battery string. Based on this, the gradient response value of the first starting position is a negative minimum, and there is no positive maximum point in front of the first starting position, and the first starting position does not exceed the effective area of the image.
[0081] If there is no negative minimum point after a certain positive maximum point (candidate termination position) (along the direction of the battery string arrangement), and the position of this positive maximum point does not exceed the effective area of the image (such as not the image boundary), then this positive maximum point is directly determined as the termination position of the target battery string, that is, there is no subsequent battery string of the target battery string. Based on this, the gradient response value of the first termination position is a positive maximum, and there is no negative minimum point after the first termination position, and the first termination position does not exceed the effective area of the image.
[0082] In one possible implementation, when determining the first starting position and the first ending position, the target distance between the first starting position and the first ending position is not less than the configured minimum spacing value, and the target distance between the first starting position and the first ending position is not greater than the configured maximum spacing value.
[0083] For example, if the target distance does not meet the above constraints, it means that the first starting position and the first ending position are invalid pairs, and the first starting position and the first ending position need to be reselected.
[0084] For example, extreme point pairing can incorporate distance threshold constraints, setting a minimum spacing value based on the known physical dimensions of the battery string. and maximum spacing value Minimum spacing value and maximum spacing value All configurations are based on actual needs and are used to represent the distance threshold constraint between the start and end positions of a battery string.
[0085] If the target distance d (such as spacing, where target distance d can represent the number of pixels between the first starting position and the first ending position) satisfies the following expression: If the first starting position and the first ending position meet the distance threshold constraint, they are considered a valid pairing. Otherwise, the distance threshold constraint is not met, and the pairing is considered invalid.
[0086] In one possible implementation, when determining the first start position and the first end position, the first start position and the first end position also need to satisfy the order consistency constraint, that is, the first start position is located to the left (horizontally arranged) or above (vertically arranged) the first end position. Otherwise, the first start position and the first end position are considered an invalid pair, and the first start position and the first end position need to be reselected.
[0087] In one possible implementation, a first reference position and a second reference position can also be determined. The gradient response value of the first reference position (i.e., the gradient response value after non-maximum suppression) can be a positive maximum value in front of the first starting position along the battery string arrangement direction, and the gradient response value of the second reference position can be a negative minimum value in back of the first ending position along the battery string arrangement direction. For example, after obtaining the first starting position, the position in front of the first starting position where the positive maximum value (i.e., the gradient response value is a positive maximum value) is found as the first reference position. After obtaining the first ending position, the position in back of the first ending position where the negative minimum value (i.e., the gradient response value is a negative minimum value) is found as the second reference position.
[0088] In one possible implementation, when determining the first starting position, the first ending position, the first reference position, and the second reference position, if there are multiple positive maxima in front of a single negative minimum point, this negative minimum point is taken as the first starting position. For the multiple positive maxima, the positive maximum point closest to the first starting position is selected as the first reference position. Similarly, if there are multiple negative minimum points behind a single positive maximum point, this positive maximum point is taken as the first ending position. For the multiple negative minimum points, the negative minimum point closest to the first ending position is selected as the second reference position.
[0089] Step 209: Determine the foreground and background regions of the target battery string based on the first reference position and the first starting position, and determine the background region of the target battery string based on the first ending position and the second reference position.
[0090] For example, the foreground and background regions may include a one-dimensional foreground and background region in a one-dimensional target image, and / or a two-dimensional foreground and background region in the image to be detected (or a two-dimensional foreground and background region in the downsampled image).
[0091] The background region may include a one-dimensional background region in a one-dimensional target image, and / or a two-dimensional background region in the image to be detected (or a two-dimensional background region in the downsampled image).
[0092] In a one-dimensional target image, the one-dimensional foreground and background region can be the area between a first reference position and a first starting position, that is, all pixels from the first reference position to the first starting position constitute the one-dimensional foreground and background region. The one-dimensional background region can be the area between a first ending position and a second reference position, that is, all pixels from the first ending position to the second reference position constitute the one-dimensional background region.
[0093] For example, since the first starting position, the first reference position, the first ending position, and the second reference position are all pixel positions in the one-dimensional target image, it is necessary to convert these pixel positions into pixel positions in the image to be detected (downsampled image). The following describes this conversion process.
[0094] When performing differential filtering on a one-dimensional initial image to obtain a one-dimensional target image, a mapping relationship between the one-dimensional initial image and the one-dimensional target image can be obtained. This mapping relationship represents the matching relationship between pixels in the one-dimensional initial image and pixels in the one-dimensional target image. Based on this mapping relationship, a first starting position (i.e., a pixel) in the one-dimensional target image can be converted into a third starting position (i.e., a pixel) in the one-dimensional initial image, and a first ending position in the one-dimensional target image can be converted into a third ending position in the one-dimensional initial image. Similarly, a first reference position in the one-dimensional target image can be converted into a reference position A1 in the one-dimensional initial image, and a second reference position in the one-dimensional target image can be converted into a reference position B1 in the one-dimensional initial image.
[0095] Referring to step 204, the two-dimensional image (downsampled image) can be projected into a one-dimensional initial image based on the projection direction. Reversing this process, the third starting position (i.e., a one-dimensional pixel) can be converted into a fourth starting position based on the projection direction. The fourth starting position can include multiple pixel positions in the downsampled image; that is, the one-dimensional pixel is converted into multiple pixel positions in the two-dimensional image. For example, when the projection direction is the positive direction of the image's Y-axis, then the column of pixel positions (i.e., H pixel positions) containing the third starting position are all used as the fourth starting position. Similarly, the third ending position can be converted into a fourth ending position based on the projection direction, and the fourth ending position can include multiple pixel positions in the downsampled image. Reference position A1 can be converted into reference position A2 based on the projection direction, and reference position A2 can include multiple pixel positions in the downsampled image. Reference position B1 can be converted into reference position B2 based on the projection direction, and reference position B2 can include multiple pixel positions in the downsampled image.
[0096] For the two-dimensional foreground and background regions in the downsampled image, the area between reference position A2 and the fourth starting position is considered the two-dimensional foreground and background region. For example, reference position A2 includes multiple pixel positions (such as a column of pixel positions in the downsampled image), and the fourth starting position includes multiple pixel positions (such as a column of pixel positions in the downsampled image). The rectangular area formed by these pixel positions can be considered the two-dimensional foreground and background region. Similarly, the fourth ending position includes multiple pixel positions, and reference position B2 includes multiple pixel positions. The rectangular area formed by these pixel positions can be considered the two-dimensional background region.
[0097] Referring to step 203, when downsampling the morphologically processed image to obtain the downsampled image, a mapping relationship between the downsampled image and the morphologically processed image can be obtained, i.e., a mapping relationship between the downsampled image and the image to be detected. This mapping relationship can represent the matching relationship between pixels in the downsampled image and pixels in the image to be detected. Based on this, based on the mapping relationship between the downsampled image and the image to be detected, the fourth starting position (multiple pixel positions) in the downsampled image can be converted into the second starting position in the image to be detected, the second starting position including multiple pixel positions in the image to be detected. The fourth ending position (multiple pixel positions) in the downsampled image can be converted into the second ending position in the image to be detected, the second ending position including multiple pixel positions in the image to be detected. The reference position A2 in the downsampled image can be converted into the reference position A3 in the image to be detected, the reference position A3 including multiple pixel positions in the image to be detected. The reference position B2 in the downsampled image can be converted into the reference position B3 in the image to be detected, the reference position B3 including multiple pixel positions in the image to be detected.
[0098] For the two-dimensional foreground and background regions in the image to be detected, the region between the reference position A3 and the second starting position is used as the two-dimensional foreground and background regions. For example, the reference position A3 includes multiple pixel positions (such as a column of pixel positions in the image to be detected), and the second starting position includes multiple pixel positions (such as a column of pixel positions in the image to be detected). The rectangular region formed by these pixel positions can be used as the two-dimensional foreground and background regions.
[0099] Similarly, the second termination position may include multiple pixel positions, and the reference position B3 may include multiple pixel positions. The rectangular area formed by these pixel positions can serve as a two-dimensional background area.
[0100] Let reference position A3 be designated as the third reference position and reference position B3 as the fourth reference position. The first reference position is converted to the third reference position in the image to be detected. The two-dimensional foreground / background region is the area between the third reference position and the second starting position. The second reference position is converted to the fourth reference position in the image to be detected. The two-dimensional background region is the area between the second ending position and the fourth reference position.
[0101] In summary, based on the first start position and first end position of the target battery string region, as well as the first reference position and second reference position, the foreground and background regions can be located. For example, see... Figure 5A The image shown is a schematic diagram of the image to be detected. (See attached image.) Figure 5B The image shown is a schematic diagram of the downsampled image. (See attached image.) Figure 5C The diagram shown illustrates the location of the foreground and background regions.
[0102] Step 210: Verify based on the features of the foreground and background regions. If the verification passes, proceed to step 211. If the verification fails, redetermine the first starting position and the first ending position, i.e., return to step 208, determine the first starting position and the first ending position of the battery string region of the target battery string from the one-dimensional target image, and determine the first reference position and the second reference position from the one-dimensional target image.
[0103] For example, if the features of the foreground and background regions satisfy the constraints, and the features of the background region satisfy the constraints, then the verification passes, the first start position and the first end position are determined as the start and end positions of the battery string region, and step 211 is executed. If the features of the foreground and background regions do not satisfy the constraints, and / or the features of the background region do not satisfy the constraints, then the verification fails, and the process returns to step 208.
[0104] For example, if the foreground and background regions include a one-dimensional foreground and background region, then if the features of the one-dimensional foreground and background region satisfy the constraints, it is determined that the features of the foreground and background region satisfy the constraints; if the features of the one-dimensional foreground and background region do not satisfy the constraints, it is determined that the features of the foreground and background region do not satisfy the constraints. Furthermore, if the foreground and background regions include a two-dimensional foreground and background region, then if the features of the two-dimensional foreground and background region satisfy the constraints, it is determined that the features of the foreground and background region satisfy the constraints; if the features of the two-dimensional foreground and background region do not satisfy the constraints, it is determined that the features of the foreground and background region do not satisfy the constraints. Additionally, if the foreground and background regions include both a one-dimensional and a two-dimensional foreground and background region, then if the features of both the one-dimensional and two-dimensional foreground and background regions satisfy the constraints, it is determined that the features of the foreground and background region satisfy the constraints; if the features of the one-dimensional foreground and background region do not satisfy the constraints, and / or the features of the two-dimensional foreground and background region do not satisfy the constraints, it is determined that the features of the foreground and background region do not satisfy the constraints.
[0105] For example, if the background region includes a one-dimensional background region, then if the features of the one-dimensional background region satisfy the constraints, it is determined that the features of the background region satisfy the constraints; if the features of the one-dimensional background region do not satisfy the constraints, it is determined that the features of the background region do not satisfy the constraints. Furthermore, if the background region includes a two-dimensional background region, then if the features of the two-dimensional background region satisfy the constraints, it is determined that the features of the background region satisfy the constraints; if the features of the two-dimensional background region do not satisfy the constraints, it is determined that the features of the background region do not satisfy the constraints. Additionally, if the background region includes both a one-dimensional and a two-dimensional background region, then if the features of both the one-dimensional and two-dimensional background regions satisfy the constraints, it is determined that the features of the background region satisfy the constraints; if the features of the one-dimensional background region do not satisfy the constraints, and / or the features of the two-dimensional background region do not satisfy the constraints, it is determined that the features of the background region do not satisfy the constraints.
[0106] For example, if the width of the one-dimensional foreground / background region is within the distance constraint interval, then the features of the one-dimensional foreground / background region are determined to satisfy the constraint conditions; if the width of the one-dimensional foreground / background region is not within the distance constraint interval, then the features of the one-dimensional foreground / background region are determined to not satisfy the constraint conditions. If the width of the one-dimensional background / background region is within the distance constraint interval, then the features of the one-dimensional background / background region are determined to satisfy the constraint conditions; if the width of the one-dimensional background / background region is not within the distance constraint interval, then the features of the one-dimensional background / background region are determined to not satisfy the constraint conditions.
[0107] For example, the distance constraint interval can be determined based on a fixed number of pre-configured pixels. For instance, the distance constraint interval can be 2 to 4 pixels, which is used to constrain the distance between two adjacent battery strings to be within the range of 2 to 4 pixels. The distance between two adjacent battery strings is the distance in the one-dimensional target image.
[0108] For example, the distance constraint interval can be determined based on the target distance between the first starting position and the first ending position. For example, the distance constraint interval can be 0.15d to 0.25d, where d can represent the target distance. This is used to constrain the distance between two adjacent battery strings to be within the interval of 0.15d to 0.25d.
[0109] For example, grayscale feature values can be determined based on the grayscale values of each pixel within a two-dimensional foreground and background region. If the grayscale feature values meet a set threshold, the features of the two-dimensional foreground and background region are determined to meet the constraints; if the grayscale feature values do not meet the set threshold, the features of the two-dimensional foreground and background region are determined to not meet the constraints. Similarly, grayscale feature values can be determined based on the grayscale values of each pixel within a two-dimensional background region. If the grayscale feature values meet a set threshold, the features of the two-dimensional background region are determined to meet the constraints; if the grayscale feature values do not meet the set threshold, the features of the two-dimensional background region are determined to not meet the constraints.
[0110] In summary, it can be seen that the grayscale feature values of the two-dimensional foreground and background regions (two-dimensional background regions) can be calculated to verify whether they meet the set threshold, thus realizing the grayscale verification of the two-dimensional foreground and background regions. The grayscale verification methods for the two-dimensional foreground and background regions are the same, and the two-dimensional foreground and background regions will be used as an example in the following.
[0111] In one possible implementation, the grayscale feature values may include, but are not limited to, at least one of the grayscale average value, grayscale standard deviation, and grayscale contrast. If the grayscale average value is not less than the brightness threshold, then the grayscale average value meets the set threshold; if the grayscale standard deviation is not greater than the standard deviation threshold, then the grayscale standard deviation meets the set threshold; if the grayscale contrast is not less than the contrast threshold, then the grayscale contrast meets the set threshold.
[0112] For example, if the grayscale feature values simultaneously include the grayscale mean, grayscale standard deviation, and grayscale contrast, then the features of the two-dimensional foreground and background regions satisfy the constraints when the grayscale mean, grayscale standard deviation, and grayscale contrast all meet a set threshold. If at least one of the following conditions is met: the grayscale mean does not meet a set threshold, the grayscale standard deviation does not meet a set threshold, or the grayscale contrast does not meet a set threshold, then the features of the two-dimensional foreground and background regions do not satisfy the constraints.
[0113] For example, within the image to be detected (or the downsampled image), the two-dimensional foreground and background regions can include multiple pixel locations, each pixel location corresponding to a grayscale value, and analysis is performed based on these grayscale values.
[0114] The grayscale average value can be the average grayscale value of each pixel within a two-dimensional foreground and background region. A brightness threshold (i.e., a background brightness threshold) can be set based on scene lighting conditions and other information. This brightness threshold can be configured according to actual needs, and a brightness threshold greater than or equal to 150 indicates a bright background. Based on this, if the grayscale average value is less than this brightness threshold, the first starting position and / or the first reference position is determined to be unreliable, meaning the first starting position and the first ending position are unreliable, and extreme points need to be rematched; that is, the grayscale average value does not meet the set threshold. If the grayscale average value is not less than this brightness threshold, the first starting position and the first reference position are determined to be reliable; that is, the grayscale average value meets the set threshold.
[0115] The grayscale standard deviation can be defined as the standard deviation of the grayscale values at each pixel location within a two-dimensional foreground and background region. It is used to analyze the uniformity of this region. A standard deviation threshold can be set based on factors such as scene lighting conditions; this threshold can be configured according to actual needs. If the grayscale standard deviation exceeds this threshold, it indicates that the edge pairing of the two-dimensional foreground and background region may be incorrect, requiring re-matching of extreme points; in other words, the grayscale standard deviation does not meet the set threshold. Conversely, if the grayscale standard deviation is not greater than the threshold, it indicates that the edge pairing is correct, meaning the grayscale standard deviation meets the set threshold.
[0116] Regarding grayscale contrast, this can be the grayscale contrast between the average grayscale value of the battery string region and the average grayscale value of the two-dimensional foreground and background regions. For example, the grayscale contrast can be calculated using the following formula: . It can represent grayscale contrast. It can represent the average grayscale value of the two-dimensional foreground and background regions. It can find the second start position and the second end position of the target battery string from the image to be detected (or the downsampled image), and the region between the second start position and the second end position is the battery string region of the target battery string. This represents the average grayscale value at each pixel location within the battery string region of the target battery string. Based on this, the grayscale contrast can be obtained.
[0117] If the grayscale contrast is less than the contrast threshold (the contrast threshold can be configured according to actual needs, such as 0.5), then the edge matching may be incorrect, and the extreme points need to be rematched; that is, the grayscale contrast does not meet the set threshold. If the grayscale contrast is not less than the contrast threshold, then the grayscale contrast meets the set threshold.
[0118] Step 211: If the verification is successful, output the first start position and the first end position. That is, convert the first start position and the first end position into the second start position and the second end position in the image to be detected. Based on the second start position and the second end position, determine the battery string region corresponding to the target battery string from the image to be detected. That is, the region between these two positions is taken as the battery string region corresponding to the target battery string.
[0119] For example, based on the mapping relationship between the one-dimensional initial image and the one-dimensional target image, the first starting position and the first ending position are transformed into the third starting position and the third ending position; based on the projection direction, the third starting position and the third ending position are transformed into the fourth starting position and the fourth ending position, where the fourth starting position includes multiple pixel positions in the downsampled image and the fourth ending position includes multiple pixel positions in the downsampled image; based on the mapping relationship between the downsampled image and the image to be detected, the fourth starting position and the fourth ending position are transformed into the second starting position and the second ending position.
[0120] After obtaining the second start position and the second end position in the image to be detected, the region between the second start position and the second end position can be taken as the battery string region corresponding to the target battery string, thereby obtaining the accurate location of the battery string region and achieving precise localization of the battery string region, resulting in a complete and accurate segmentation of the battery string region. Based on this, the bounding box (second start position and second end position) of the battery string region can be drawn in the image to be detected to generate a fine localization result map. See [link to documentation]. Figure 5D The image shown is a schematic diagram of the image to be detected. The green rectangle represents the precise localization result of the battery string region of the target battery string.
[0121] In one possible implementation, to achieve the above-described method for detecting battery string regions, operating parameters can be pre-configured, see [link to relevant documentation]. Figure 5E The diagram shows the operating parameters. The morphological filter size and number of morphological iterations are parameters used for morphological processing of the image to be detected. The scaling size is used for downsampling the morphologically processed image. The differential filter size is used for differential filtering of the one-dimensional initial image. The edge gradient threshold and background region width are used to determine the first starting and ending positions. The background grayscale threshold is a brightness threshold (background brightness threshold).
[0122] In one possible implementation, see Figure 6The diagram shown is a flowchart of a method for detecting battery string regions. This method may include the following steps: image acquisition, image erosion, image downsampling and scaling, one-dimensional signal projection, one-dimensional differential filtering, finding local extrema, extremum point classification and non-maximum suppression, extremum point pairing and coarse localization of battery string regions, localization of front / back background regions, grayscale verification of front / back background regions, fine localization of battery string regions, and output of battery string target bounding boxes.
[0123] As can be seen from the above technical solutions, in this embodiment, the battery string region can be accurately segmented, the battery string region is accurate and reliable, the battery string boundary segmentation accuracy is high, and the battery string morphology can be accurately extracted under complex working conditions, providing an accurate data foundation for subsequent defect detection. Defect detection can be completed based on this battery string region. A method is proposed that dynamically adjusts the target region positioning by sensing environmental changes in real time, combining visual and signal processing algorithms to solve the positioning failure problem caused by battery string position offset or background interference. Battery string position offset is compensated in real time through projection signal extreme value analysis and grayscale verification. It can separate specific target regions (such as battery strings) in the image to be detected from complex backgrounds. The complexity of two-dimensional image segmentation is simplified by one-dimensional signal projection and differential filtering, achieving dimensionality reduction and improving segmentation efficiency. Combined with non-maximum suppression and grayscale verification mechanisms, missegmentation of grid lines and inter-cell spacing is suppressed, achieving accuracy control.
[0124] Enhanced Dynamic Adaptability: Real-time compensation for cell string position offset is achieved through a spatial adaptive model, overcoming the limitations of fixed ROI and resolving detection failures caused by cell string deviation. Suppression of Complex Background Interference: A composite filtering strategy of "erosion + downsampling + one-dimensional signal projection" effectively eliminates noise from main / sub-bus lines and inter-cell spacing, reducing the cell string segmentation misjudgment rate to below 0.5%. Optimized Detection Accuracy and Efficiency: Combining extreme point classification and non-maximum suppression, sub-pixel-level edge positioning is achieved, resulting in high cell string boundary segmentation accuracy that meets the requirements of photovoltaic module manufacturing processes. Intelligent Process Upgrade: Standardized input data is provided to bridge the gap between module defect detection algorithms and dynamic production line conditions, providing data for AI-driven quality control systems. Strong Application Extensibility: Compatible with photovoltaic cell types such as HJT, TopCon, and BC cells.
[0125] An adaptive segmentation framework based on grayscale feature verification is proposed, breaking the dependence on fixed fixtures and achieving accurate extraction of battery strings under complex working conditions. The 2D image is reduced to a 1D signal, and combined with differential filtering and extreme point pairing strategies, significantly reducing segmentation processing time and improving segmentation efficiency. Morphological erosion is used to preferentially eliminate grid line noise, and downsampling is used to eliminate inter-cell interference, forming a multi-level noise suppression chain to achieve layered elimination of background interference. In extreme point classification, Non-Maximum Suppression (NMS) is applied to both positive maxima and negative minima to enhance edge localization robustness and achieve bidirectional application of NMS.
[0126] Based on the same concept as the above method, this application proposes a battery string region detection device, see [link to relevant documentation]. Figure 7 The diagram shown is a structural schematic of the device, which may include: The acquisition module 71 is used to acquire the image to be detected of the target battery string; Generation module 72 is used to generate a one-dimensional target image of the target battery string based on the image to be detected; The determining module 73 is used to determine, from the one-dimensional target image, the first starting position of the battery string region of the target battery string and the first ending position of the battery string region. The processing module 74 is configured to convert the first start position and the first end position into a second start position and a second end position in the image to be detected, and to determine the battery string region corresponding to the target battery string from the image to be detected based on the second start position and the second end position.
[0127] For example, when the generation module 72 generates a one-dimensional target image of the target battery string based on the image to be detected, it is specifically used to: perform a downsampling operation on the image to be detected to obtain a downsampled image; project the downsampled image along a configured projection direction to form a one-dimensional initial image; and perform a differential filtering operation on the one-dimensional initial image to obtain the one-dimensional target image. The one-dimensional target image includes multiple gradient response values, and the point with the largest absolute value of the gradient response value is the edge point of the battery string region of the target battery string.
[0128] For example, when the generation module 72 performs a downsampling operation on the image to be detected to obtain a downsampled image, it specifically performs the following: morphological processing on the image to be detected to obtain a morphologically processed image; wherein the image to be detected includes a main grid line, the size of the structured element corresponding to the morphological processing is not less than the configured pixel width value of the main grid line, and the shape of the structured element includes a rectangle or a cross shape; and performs a downsampling operation on the morphologically processed image to obtain a downsampled image.
[0129] For example, when the determining module 73 determines the first starting position and the first ending position of the battery string region of the target battery string from the one-dimensional target image, it is specifically used to: select multiple candidate gradient response values from all gradient response values of the one-dimensional target image, wherein the absolute value of each candidate gradient response value is not less than a preset threshold; determine the first starting position and the first ending position; the gradient response value of the first starting position is the negative minimum value among the multiple candidate gradient response values, and the gradient response value of the first ending position is the positive maximum value among the multiple candidate gradient response values.
[0130] For example, the determining module 73 is further configured to perform non-maximum suppression on the first type of gradient response value among the plurality of candidate gradient response values, and to perform non-maximum suppression on the second type of gradient response value among the plurality of candidate gradient response values; the first type of gradient response value is a negative value, and the second type of gradient response value is a positive value; the gradient response value at the first starting position is a negative minimum value among all first type of gradient response values, and the gradient response value at the first ending position is a positive maximum value among all second type of gradient response values.
[0131] For example, when the determining module 73 determines the first starting position and the first ending position, the first starting position and the first ending position satisfy the following constraints: there is a positive maximum value in front of the first starting position along the battery string arrangement direction, or there is no positive maximum value in front of the first starting position, and the first starting position does not exceed the effective image area; there is a negative minimum value behind the first ending position along the battery string arrangement direction, or there is no negative minimum value behind the first ending position, and the first ending position does not exceed the effective image area; the target distance between the first starting position and the first ending position is not less than the configured minimum spacing value, and the target distance is not greater than the configured maximum spacing value.
[0132] For example, the determining module 73 is further configured to determine a first reference position and a second reference position, wherein the first reference position is the termination position of the preceding battery string of the target battery string, and the second reference position is the starting position of the following battery string of the target battery string; the gradient response value of the first reference position is the positive maximum value in front of the first starting position along the battery string arrangement direction, and the gradient response value of the second reference position is the negative minimum value in back of the first termination position along the battery string arrangement direction; the foreground and background regions of the target battery string are determined based on the first reference position and the first starting position, and the background regions of the target battery string are determined based on the first termination position and the second reference position; if the features of the foreground and background regions satisfy the constraint conditions, and the features of the background regions satisfy the constraint conditions, then the first starting position and the first termination position are determined as the starting and ending positions of the battery string region; otherwise, the operation of determining the first starting position and the first termination position is returned.
[0133] For example, the foreground and background region includes a one-dimensional foreground and background region in a one-dimensional target image, which is the region between the first reference position and the first starting position; the determining module 73 is further configured to determine that the features of the one-dimensional foreground and background region satisfy the constraint conditions if the width of the one-dimensional foreground and background region is within the distance constraint interval; the distance constraint interval is determined based on a configured fixed number of pixels, or based on the target distance between the first starting position and the first ending position.
[0134] For example, the foreground and background region includes a two-dimensional foreground and background region in the image to be detected; the first reference position is converted into a third reference position in the image to be detected, and the first starting position is converted into a second starting position in the image to be detected, the two-dimensional foreground and background region is the region between the third reference position and the second starting position; the determining module 73 is further configured to determine grayscale feature values based on the grayscale values of each pixel in the two-dimensional foreground and background region; if the grayscale feature values satisfy a set threshold, it is determined that the features of the two-dimensional foreground and background region satisfy the constraint conditions; the grayscale feature values include at least one of grayscale average value, grayscale standard deviation, and grayscale contrast; if the grayscale average value is not less than a brightness threshold, the grayscale average value satisfies the set threshold; if the grayscale standard deviation is not greater than a standard deviation threshold, the grayscale standard deviation satisfies the set threshold; if the grayscale contrast is not less than a contrast threshold, the grayscale contrast satisfies the set threshold.
[0135] For example, when the processing module 74 converts the first starting position and the first ending position into the second starting position and the second ending position in the image to be detected, it specifically performs the following steps: based on the mapping relationship between the one-dimensional initial image and the one-dimensional target image, converts the first starting position and the first ending position into the third starting position and the third ending position; based on the projection direction, converts the third starting position and the third ending position into the fourth starting position and the fourth ending position, wherein the fourth starting position includes multiple pixel positions in the downsampled image, and the fourth ending position includes multiple pixel positions in the downsampled image; based on the mapping relationship between the downsampled image and the image to be detected, converts the fourth starting position and the fourth ending position into the second starting position and the second ending position.
[0136] Based on the same concept as the above method, this application proposes an electronic device, see [link to previous application]. Figure 8 As shown, the system includes a processor 81 and a machine-readable storage medium 82, the machine-readable storage medium 82 storing machine-executable instructions that can be executed by the processor 81; the processor 81 is used to execute the machine-executable instructions to implement the battery string region detection method disclosed in the above example of this application.
[0137] Based on the same concept as the above method, this application also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the battery string region detection method disclosed in the above examples of this application.
[0138] The aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0139] Based on the same concept as the methods described above, this application also provides a computer program product, which may include a computer program. When executed by a processor, the computer program implements the battery string region detection method disclosed in the above examples of this application.
[0140] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0141] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method of detecting a battery string region, characterized by, The method comprises: acquiring a to-be-detected image of a target battery string; generating a one-dimensional target image of the target battery string based on the to-be-detected image, and determining a first start position and a first end position of a battery string region of the target battery string from the one-dimensional target image; converting the first start position and the first end position into a second start position and a second end position in the to-be-detected image, and determining a battery string region corresponding to the target battery string from the to-be-detected image based on the second start position and the second end position.
2. The method of claim 1, wherein: the generating of the one-dimensional target image of the target battery string based on the to-be-detected image comprises: performing a downsampling operation on the to-be-detected image to obtain a downsampled image; projecting the downsampled image along a configured projection direction into a one-dimensional initial image; performing a difference filtering operation on the one-dimensional initial image to obtain the one-dimensional target image; wherein the one-dimensional target image comprises a plurality of gradient response values, and a point with the maximum absolute value of the gradient response values is an edge point of the battery string region of the target battery string.
3. The method of claim 2, wherein: the performing of the downsampling operation on the to-be-detected image to obtain the downsampled image comprises: performing a morphological processing on the to-be-detected image to obtain a morphologically processed image; wherein the to-be-detected image comprises a main grid line, a size of a structured element corresponding to the morphological processing is not less than a configured pixel width value of the main grid line, and a shape of the structured element comprises a rectangle or a cross; performing a downsampling operation on the morphologically processed image to obtain the downsampled image.
4. The method of claim 1, wherein, the determining of the first start position and the first end position of the battery string region of the target battery string from the one-dimensional target image comprises: selecting a plurality of candidate gradient response values from all gradient response values of the one-dimensional target image; wherein an absolute value of each candidate gradient response value is not less than a preset threshold value; determining the first start position and the first end position; wherein a gradient response value of the first start position is a negative extreme minimum value in the plurality of candidate gradient response values, and a gradient response value of the first end position is a positive extreme maximum value in the plurality of candidate gradient response values.
5. The method of claim 4, wherein: before the determining of the first start position and the first end position, the method further comprises: performing non-maximum suppression on a first type of gradient response value in the plurality of candidate gradient response values, and performing non-maximum suppression on a second type of gradient response value in the plurality of candidate gradient response values; wherein the first type of gradient response value is a negative value, and the second type of gradient response value is a positive value; the gradient response value of the first start position is a negative extreme minimum value in all first type of gradient response values, and the gradient response value of the first end position is a positive extreme maximum value in all second type of gradient response values.
6. The method of claim 4, wherein, when the first start position and the first end position are determined, the first start position and the first end position satisfy the following constraint condition: The positive maximum value exists in front of the first starting position along the arrangement direction of the battery string, or the negative minimum value exists in front of the first starting position, and the first starting position does not exceed the image effective area; The negative minimum value exists in back of the first ending position along the arrangement direction of the battery string, or the positive maximum value exists in back of the first ending position, and the first ending position does not exceed the image effective area; The target distance between the first starting position and the first ending position is not less than the configured minimum interval value, and the target distance is not greater than the configured maximum interval value.
7. The method according to claim 4 or 5, characterized in that, The method further comprises: determining a first reference position and a second reference position, the first reference position being an ending position of a previous battery string of the target battery string, and the second reference position being a starting position of a next battery string of the target battery string; wherein the gradient response value of the first reference position is a positive maximum value in front of the first starting position along the arrangement direction of the battery string, and the gradient response value of the second reference position is a negative minimum value in back of the first ending position along the arrangement direction of the battery string; determining a front background area of the target battery string based on the first reference position and the first starting position, and determining a back background area of the target battery string based on the first ending position and the second reference position; if the features of the front background area satisfy the constraint condition, and the features of the back background area satisfy the constraint condition, determining the first starting position and the first ending position as the starting position and the ending position of the battery string area; otherwise, returning to perform the operation of determining the first starting position and the first ending position.
8. The method of claim 7, wherein the front background area comprises a one-dimensional front background area in the one-dimensional target image, and the one-dimensional front background area is a region between the first reference position and the first starting position; the determination process that the features of the front background area satisfy the constraint condition comprises: if the width of the one-dimensional front background area is located in a distance constraint interval, it is determined that the features of the one-dimensional front background area satisfy the constraint condition; wherein the distance constraint interval is determined based on a configured fixed number of pixels, or determined based on the target distance between the first starting position and the first ending position.
9. The method of claim 7, wherein, the front background area comprises a two-dimensional front background area in the to-be-detected image; the first reference position is converted into a third reference position in the to-be-detected image, and the first starting position is converted into a second starting position in the to-be-detected image, and the two-dimensional front background area is a region between the third reference position and the second starting position; the determination process that the features of the front background area satisfy the constraint condition comprises: determining a gray value feature based on the gray value of each pixel point in the two-dimensional front background area; if the gray value feature satisfies a set threshold value, it is determined that the features of the two-dimensional front background area satisfy the constraint condition. The gray scale feature value includes at least one of a gray scale average value, a gray scale standard deviation and a gray scale contrast; if the gray scale average value is not less than a brightness threshold value, the gray scale average value satisfies a set threshold value; if the gray scale standard deviation is not greater than a standard deviation threshold value, the gray scale standard deviation satisfies a set threshold value; if the gray scale contrast is not less than a contrast threshold value, the gray scale contrast satisfies a set threshold value.
10. The method of claim 2, wherein, Converting the first start position and the first end position into a second start position and a second end position in the image to be detected includes: Converting the first start position and the first end position into a third start position and a third end position based on a mapping relationship between a one-dimensional initial image and a one-dimensional target image; Converting the third start position and the third end position into a fourth start position and a fourth end position based on the projection direction, the fourth start position including a plurality of pixel positions in the image after down-sampling, and the fourth end position including a plurality of pixel positions in the image after down-sampling; Converting the fourth start position and the fourth end position into the second start position and the second end position based on a mapping relationship between the image after down-sampling and the image to be detected.
11. A battery string area detection device, characterized by comprising: The device includes: An acquisition module configured to acquire an image to be detected of a target battery string; A generation module configured to generate a one-dimensional target image of the target battery string based on the image to be detected; A determination module configured to determine a first start position of a battery string region of the target battery string and a first end position of the battery string region from the one-dimensional target image; A processing module configured to convert the first start position and the first end position into a second start position and a second end position in the image to be detected, and determine a battery string region corresponding to the target battery string from the image to be detected based on the second start position and the second end position.
12. The apparatus of claim 11, wherein, The generation module is specifically configured to perform a down-sampling operation on the image to be detected to obtain an image after down-sampling, project the image after down-sampling into a one-dimensional initial image along a configured projection direction, and perform a difference filtering operation on the one-dimensional initial image to obtain the one-dimensional target image when generating the one-dimensional target image of the target battery string based on the image to be detected; the one-dimensional target image includes a plurality of gradient response values, and a point with a maximum absolute value of the gradient response value is an edge point of the battery string region of the target battery string; Alternatively, the generation module is specifically configured to perform a morphological processing on the image to be detected to obtain an image after morphological processing when performing the down-sampling operation on the image to be detected to obtain the image after down-sampling; the image to be detected includes a main grid line, a size of a structured element corresponding to the morphological processing is not less than a configured pixel width value of the main grid line, and a shape of the structured element includes a rectangle or a cross; and the image after morphological processing is subjected to the down-sampling operation to obtain the image after down-sampling. Or, the determining module is specifically configured to: select a plurality of candidate gradient response values from all gradient response values of the one-dimensional target image, each candidate gradient response value having an absolute value not less than a preset threshold; determine the first start position and the first end position; wherein the gradient response value of the first start position is a negative extreme value in the plurality of candidate gradient response values, and the gradient response value of the first end position is a positive extreme value in the plurality of candidate gradient response values. Or, the determining module is further configured to: perform non-maximum suppression on first-type gradient response values in the plurality of candidate gradient response values, and perform non-maximum suppression on second-type gradient response values in the plurality of candidate gradient response values; the first-type gradient response value is a negative value, and the second-type gradient response value is a positive value; the gradient response value of the first start position is a negative extreme value in all first-type gradient response values, and the gradient response value of the first end position is a positive extreme value in all second-type gradient response values. Or, when the determining module determines the first start position and the first end position, the first start position and the first end position satisfy the following constraint conditions: a positive extreme value exists in front of the first start position along the battery string arrangement direction, or no positive extreme value exists in front of the first start position, and the first start position does not exceed an image effective area; a negative extreme value exists behind the first end position along the battery string arrangement direction, or no negative extreme value exists behind the first end position, and the first end position does not exceed the image effective area; a target distance between the first start position and the first end position is not less than a configured minimum interval value, and the target distance is not greater than a configured maximum interval value. Or, the determining module is further configured to determine a first reference position and a second reference position, the first reference position being a termination position of a previous battery string of the target battery string, and the second reference position being a start position of a next battery string of the target battery string; wherein the gradient response value of the first reference position is a positive extreme value in front of the first start position along the battery string arrangement direction, and the gradient response value of the second reference position is a negative extreme value behind the first end position along the battery string arrangement direction; a front background area of the target battery string is determined based on the first reference position and the first start position, and a rear background area of the target battery string is determined based on the first end position and the second reference position; if a feature of the front background area satisfies a constraint condition, and a feature of the rear background area satisfies a constraint condition, the first start position and the first end position are determined as the start position and the termination position of the battery string area; otherwise, the operation of determining the first start position and the first end position is returned to be performed. Or, the front background region comprises a one-dimensional front background region in a one-dimensional target image, the one-dimensional front background region being a region between the first reference position and the first start position; the determining module is further configured to determine that the feature of the one-dimensional front background region satisfies the constraint condition if a width of the one-dimensional front background region is located in a distance constraint interval, the distance constraint interval being determined based on a configured fixed number of pixels or based on a target distance between the first start position and the first end position; Or, the front background region comprises a two-dimensional front background region in the to-be-detected image; the first reference position is converted into a third reference position in the to-be-detected image, and the first start position is converted into a second start position in the to-be-detected image, the two-dimensional front background region being a region between the third reference position and the second start position; the determining module is further configured to determine a gray feature value based on a gray value of each pixel point in the two-dimensional front background region, and determine that the feature of the two-dimensional front background region satisfies the constraint condition if the gray feature value satisfies a set threshold value; the gray feature value comprises at least one of a gray average value, a gray standard deviation, and a gray contrast; the gray average value satisfies the set threshold value if the gray average value is not less than a brightness threshold value; the gray standard deviation satisfies the set threshold value if the gray standard deviation is not greater than a standard deviation threshold value; and the gray contrast satisfies the set threshold value if the gray contrast is not less than a contrast threshold value. Or, the processing module is specifically configured to, when converting the first start position and the first end position into the second start position and the second end position in the to-be-detected image: convert the first start position and the first end position into a third start position and a third end position based on a mapping relationship between the one-dimensional initial image and the one-dimensional target image; convert the third start position and the third end position into a fourth start position and a fourth end position based on the projection direction, the fourth start position comprising a plurality of pixel positions in the down-sampled image, and the fourth end position comprising a plurality of pixel positions in the down-sampled image; and convert the fourth start position and the fourth end position into the second start position and the second end position based on a mapping relationship between the down-sampled image and the to-be-detected image.
13. An electronic device, comprising: Comprise: a processor and a machine readable storage medium, the machine readable storage medium storing machine executable instructions capable of being executed by the processor; the processor is configured to execute the machine executable instructions to implement the method in any one of claims 1-10.