Image acquisition method, electronic device and storage medium
The image acquisition device uses linear detection technology to determine the target angle of the cabinet, which solves the problem that the door opening angle cannot be accurately detected in the prior art, and achieves a more accurate image acquisition timing and cost-reducing effect.
Patent Information
- Application Number
- CN202411422493.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-10-12
AI Technical Summary
The existing cabinets cannot accurately detect the door opening angle, which leads to the inability to accurately determine whether the cabinet is in the door opening state, which in turn affects the execution of intelligent processing functions, and the hardware solution is high cost and is not suitable for widespread applications.
The target image of the cabinet is obtained through the image acquisition device, and the linear detection technology is used to determine the initial angle between the predicted line segment and the preset line segment, and calculate the target angle between the cabinet body and the cabinet door. If the angle meets the preset conditions, it will be started Another image acquisition device.
It improves the accuracy of the target angle, ensures that the time for the image acquisition device to start when the door is opened in the cabinet is more accurate, reduces the hardware cost, and is suitable for a wide range of applications.
Smart Images

Figure CN118921444B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an image acquisition method, an electronic device, and a storage medium. Background Art
[0002] In recent years, lockers have been widely used in convenience stores and large supermarkets, such as self-service lockers and refrigerated lockers for displaying refrigerated items. In existing lockers, it is impossible to accurately detect the door opening angle of the locker, so it is impossible to accurately determine whether the locker is in an open state. Furthermore, if it is not accurately determined whether the locker is open, if the locker door is actually opened, but it is not detected that the locker is in an open state, the relevant intelligent modules in the locker cannot perform intelligent processing functions, such as image acquisition and video acquisition. Existing solutions often use hardware solutions such as door opening and closing sensors or angle sensors to obtain accurate door opening angles. However, setting up hardware solutions in each locker will make the cost higher and is not suitable for wide application.
[0003] In view of the existing technical defects, how to provide a solution to make the timing of image acquisition more accurate is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0004] The present application at least provides an image acquisition method, an electronic device and a storage medium.
[0005] The present application provides an image acquisition method, comprising: acquiring a target image acquired by an image acquisition device at a current moment for a target area in a locker, wherein one of the target area and the image acquisition device is located in a cabinet body in the locker, and the other is located in a cabinet door of the locker; determining initial angles between each predicted line segment in the target image and a preset line segment in the target image based on position information of at least one predicted line segment in the target image, wherein each predicted line segment in the target image is obtained by detecting a straight line of the target image; determining a target angle between the cabinet body and the cabinet door according to each initial angle; and starting another image acquisition device in the locker in response to the degree of the target angle between the cabinet body and the cabinet door satisfying a preset condition.
[0006] The present application provides an image acquisition device, comprising: an acquisition module, a first determination module, a second determination module and a start module; the acquisition module is used to acquire a target image acquired by the image acquisition device at a current moment for a target area in a locker, wherein one of the target area and the image acquisition device is located in a cabinet body in the locker, and the other is located in a cabinet door of the locker; the first determination module is used to determine, based on position information of at least one predicted line segment in the target image, initial angles between each predicted line segment in the target image and a preset line segment in the target image, respectively, wherein each predicted line segment in the target image is obtained by detecting a straight line of the target image; the second determination module is used to determine a target angle between the cabinet body and the cabinet door according to each initial angle; and the start module is used to start another image acquisition device in the locker in response to the degree of the target angle between the cabinet body and the cabinet door satisfying a preset condition.
[0007] The present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned image acquisition method.
[0008] The present application provides a computer-readable storage medium on which program instructions are stored. When the program instructions are executed by a processor, the above-mentioned image acquisition method is implemented.
[0009] The above scheme obtains the target image captured by the image acquisition device for the target area in the locker at the current moment, and then determines the initial angles between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image. According to each initial angle, the target angle between the cabinet body and the cabinet door is determined. This method can achieve the accuracy of the target angle by only using the image acquisition device to determine the target image, and then in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition, another image acquisition device in the locker is started. The present application can improve the accuracy of the degree of the target angle determined, so that the timing of starting another image acquisition device in the locker to capture images is more accurate.
[0010] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0012] Figure 1 This is a schematic diagram of the process of an embodiment of the image acquisition method of the present application. Figure 1 ;
[0013] Figure 2This is a schematic diagram of the initial angle of an embodiment of the image acquisition method of the present application;
[0014] Figure 3 is a schematic diagram of a detection line segment of an embodiment of the image acquisition method of the present application;
[0015] Figure 4 This is a schematic diagram of the process of an embodiment of the image acquisition method of the present application. Figure 2 ;
[0016] Figure 5 This is a schematic diagram of the process of an embodiment of the image acquisition method of the present application. Figure 3 ;
[0017] Figure 6 It is a structural schematic diagram of an embodiment of the image acquisition device of the present application;
[0018] Figure 7 It is a structural schematic diagram of an embodiment of the electronic device of the present application;
[0019] Figure 8 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0020] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0021] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0022] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.
[0023] The present application provides some image acquisition methods and image acquisition devices. The application scenarios of the image acquisition method include but are not limited to image acquisition of self-service vending machines. The executor of the image acquisition method may be an image acquisition device. For example, the image acquisition device may be arranged in a terminal device or a server or other processing device, wherein the terminal device may be a device for image acquisition, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, etc. In some possible implementations, the image acquisition method may be implemented by a processor calling computer-readable instructions stored in a memory.
[0024] See also Figure 1 , Figure 1 This is a schematic diagram of the process of an embodiment of the image acquisition method of the present application. Figure 1 Specifically, the image acquisition method may include the following steps:
[0025] Step S11: obtaining a target image captured by the image acquisition device at the target area in the locker at the current moment.
[0026] One of the target area and the image acquisition device is located in the cabinet body of the locker, and the other is located in the cabinet door of the locker. In some application scenarios, the installation position of the target acquisition device includes but is not limited to: installed at the cabinet door handle or on the cabinet body and facing the cabinet door. In some application scenarios, the target image captured by the image acquisition device may only include the target area, and in other application scenarios, it may also include the area on the side of the position where the image acquisition device is located. For example, the image acquisition device is set on the cabinet door, and the image acquisition device can capture the connection between the cabinet body and the cabinet door, so that the captured target image can include the target area and a part of the cabinet door.
[0027] The image acquisition device can acquire an image of a target area in the locker. The image acquisition device may acquire an image of a target area in the locker as a current frame image. The image acquisition device may acquire video data of the target area in the locker. The current frame image is an image frame corresponding to the current moment in the video data. The target image may be the current frame image or an image obtained by a preset process on the current frame image.
[0028] The locker may be a locker for placing several target objects. The locker includes a cabinet body and a cabinet door. Exemplarily, the locker may be a self-service vending cabinet or a refrigerated locker. The specific form of the locker is not limited here. The present application takes a self-service vending cabinet as an example. The types of several target objects may be one or more. Exemplarily, the target object may be a commodity to be sold in the locker, wherein the type of the target object is not limited. The target area is the area where the cabinet body or the cabinet door in the locker is located. Specifically, when the target area is in the area where the cabinet body in the locker is located, the area where the cabinet door of the locker is located is other areas. Or, when the target area is in the area where the cabinet door in the locker is located, the area where the cabinet body of the locker is located is other areas. Exemplarily, because the image acquisition device is placed at different angles and whether the locker is in an open state, the area included in the target image acquired by the image acquisition device may be different. The area included in the target image may be the target area or the target area and other areas. In the case where the image acquisition device is placed at a fixed angle and the locker is in an open state, during the process of the locker door being opened, the area ratio between the target area and other areas contained in the target image acquired by the image acquisition device is in a constantly changing state. Among them, during the process of the locker door being opened, the target area and other areas contained in the target image acquired by the image acquisition device occupy a fixed area of the target image, while the area of the other area of the target image is not fixed. Specifically, in the case where the target area is in the area where the cabinet body of the locker is located, the image acquisition device is in the area where the cabinet door of the locker is located. Or, in the case where the target area is in the area where the cabinet door of the locker is located, the image acquisition device is in the area where the cabinet body of the locker is located.
[0029] Step S12: Based on the position information of at least one predicted line segment in the target image, respectively determine the initial angles between each predicted line segment in the target image and a preset line segment in the target image.
[0030] Each predicted line segment in the target image is obtained by detecting the straight line of the target image. For each predicted line segment, any point on the predicted line segment is used as a change point. The preset line segment in the target image is used to represent the preset reference line segment in the target image. Any point in the reference line segment is used as a reference point.
[0031] The initial angle is used to represent the degree of the angle between each predicted line segment and the preset line segment in the target image. The above step S12 can be to perform straight line detection on the target image to obtain each predicted line segment in the target image. Then, the position information of each predicted line segment in the target image is obtained. For each predicted line segment, based on the position information of the predicted line segment and the position information of the preset line segment in the target image, the angle between the predicted line segment and the preset line segment in the target image is determined, and the angle is the initial angle. The degree of the initial angle is used as the initial angle.
[0032] Specifically, for each predicted line segment, based on the position information of the predicted line segment and the position information of the preset line segment in the target image, the step of determining the initial angle between the predicted line segment and the preset line segment in the target image can be that in each initial angle, the preset line segment is used as the reference edge, the predicted line segment is used as the variable edge, and the angle between the reference edge and the variable edge is used as the initial angle.
[0033] See also Figure 2 , Figure 2 It is a schematic diagram of the initial angle of an embodiment of the image acquisition method of the present application.
[0034] In some application scenarios, for each predicted line segment, the changing point of the changing edge is overlapped with the reference point of the reference edge by moving the changing edge and the reference edge to obtain the overlap point, thereby determining the initial angle between the predicted line segment and the preset line segment in the target image. For example, Figure 2 As shown, the reference point is one of the endpoints of the preset segment. For example, the reference point is the P0 point. The changing point is one of the endpoints of the predicted segment. If the initial angle of the initial angle is greater than 180 degrees, the reference point is transformed into another endpoint of the preset segment, or the changing point is transformed into another endpoint of the predicted segment. It can be understood that the initial angle of the initial angle is less than or equal to 180 degrees. In other application scenarios, for each predicted segment, the changing point is one of the endpoints of the predicted segment, and the position information between the changing point and the other endpoint can be used to determine whether the changing point is a changing point that meets the endpoint screening condition. If the changing point is not a changing point that meets the endpoint screening condition, perform the above-mentioned step of transforming the changing point into the other endpoint of the predicted segment. Specifically, in the case where the reference edge is the x-axis in the target image, in response to the coordinate value corresponding to the y-axis coordinate of the changing point being less than or equal to the coordinate value corresponding to the y-axis coordinate of the other endpoint, the changing point is determined to be a changing point that meets the endpoint screening condition. For example, Figure 2When the first predicted line segment, the second predicted line segment and the third predicted line segment are used as the change edge, the change point is a change point that meets the endpoint screening condition. Specifically, the change points of the first predicted line segment, the second predicted line segment and the third predicted line segment are all P0 points, and the other endpoints are P1, P2 and P3 respectively. In the case where the reference edge is the y-axis in the target image, in response to the coordinate value corresponding to the x-axis coordinate of the change point being greater than or equal to the coordinate value corresponding to the x-axis coordinate of the other endpoint, the change point is determined to be a change point that meets the endpoint screening condition. It can be understood that the coincidence point is the origin of the coordinate system. In the case where the reference edge is not the x-axis or y-axis in the target image, the x-axis or y-axis in the target image is forced to be set to the position of the reference edge. Then the change point that meets the endpoint screening condition in the above-mentioned change edge is coincided with the reference point of the above-mentioned reference edge to obtain the coincidence point, and then the initial angle between the predicted line segment and the preset line segment in the target image is determined.
[0035] Step S13: Determine the target angle between the cabinet body and the cabinet door according to each initial angle.
[0036] The target angle is the cabinet body and the cabinet door as the two sides of the angle, and the degree of the angle is the target angle.
[0037] Select one of the initial angles as the target angle, or, according to the angle conditions of the initial angles, determine the preset value as the degree of the target angle. The preset value is the expected degree of the angle between the cabinet body and the cabinet door when the cabinet door is in a closed state or an open state. In some application scenarios, the angle condition of each initial angle may be that each initial angle is 0 degrees, and the preset value is 0. In other application scenarios, the angle condition of each initial angle may be that at least one of the initial angles is not 0 degrees, and the preset value is any value within a preset interval, and the preset interval is greater than 0 and less than 180.
[0038] Step S14: in response to the degree of the target angle between the cabinet body and the cabinet door satisfying a preset condition, another image acquisition device in the storage cabinet is started.
[0039] Another image acquisition device in the locker can be placed in the same area of the locker as the above-mentioned image acquisition device, or in a different area. Another image acquisition device is used to perform image recognition on the images to be detected collected by several target objects to obtain image acquisition results. Exemplarily, several target objects can be commodities in the locker. The preset condition can be that the degree of the target angle between the cabinet body and the cabinet door is greater than or equal to the preset degree. Among them, the preset degree can be the angle value corresponding to the minimum angle between the cabinet body and the cabinet door when the cabinet door of the locker is in the open state. The preset condition can be that the degree of the target angle between the cabinet body and the cabinet door is greater than 0 degrees. It can be understood that the degree of the target angle between the cabinet body and the cabinet door meets the preset condition, which can indicate that the cabinet door of the locker is in the open state. When the cabinet door of the locker is in the open state, another image acquisition device in the locker is started so that the other image acquisition device collects images to be detected for several target objects within a preset time and / or controls the heating module in the locker to be in the closed state.
[0040] It can be considered that the target image collected by the image acquisition device may only include the target area, or may include the target area and other areas. Therefore, the target image collected by the image acquisition device of the present application at least includes the image of the target area. In the case where the target image collected by the image acquisition device only includes the target area, because when the locker is in an open state, the target angle between the cabinet body and the cabinet door can be understood as the cabinet body and the cabinet door are two sides of the target angle, one of which is fixed and only the other side changes dynamically, so only the image of the target area is collected, that is, the image of the area where the side of the locker that will produce dynamic changes in the video data is located. In some application scenarios, when the target image collected by the image acquisition device only includes the target area, the initial angle is the initial angle between each predicted line segment in the target area and the preset line segment in the target image. After the above step S13, the cabinet door or cabinet corresponding to other areas is used as the default angle. The target angle between the cabinet and the cabinet door is updated by using the default angle to obtain the updated degree corresponding to the target angle between the cabinet and the cabinet door. The specific updating process may be to subtract the default degree from the target angle between the cabinet and the cabinet door to obtain the updated degree corresponding to the target angle. The above step S14 may be to start another image acquisition device in the locker in response to the updated degree of the target angle between the cabinet and the cabinet door meeting the preset condition.
[0041] The above scheme obtains the target image captured by the image acquisition device for the target area in the locker at the current moment, and then determines the initial angles between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image. According to each initial angle, the target angle between the cabinet body and the cabinet door is determined. This method can achieve the accuracy of the target angle by only using the image acquisition device to determine the target image, and then in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition, another image acquisition device in the locker is started. The present application can improve the accuracy of the degree of the target angle determined, so that the timing of starting another image acquisition device in the locker to capture images is more accurate.
[0042] In some embodiments, before the above step S11, the image acquisition method may further include the following steps: First, the original images acquired by the image acquisition device for several preset areas in the locker are respectively obtained. Secondly, for the original image corresponding to each preset area, based on the position information of at least one predicted line segment in the original image, the original angles between each predicted line segment in the original image and the preset line segment in the original image are respectively determined. Each predicted line segment in the original image is obtained by detecting the straight line of the original image. Subsequently, for each preset area, the standard deviation of each original angle corresponding to the preset area is calculated to obtain the standard deviation angle corresponding to the preset area. Next, the preset area that meets the angle condition is determined as the target area. The angle condition is that the standard deviation angle corresponding to the preset area is the minimum standard deviation angle.
[0043] Usually, lockers are not of a single type, and the same target area or area of interest of the same camera cannot be adapted to multiple lockers at the same time. Therefore, in order to improve the robustness of the algorithm, when the locker is used for the first time, it is necessary to select one of the preset areas of the locker as the target area. In some application scenarios, the method of determining the target area may be to manually select one of the preset areas of the locker as the target area. In other application scenarios, the method of determining the target area may be to automatically select one of the preset areas of the locker as the target area. Specifically, the automatic selection method may be: select several preset areas of different types according to the locker, calculate the angle data in each preset area within 5 seconds after power-on, and count the standard deviation of the angle data of each preset area. At the same time, detect whether the cabinet angle data is obtained. If it is detected, and the standard deviation of the angle data of the preset area is the smallest, then the preset area here is calibrated as the target area. This solution eliminates the tediousness brought by manual operation and avoids the risk of manual operation errors, and can automatically and accurately calibrate the target area.
[0044] Several may refer to one or more. The preset area may be an area that may be confirmed as a target area. The preset area is obtained based on experience. The original angle is used to indicate the degree of the angle between each predicted line segment and the preset line segment in the original image. The position of the preset line segment in the original image and the position of the predicted line segment in the target image may be the same position in each image. For example, taking the center of each image as a reference point, the preset line segment in each image is extended horizontally from the reference point. It can be understood that the original images collected may be different between different preset areas, and then the predicted line segments in each original image may be different, and then the original angles corresponding to each original image may be different.
[0045] The process of acquiring the original image can refer to the above step S11. The image acquisition device performs video acquisition of the preset area in the locker to obtain the image frame corresponding to the current moment in the video data, wherein the image frame can be directly determined as the original image, or the image frame can be used as the original image after the preset processing. For the original image corresponding to each preset area, based on the position information of at least one predicted line segment in the original image, the original angle between each predicted line segment in the original image and the preset line segment in the original image can be determined respectively, which can refer to the above step S12. After acquiring each predicted line segment in the original image, the degree corresponding to the angle between each predicted line segment in the original image and the preset line segment in the original image is determined as the original angle. The original angles obtained by the original image corresponding to each preset area are the angle data of the above preset area. After acquiring the angle data of the preset area, by measuring the optimal door opening angle range of different lockers and binding them with the preset area, when the degree of the target angle is set to be within the optimal door opening angle range, the images acquired by another image acquisition device must meet the capture standard.
[0046] Specifically, for each preset area, the process of calculating the standard deviation of each original angle corresponding to the preset area can refer to formula (1):
[0047] Formula (1);
[0048] in, It is the standard deviation angle corresponding to any preset area. is any original angle corresponding to any preset area. n is the total number of original angles corresponding to any preset area. A can represent the average value of the original angles corresponding to any preset area.
[0049] In some embodiments, the target image is obtained by a preset process of the current frame image, and the above step S11 may include the following steps: sampling each pixel in the current frame image to obtain a plurality of sampled pixels. According to the brightness of each sampled pixel, the gray value of each sampled pixel is determined. Based on the location information of the target area and the gray value of each sampled pixel, the target image is determined.
[0050] The target image can be obtained by performing preset processing on the current frame image. Specifically, each pixel point in the current frame image is sampled to obtain multiple sampled pixel points. Exemplarily, in order to reduce the amount of calculation, the pixel points of the current frame image are first sampled, and at the same time, in order to facilitate the subsequent angle calculation, the image is flipped up and down and left and right to obtain the coordinate point information (Xi, Yi) of the sampled pixel points. Specifically, the process of determining the coordinate point information of the sampled pixel points can refer to formula (2) and formula (3):
[0051] Formula (2);
[0052] Formula (3);
[0053] Wherein, src_x and src_y are the horizontal and vertical coordinate values of the current frame image, respectively. WIDTH and HEIGHT are the width and length of the current frame image, respectively. SAMPLED_WIDTH and SAMPLED_HEIGHT are the width and length of the sampled image. Exemplarily, the length and width of the sampled image are the preset length and preset width. Xi and Yi are the horizontal and vertical coordinate values of any pixel point in the sampled image, that is, the horizontal and vertical coordinate values of the sampled pixel point.
[0054] Specifically, the target image may include images of the target area and other areas, that is, the target image includes relevant information at the angle between the cabinet body and the cabinet door above the locker. The acquired video format is YUYV format data, and the code stream is Y1U1Y2V1Y3U2Y4V2..., so converting the current frame image in the YUYV data into grayscale data (Gray data) only requires extracting the Y component as the Gray pixel value, that is, the grayscale value of each pixel in the current frame image. That is, grayscale data: Y1Y2Y3... According to the brightness of each sampled pixel, determine the grayscale value of each sampled pixel. Calculate the image grayscale value of the sampled image, that is, determine the grayscale value of each sampled pixel. Specifically, the process of determining the grayscale value of each pixel in the current frame image can refer to formula (4):
[0055] Formula (4);
[0056] Among them, YUV is the above YUYV code stream data, is the grayscale value of each sampled pixel, src_x and src_y are the horizontal and vertical coordinate values of any pixel in the current frame image respectively. are the width of the current frame image respectively. Then, after the grayscale value of each pixel in the current frame image is obtained, the grayscale value of each sampled pixel is determined from the grayscale value of each pixel in the current frame image.
[0057] In some embodiments, the above-mentioned step of determining the target image based on the position information of the target area and the grayscale value of each sampled pixel may include the following steps: determining the candidate pixels belonging to the target area from each sampled pixel according to the position information of the target area; obtaining floating-point data corresponding to each candidate pixel, each floating-point data being used to represent the numerical value corresponding to the coordinate value corresponding to the horizontal coordinate and the vertical coordinate of each candidate pixel being in a decimal position; for each candidate pixel, determining the grayscale image data of the candidate pixel according to the reference data corresponding to the candidate pixel, the grayscale value of the candidate pixel, and the grayscale value of at least one adjacent candidate pixel, the reference data being obtained based on the coordinate value and the floating-point data in the position information of the candidate pixel; and using the grayscale image data of each candidate pixel as the image data corresponding to the target image.
[0058] The location information of the target area can represent the image range of the target area in the current frame image.
[0059] The candidate pixel points are used to represent the sampled pixel points belonging to the target area in the current frame image. Each candidate pixel point corresponds to a floating point data, wherein the floating point data corresponding to the candidate pixel point is related to the coordinate value in the position information of the candidate pixel point. The coordinate value of the candidate pixel point includes the horizontal coordinate value and the vertical coordinate value of the candidate pixel point, and the horizontal coordinate value and the vertical coordinate value may belong to floating point data. The floating point data corresponding to the candidate pixel point includes the first floating point data related to the horizontal coordinate value of the candidate pixel point and the second floating point data related to the vertical coordinate value of the candidate pixel point.
[0060] The first floating-point data can be represented as the numerical value corresponding to the decimal position of the horizontal coordinate value of the candidate pixel point. The second floating-point data can be represented as the numerical value corresponding to the decimal position of the vertical coordinate value of the candidate pixel point. For example, if the position information of any candidate pixel point is (2.3, 5.5), the coordinate values of the candidate pixel point are the horizontal coordinate value of the candidate pixel point is 2.3 and the vertical coordinate value is 5.5. The floating-point data corresponding to the candidate pixel point includes the numerical value 0.3 related to the horizontal coordinate of the candidate pixel point, that is, the first floating-point data corresponding to the candidate pixel point is 0.3. The floating-point data corresponding to the candidate pixel point includes the numerical value 0.5 related to the vertical coordinate of the candidate pixel point, that is, the second floating-point data corresponding to the candidate pixel point is 0.5.
[0061] In some embodiments, at least one adjacent candidate pixel of each candidate pixel includes a first adjacent pixel, a second adjacent pixel, and a third adjacent pixel, the first adjacent pixel, the second adjacent pixel, and the third adjacent pixel are located in different directions of the candidate pixel, the reference data includes a reference abscissa value associated with the abscissa of the candidate pixel and a reference ordinate value associated with the ordinate of the candidate pixel, and the above step of determining the grayscale image data of the candidate pixel according to the reference data corresponding to the candidate pixel, the grayscale value of the candidate pixel, and the grayscale value of at least one adjacent candidate pixel for each candidate pixel may include the following steps: Based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the candidate pixel point, the first grayscale image data is determined; and based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the first adjacent pixel point, the second grayscale image data is determined; and based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the second adjacent pixel point, the third grayscale image data is determined; and based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the third adjacent pixel point, the fourth grayscale image data is determined; the grayscale image data of the candidate pixel point is obtained by combining the first grayscale image data, the second grayscale image data, the third grayscale image data and the fourth grayscale image data.
[0062] The reference data is obtained based on the coordinate values and floating-point data in the position information of the candidate pixel. The horizontal coordinate value and the vertical coordinate value of any candidate pixel are the current horizontal coordinate value and the current vertical coordinate value, respectively. Exemplarily, if the position information of any candidate pixel is (2.3, 5.5), the current horizontal coordinate value is 2.3 and the current vertical coordinate value is 5.5. The reference data of the candidate pixel includes a reference horizontal coordinate value related to the horizontal coordinate of the candidate pixel and a reference vertical coordinate value related to the vertical coordinate of the candidate pixel. Specifically, for each candidate pixel, a conversion process is performed based on the coordinate value in the position information of the candidate pixel and the first floating-point data and the second floating-point data in the floating-point data to obtain the reference data corresponding to the candidate pixel. Specifically, the conversion process can be an addition or subtraction process between the current coordinate value and the floating-point data. Exemplarily, the difference obtained by subtracting the current horizontal coordinate value from the first floating-point data is used as the reference horizontal coordinate value related to the horizontal coordinate of the candidate pixel. The difference obtained by subtracting the current vertical coordinate value from the second floating-point data is used as the reference vertical coordinate value related to the horizontal coordinate of the candidate pixel.
[0063] At least one adjacent candidate pixel of each candidate pixel includes a first adjacent pixel, a second adjacent pixel and a third adjacent pixel, and the first adjacent pixel, the second adjacent pixel and the third adjacent pixel are in different directions of the candidate pixel. Different directions are used to indicate that the angles between the lines between the candidate pixel and each adjacent pixel and the horizontal axis or the vertical axis are different. The nearest other candidate pixel in at least three different directions of the candidate pixel is taken as the first adjacent pixel, the second adjacent pixel and the third adjacent pixel, and the other candidate pixels are pixels other than the candidate pixel. At least three different directions can be horizontal, vertical and other directions respectively. Specifically, at least one adjacent candidate pixel includes a first adjacent pixel whose horizontal coordinate value is larger than the current horizontal coordinate value, a second adjacent pixel whose vertical coordinate value is larger than the current vertical coordinate value, and a third adjacent pixel whose horizontal coordinate value and vertical coordinate value are larger than the current horizontal coordinate value and the current vertical coordinate value respectively, and at least one adjacent candidate pixel includes the first adjacent pixel, the second adjacent pixel and the third adjacent pixel. Exemplarily, the horizontal coordinate value of the first adjacent pixel point is greater than the current horizontal coordinate value by a first preset value, and the vertical coordinate value of the first adjacent pixel point is the same as the current vertical coordinate value. The vertical coordinate value of the second adjacent pixel point is greater than the current vertical coordinate value by a second preset value, and the horizontal coordinate value of the second adjacent pixel point is the same as the current horizontal coordinate value. The horizontal coordinate value of the third adjacent pixel point is greater than the current horizontal coordinate value by a first preset value, and the vertical coordinate value of the third adjacent pixel point is greater than the current vertical coordinate value by a second preset value. The first preset value and the second preset value may be the same or different. The present application takes the example that the first preset value is the same as the second preset value. For example, the first preset value and the second preset value may both be 1.
[0064] In some application scenarios, after determining the reference abscissa value and the reference ordinate value, the product between the reference abscissa value and the reference ordinate value can be directly used as the initial product value. The candidate grayscale value includes the grayscale value of any candidate pixel and the grayscale value corresponding to at least one adjacent candidate pixel associated with the candidate pixel. At least one grayscale image data includes the grayscale image data corresponding to the candidate pixel and the grayscale image data corresponding to at least one adjacent candidate pixel. Based on the reference abscissa value, the reference ordinate value and the candidate grayscale value, the step of determining at least one grayscale image data can be: respectively multiplying the initial product value with the grayscale value corresponding to at least one adjacent candidate pixel to obtain at least one grayscale image data. Exemplarily, the at least one grayscale image data includes the first grayscale image data, the second grayscale image data, the third grayscale image data and the fourth grayscale image data. Directly multiplying the initial product value with the grayscale value of the first adjacent pixel is determined as the second grayscale image data. Directly multiplying the initial product value with the grayscale value of the second adjacent pixel is determined as the third grayscale image data. The product of the initial product value and the grayscale value of the third adjacent pixel is directly determined as the fourth grayscale image data. Exemplarily, for any candidate pixel, the grayscale image data of the candidate pixel includes the at least one grayscale image data.
[0065] The grayscale image data of each candidate pixel in the target area of the current frame image is directly used as the image data corresponding to the target image.
[0066] It can be considered that determining the grayscale image data of any candidate pixel by using the grayscale values of adjacent pixels in different directions and the reference horizontal and vertical coordinate values can make the grayscale image data of any candidate pixel more accurate, thereby making the image data corresponding to the target image more accurate.
[0067] In some embodiments, the above-mentioned image acquisition method may further include the following steps: the first grayscale image data is the product of the first product value and the grayscale value of the candidate pixel point, wherein the first product is the product of the first transformation value and the second transformation value, and the sum value between the first transformation value and the reference horizontal coordinate value is equal to the sum value between the second transformation value and the reference vertical coordinate value; and, the second grayscale image data is the product of the second product value and the grayscale value of the first adjacent pixel point, and the second product value is the product between the reference horizontal coordinate value and the second transformation value; and, the third grayscale image data is the product of the third product value and the grayscale value of the second adjacent pixel point, and the third product value is the product between the first transformation value and the reference vertical coordinate value; and, the fourth grayscale image data is the product of the fourth product value and the grayscale value of the third adjacent pixel point, and the fourth product value is the product between the reference horizontal coordinate value and the reference vertical coordinate value.
[0068] The sum of the first transformation value and the reference horizontal coordinate value is the first sum. The sum of the second transformation value and the reference vertical coordinate value is the second sum. The first sum is equal to the second sum. The first sum and the second sum may be preset values. The preset value may be set to different values according to different usage requirements. It can be considered that by setting the first sum and the second sum to different values, the gray value of any candidate pixel and the weight of the gray value of at least one adjacent pixel may be adjusted, so that the calculated gray image data of any candidate pixel is more accurate.
[0069] For example, the first summation value and the second summation value may be set to 1, respectively. Exemplarily, the first transformation value and the second transformation value are obtained, the sum between the first transformation value and the reference horizontal coordinate value is one, and the sum between the second transformation value and the reference vertical coordinate value is one. The steps of determining the first product value, the second product value, the third product value, and the fourth product value may be: taking the product between the first transformation value and the second transformation value as the first product value; and taking the product between the reference horizontal coordinate value and the second transformation value as the second product value; and taking the product between the first transformation value and the reference vertical coordinate value as the third product value; and taking the product between the reference horizontal coordinate value and the reference vertical coordinate value as the fourth product value. It can be understood that the fourth product value is the same as the above-mentioned initial product value.
[0070] In other application scenarios, the step of determining the first grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the candidate pixel may be: taking the product between the first product value and the grayscale value of the candidate pixel as the first grayscale image data. In other application scenarios, the step of determining the second grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the first adjacent pixel may be: taking the product between the second product value and the grayscale value of the first adjacent pixel as the second grayscale image data. In other application scenarios, the step of determining the third grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the second adjacent pixel may be: taking the product between the third product value and the grayscale value of the second adjacent pixel as the third grayscale image data. In other application scenarios, the step of determining the fourth grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the third adjacent pixel may be: taking the product between the fourth product value and the grayscale value of the third adjacent pixel as the fourth grayscale image data.
[0071] At the same time, in order to reduce the subsequent straight line detection error caused by the aliasing problem, bilinear interpolation is performed on the Y component in the target area coordinates to achieve grayscale conversion and extract the grayscale image data in the target area. Specifically, based on the location information of the target area and the grayscale value of each sampled pixel, the process of determining the target image can refer to formula (5):
[0072] Formula (5);
[0073] Among them, B1 is used to represent B2 is used to indicate . C1 is used to represent C2 is used to represent D1 is used to indicate D2 is used to indicate . E1 is used to indicate . E2 is used to indicate The first product value, the second product value, the third product value and the fourth product value can be respectively expressed as B1, , as well as . In addition, the current horizontal coordinate value and the current vertical coordinate value corresponding to any candidate pixel point can be expressed as src_x and src_y, respectively. The first floating-point data and the second floating-point data in the floating-point data corresponding to the candidate pixel point can be expressed as src_x_double and src_y_double, respectively. The reference horizontal coordinate value and the reference vertical coordinate value in the reference data can be expressed as dx and dy, respectively. Exemplarily, dx = src_x_double - src_x. dy = src_y_double - src_y. Grayroi is used to represent the grayscale image data corresponding to the target image, Used to represent the grayscale image data corresponding to any candidate pixel in the target image. It can represent the gray value of any candidate pixel among the sampled pixels. , as well as It can be expressed as The grayscale value of the pixel points near any candidate pixel point in each sampled pixel point can be represented by . Specifically, the grayscale value of the first neighboring pixel point, the grayscale value of the second neighboring pixel point, and the grayscale value of the third neighboring pixel point can be represented by , as well as Determining each initial angle through the target image can reduce the amount of calculation in the angle calculation process, improve the operating efficiency, and enable the degree of the target angle to be output in real time.
[0074] In some embodiments, after the above step S11, the image acquisition method may further include the following steps: filtering and / or correcting the target image to obtain a new target image. Then the above step S12 may include the following steps: based on the position information of at least one predicted line segment in the new target image, respectively determining the initial angle between each predicted line segment in the new target image and the preset line segment in the new target image.
[0075] Exemplarily, filtering the target image may be performing Gaussian filtering on the target image to obtain a first processed image. Noise will affect the accuracy of subsequent processing, so the image is subjected to denoising by Gaussian filtering. Gaussian filtering first constructs a 3×3 Gaussian kernel with a variance of 5, and then filters each pixel sliding window. Specifically, the process of filtering the target image can refer to formula (6):
[0076] Formula (6):
[0077] Wherein, G is used to represent the first processed image. G(x, y) represents the value of the Gaussian filter at any pixel point (x, y) of the target image, that is, the first processed image. Used to represent the standard deviation, thereby smoothing noise and reducing the staircase effect. Used to represent Gaussian functions.
[0078] Exemplarily, the correction processing of the target image may be to perform Gamma correction processing on the target image to obtain a second processed image. The refrigerator lens faces the problem of lens dirtiness and fogging, which causes the image to be blurred, which has a great impact on the gradient solution of the subsequent algorithm and affects the accuracy of the subsequent straight line detection. Therefore, it is necessary to appropriately avoid this problem by reducing the brightness and increasing the contrast. Therefore, Gamma correction is selected for processing, which improves the stability of the method in the actual application scenario and ensures the accuracy of the angle output. Specifically, the process of filtering the target image can refer to formula (7):
[0079] Formula (7);
[0080] in Used to indicate that after correction processing, a second processed image is obtained. Used to represent the target image, and y can represent the coordinate value of the horizontal coordinate and the coordinate value of the vertical coordinate of any pixel point in the target image respectively. γ is used to represent the gamma coefficient, which is used to adjust the brightness and contrast of the image. For example, the default configuration gamma coefficient is 0.5.
[0081] In the case of simultaneously performing filtering and correction processing on the target image, the filtering and correction processing are performed in series to obtain a new target image. In some application scenarios, the target image may be first filtered to obtain a first processed image, and the first processed image may be corrected to obtain a new target image. In some application scenarios, the target image may be first corrected to obtain a second processed image, and the second processed image may be corrected to obtain a new target image.
[0082] In some embodiments, the image acquisition method may further include the following steps: performing straight line detection on the target image according to at least one of several preset straight line detection algorithms to obtain several detected line segments; and determining each predicted line segment based on the several detected line segments.
[0083] Specifically, the step of performing straight line detection on the target image to obtain each predicted line segment in the target image may be to perform straight line detection on the image input by the straight line detection module through the straight line detection module to obtain a straight line detection result. The image input by the straight line detection module may be the target image. A preset straight line detection algorithm is set on the straight line detection module. The straight line detection result may include the position information of at least one predicted line segment or detected line segment in the target image. Several preset straight line detection algorithms may be used to perform straight line detection on an image. The preset straight line detection algorithm may be a Hough transform (hough transform) or a line segment detection algorithm (LSD, LSD: a Line Segment Dectctor). Methods such as hough transform have good accuracy in straight line detection, but due to their high time and space complexity. This application takes the faster method, the straight line segment detection algorithm LSD algorithm, as an example for straight line detection.
[0084] Exemplarily, the image input by the line detection module is subjected to a 2×2 window gradient calculation to obtain the gradient magnitude and direction, and the gradient value and gradient direction of each pixel are calculated. The image input by the line detection module can be a target image, or the target image can be subjected to filtering and / or correction processing to obtain a new target image. The gradient values calculated are pseudo-randomly arranged (referred to as pseudo-arrangement) to place all pixels from large to small in a 1024 binary file (bin), and a state list is established, with all points set to UNUSED. The corresponding position in the state table of points with a gradient value less than ρ is set to USED. The point with the largest gradient (the first point in the pseudo-arrangement) in the list is taken as the seed point (seed), and is set to USED in the state list. Starting from the seed point, the gradient is regionally grown. If the angle difference of the eight neighborhoods is less than the tolerance angle, the UNUSED point is included in the region, the average gradient direction and magnitude are calculated, and the point is marked as USED. Starting from the seed point, search for points around UNUSED whose directions are within the threshold [-t, t], and the state is changed to USED. The area formed by the points (eight neighborhoods) that meet the seed point search angle and are in the UNUSED state is called the line-support region. If the angle difference of the eight neighborhoods is less than the tolerance angle, the UNUSED point is included in the region and averaged. Average the gradient direction and size, and mark the point as USED. Points in the neighborhood that meet the direction angle region-ang of the entire region within the angle tolerance range t are added to this region. Each time a point is added, the region is updated. Generate a rectangle R containing all satisfied points. Determine whether the density of homogeneous points (aligned pt) meets the threshold D. If not, truncate the rectangle R into multiple rectangular boxes until it meets. Calculate the density of homogeneous points. If the density of homogeneous points is less than the preset value, truncate it and start regional growth at the next seed point. If the density of homogeneous points is greater than the preset value, the number of false alarms (NFA, Number of False Alarms) is used to determine whether each rectangle R can be output as a detected line segment. Specifically, the value of the number of false positive detections NFA is calculated, the rectangle R is changed to obtain a changed rectangle so that the value of the NFA corresponding to the changed rectangle is smaller until the value of the NFA is less than or equal to the threshold value ε of the number of false positive detections, and the changed rectangle is taken as a detection line segment and added to the output list. It can be understood that the output list is used to store each detection line segment.
[0085] In some application scenarios, after the straight line detection process, each detected line segment can be directly used as each predicted line segment. In other application scenarios, after the straight line detection process, each detected line segment obtained by the straight line detection can be screened to obtain each predicted line segment. Each detected line segment detected by the straight line is used to calculate the angle and obtain the initial angle later, but it needs to be screened. In the selected target area, in ordinary scenarios, the longest line segment should be located at the edge of the cabinet door and the cabinet body, where the direction of the long line segment on the cabinet body is often relatively consistent. Therefore, the set of detected line segments detected by the straight line actually only needs the long line segments on the cabinet body and the cabinet door. If there are other line segments with the same direction as the cabinet body or cabinet door line segment, it will not affect the subsequent results. In addition, considering that the performance of details or small edge line segments in the data is often that the line segment width is thinner and the line segment length is shorter, line segment screening is performed based on this. Considering that the detection line segments of the details inside or outside the cabinet body often have a large angle difference with the target direction and are disordered, it is necessary to screen these line segments before subsequent operations. The target direction may be the direction of the reference edge, specifically, the x-axis direction or the y-axis direction.
[0086] In some application scenarios, based on a number of detected line segments, determining each predicted line segment may be to directly use the several detected line segments as each predicted line segment.
[0087] In some embodiments, the above-mentioned step of determining each predicted line segment based on a number of detected line segments may include the following steps: determining the average line segment width corresponding to a number of detected line segments and the average line segment length corresponding to a number of detected line segments; retaining the detected line segments that do not meet the line segment screening conditions to obtain at least one retained line segment and using the retained line segments as predicted line segments, the line segment screening conditions including a first line segment screening condition and / or a second line segment screening condition, the first line segment screening condition including that the line segment width of the detected line segment is less than the average line segment width; the second line segment screening condition including that the line segment length of the detected line segment is less than a threshold line segment length, the threshold line segment length being the sum of the average line segment length and an offset.
[0088] In another application scenario, for a plurality of detected line segments, the step of determining each predicted line segment may be: for each detected line segment, the line segment length is calculated. Then, among all detected line segments, the line segment width and the line segment length are averaged to obtain the line segment width average and the line segment length average, respectively. Subsequently, the detected line segments that meet the line segment screening condition are filtered out, and the detected line segments that do not meet the line segment screening condition are retained to obtain the retained line segments and use the retained line segments as each predicted line segment.
[0089] For each detected line segment, the line segment length of the detected line is specifically calculated based on the line segment coordinates. Exemplarily, the line segment length of the detected line can be the distance between the two endpoints of the detected line segment. Solving for the distance between the two endpoints can be calculating the Euclidean distance. Specifically, the process of calculating the line segment length based on the line segment coordinates can refer to Equation (8):
[0090] Equation (8);
[0091] Among them, x1 and y1 correspond to the x-axis coordinate value and the y-axis coordinate value in the coordinates of one of the endpoints of the detected line segment, and x2 and y2 correspond to the x-axis coordinate value and the y-axis coordinate value in the coordinates of the other endpoint of the detected line segment. is used to represent the square root. is used to represent the line segment length of the detected line segment.
[0092] The line segment screening conditions include the first line segment screening condition and / or the second line segment screening condition. Among them, the first line segment screening condition includes that the line segment width of the detected line segment is less than the average line segment width. The first line segment screening condition can be expressed as widths[i]<median_width. Among them, widths[i] can represent the line segment width of any detected line segment, i is used to represent any detected line segment, and median_width is used to represent the average line segment width. The second line segment screening condition includes that the line segment length of the detected line segment is less than the threshold line segment length, and the threshold line segment length is the sum of the average line segment length and the offset. The second line segment screening condition can be expressed as line_lengths[i]<(median_lengths + LINE_LENGTH_OFFSET). Among them, line_lengths[i] can represent the line segment length of any detected line segment, i is used to represent any detected line segment. median_lengths can represent the average line segment length corresponding to all detected line segments, and LINE_LENGTH_OFFSET can represent the offset. It can be understood that the offset can be preset. The offset can also be obtained by fine-tuning the preset offset according to the distribution of each line segment length. If the distribution of each line segment length is more concentrated around the average line segment length, the fine-tuning value is smaller. If the distribution of each line segment length is less concentrated around the average line segment length, the fine-tuning value is larger. In addition, the main reason for using the offset is that the difference in line segment widths is small and the features are not obvious. However, using the line segment length for screening meets our requirements. If there are too many short and medium-length line segments among the detections compared to long line segments at this time, it may not be possible to filter out all the line segments with small offsets. Although the subsequent processing can correct the angle, for the sake of accuracy, an offset is added here to further filter out shorter detected line segments.
[0093] It can be considered that after screening each detected line segment, most of the predicted line segments have overlapped with the direction of the cabinet door or the direction difference is small, and then the initial angle is determined, so that the determined initial angle is more accurate.
[0094] In some embodiments, the above step S12 may include the following steps: first, determine whether the number of initial angles is greater than the second number. Then, in response to the number of initial angles being less than or equal to the second number, use each initial angle as a candidate angle. Or, in response to the number of initial angles being greater than the second number, cluster the initial angles to obtain angles corresponding to each cluster; use the angles corresponding to each cluster as candidate angles.
[0095] The second number can be set according to the accuracy requirement of determining the target angle. Exemplarily, the second number can be set to 2. The number of initial angles is the total number of initial angles, which is equal to the total number of predicted segments. In some application scenarios, when the number of initial angles is less than or equal to the second number, for each initial angle, the initial angle is directly determined as a candidate angle. It can be considered that the initial angle belongs to the first type. Exemplarily, the first type can be that the predicted segment is a single segment, and the initial angle is a single segment angle. In other application scenarios, the angle corresponding to each cluster cluster can be the average of all initial angles belonging to the cluster cluster. In response to determining the angle corresponding to each cluster cluster, the angle corresponding to the cluster cluster is directly used as a candidate angle. When the initial angle is greater than the second number, it means that the total number of initial angles is large at this time, and it is necessary to cluster the initial angles to obtain initial angles of each type. The initial angles of each type can be expressed as the angles corresponding to each cluster cluster. The clustering method may be implemented by a preset clustering algorithm, which may be a K-means clustering algorithm or a hierarchical clustering algorithm.
[0096] In some embodiments, the above step S13 may include the following steps: determining a target angle between the cabinet body and the cabinet door according to each candidate angle.
[0097] Based on each candidate angle, the step of determining the target angle between the cabinet body and the cabinet door can be: adjusting each candidate angle according to a reference condition to obtain an adjusted angle corresponding to each candidate angle, the reference condition includes a first reference condition and / or a second reference condition, the first reference condition includes adjusting the candidate angle less than a preset threshold to a first fixed value, the second reference condition includes taking the difference between the candidate angle greater than or equal to the preset threshold and the second fixed value as the adjusted angle; based on each adjusted angle, determining the target angle.
[0098] In some application scenarios, when the number of initial angles is less than or equal to the second number, for each initial angle, the initial angle is mapped to obtain a mapped angle. Based on each mapped angle, determining each candidate angle may include: determining each mapped angle as each candidate angle. In other application scenarios, when the number of initial angles is greater than the second number, based on each mapped angle, determining each candidate angle may include: clustering each initial angle to obtain an angle corresponding to each cluster cluster. Then, for the angle corresponding to each cluster cluster, the angle corresponding to the cluster cluster is mapped to obtain a mapped angle. Subsequently, each mapped angle is determined as each candidate angle. Since the lens of the image acquisition device often has a certain degree of distortion, the obtained image often has a gap with the actual image, so it is necessary to obtain a candidate angle close to reality by mapping each initial angle or the angle corresponding to each cluster cluster. Among them, the mapping process can be to calculate the mapped angle by linear operation or nonlinear operation. The present application adopts linear operation to implement the above-mentioned mapping process to obtain the mapped angle.
[0099] In some application scenarios, the obtained line segments are classified by clustering methods, and the present application adopts the K-means clustering method. According to past experience, each initial angle can be roughly divided into two categories, and the clusters can be divided into door types and cabinet types. In the clustering algorithm, each initial angle is clustered, so the centroid corresponds to the angle. In the clustering algorithm, the initialized centroid is determined. The initialized centroid can correspond to the initialization angle. The centroid can be divided into the door type and the cabinet type in each cluster. Calculate the distance from each point to the centroid, and the point closest to a certain type of centroid is used as the current class, where, in the clustering algorithm, each point refers to other initial angles except the angle corresponding to the centroid. The initial angles belonging to the two types of clusters are averaged respectively, and the average value is used as the new centroid. The distance from each point to the new centroid is calculated with the new centroid, and the point closest to a certain type of centroid is used as the current class. The initial angles belonging to the two types of clusters are averaged respectively, and the average value is used as the new centroid. The distance from each point to the new centroid is calculated with the new centroid, and the point closest to a certain type of centroid is used as the current class. The initial angles belonging to the two types of clusters are averaged respectively, and the average value is used as the new centroid. In response to the new center of mass sought in the current round being consistent with the angle of the new center of mass obtained in the previous round, the new center of mass sought in the current round is used as the output angle. Specifically, in response to there being two new center of mass, the angles corresponding to the two new center of mass are used as the angles corresponding to the two clusters. In response to there being only one new center of mass, the angles corresponding to the new center of mass are used as the angles corresponding to the clusters. In response to the new center of mass sought in the current round being inconsistent with the angle of the new center of mass obtained in the previous round, the new center of mass calculated in the next round is continued to be sought until the new center of mass meets the conditions.
[0100] In some embodiments, the above-mentioned step S13 may include the following steps: adjusting each initial angle according to a reference condition to obtain an adjusted angle corresponding to each initial angle, the reference condition includes a first reference condition and / or a second reference condition, the first reference condition includes adjusting the initial angle less than a preset threshold to a first fixed value, and the second reference condition includes taking the difference between the initial angle greater than or equal to the preset threshold and the second fixed value as the adjusted angle; based on each adjusted angle, determining the target angle.
[0101] For each initial angle, it is determined whether the initial angle is less than a preset threshold.
[0102] In some application scenarios, in response to the initial angle being less than a preset threshold, the initial angle is adjusted according to a first reference condition to obtain an adjusted angle corresponding to the initial angle. Specifically, the initial angle is directly adjusted to a first fixed value. For example, the first fixed value may be 0, and the adjusted angle is 0 degrees. It is understandable that the first fixed values of different lockers may be the same.
[0103] In other application scenarios, in response to the initial angle being greater than or equal to a preset threshold, the initial angle is adjusted according to a second reference condition to obtain an adjusted angle corresponding to the initial angle. Specifically, the second fixed value is subtracted from the initial angle, and the difference obtained is used as the adjusted angle. For example, the second fixed value is 20. The adjusted angle is 20 degrees less than the initial angle. It is understandable that the second fixed value of different lockers can be set according to the accuracy requirement of the target angle, and the second fixed value of different lockers can be different.
[0104] In the case where the reference condition includes a first reference condition and a second reference condition, the steps of adjusting each initial angle according to the first reference condition and the second reference condition can be performed in parallel or in series. In the case of serial execution, it is not limited here whether each initial angle is adjusted according to the first reference condition first or according to the second reference condition first.
[0105] It can be considered that by adjusting the initial angle through reference conditions, the adjusted angle can be more accurate, the target angle determined based on the adjusted angle can be more accurate, and then the degree of the target angle determined can be more accurate, making the startup timing of another image acquisition device, that is, the image acquisition timing, more accurate.
[0106] In some embodiments, the step of determining the target angle based on the adjusted angles may include the following steps: first, in response to the number of the adjusted angles being less than the first number, determining the adjusted angles as the target angle; or, in response to the number of the adjusted angles being greater than or equal to the first number, determining the largest adjusted angle as the target angle. Subsequently, in response to the target angle being greater than or equal to an expected threshold, determining the target angle as the degree of the target angle, the expected threshold being used to characterize the angle value corresponding to the minimum angle between the cabinet body and the cabinet door when the locker is in the open state.
[0107] According to the total number of adjusted angles, one angle is selected from each adjusted angle as a target angle. Get the total number of adjusted angles.
[0108] In some application scenarios, when the total number of adjusted angles is less than the first number, for example, the first number may be 2. At this time, the total number of adjusted angles is 1, and the adjusted angle is directly determined as the target angle. Specifically, the adjusted angle may be the initial angle corresponding to a single line segment angle obtained by adjusting according to a reference condition, or may be the angle corresponding to only one cluster cluster obtained by adjusting according to a reference condition. For example, the first number may be 3. At this time, the total number of adjusted angles is 3, and the average value of the adjusted angles is directly determined as the target angle. In other application scenarios, when the total number of adjusted angles is greater than or equal to the first number, for example, the first number may be 2. At this time, the total number of adjusted angles may be 2, and each adjusted angle may be an angle corresponding to each cluster cluster. At this time, there are angles corresponding to two types of cluster clusters, and the largest angle among the angles corresponding to the two types of cluster clusters is determined as the target angle, that is, the largest adjusted angle is determined as the target angle.
[0109] It can be considered that in different scenarios, the target angle determined based on the adjusted angle is more accurate, and thus the degree of the target angle determined is more accurate, making the start timing of another image acquisition device, that is, the image acquisition timing, more accurate.
[0110] Because it is hoped that when the door of the locker is in a closed state, the degree of the target angle is 0 degrees. In addition, the degree of the target angle may not be 0 degrees due to the shaking of the placement of the image acquisition device. Therefore, after obtaining the target angle, it is necessary to compare the target angle with the expected threshold. The expected threshold can be 0 or other non-zero values. When the target angle is greater than or equal to the expected threshold, it means that the target angle can indicate that the door of the locker is in an open state, and the target angle is determined as the degree of the target angle.
[0111] In some embodiments, the image acquisition method may further include the following steps: in response to the target angle being less than a desired threshold, acquiring a preset angle; and determining the preset angle as the degree of the target angle.
[0112] The method of obtaining the preset angle can be automatically calibrated to the degree of the angle between the cabinet door and the cabinet body when the cabinet door is in a closed state, or it can be manually calibrated to the degree of the preset angle. The preset angle can be used to indicate the degree of the angle between the cabinet door and the cabinet body when the cabinet door is in a closed state. The preset angle can be 0 degrees. When the target angle is less than the expected threshold, the degree of the target angle may not be 0 degrees. In this case, the target angle needs to be forcibly determined as the preset angle, that is, 0 degrees.
[0113] Exemplarily, for the degree of the target angle as the final output, what is initially needed is the degree of the angle between the cabinet and the cabinet door. In some application scenarios, when the image acquisition device is on the cabinet door, it is known that the cabinet moves during the opening and closing of the cabinet door, but the cabinet door is relatively fixed, so the cabinet door angle can be regarded as a fixed angle, and the cabinet angle is directly subtracted from the fixed value to solve, and the target angle less than the desired threshold is directly set to zero. Specifically, the processing of the cabinet door angle can be directly set to zero, and the processing of the cabinet angle can be mapping the cabinet angle, and determining the candidate angle corresponding to the cabinet angle. In other application scenarios, when the image acquisition device is on the cabinet, it is known that the cabinet door moves during the opening and closing of the cabinet door, but the cabinet is relatively fixed, so the cabinet angle can be regarded as a fixed angle, and the cabinet door angle is directly subtracted from the fixed value to solve, and the target angle less than the desired threshold is directly set to zero. Specifically, the processing of the cabinet angle can be directly set to zero, and the processing of the cabinet door angle can be mapping the cabinet door angle and determining the candidate angle corresponding to the cabinet door angle. In this way, the problem changes from solving the degree of the angle between the cabinet door and the cabinet as the degree of the target angle to only solving the target angle obtained by the initial angle corresponding to the cabinet in the target area, or only solving the target angle obtained by the initial angle corresponding to the cabinet door in the target area. It can be understood that the cabinet angle can refer to the initial angle corresponding to the angle between the predicted line segment in the cabinet area and the preset line segment in the target image. The cabinet door angle can refer to the initial angle corresponding to the angle between the predicted line segment in the cabinet door area and the preset line segment in the target image.
[0114] In some embodiments, the image acquisition method may further include the following steps: first, obtaining the degree difference between the target angle and the historical angle, the historical angle being the target angle between the cabinet and the cabinet door determined based on the target image acquired at a historical moment; second, in response to the degree difference being greater than or equal to a threshold difference, using the historical angle as the final angle between the cabinet and the cabinet door at the current moment; or, in response to the degree difference being less than the threshold difference, using the target angle as the final angle between the cabinet and the cabinet door at the current moment.
[0115] The degree difference may be the absolute value of the difference between the degree of the target angle and the degree of the historical angle. The threshold difference is used to represent the maximum change value of the degree of the angle between the cabinet body and the cabinet door within a certain period of time. The historical moment may be any moment before the current moment. For example, the historical moment may be the acquisition time corresponding to the previous frame image before the current frame image acquisition time corresponding to the current moment.
[0116] Determine whether the angle difference is greater than the threshold difference. In some application scenarios, when the degree difference is greater than or equal to the threshold difference, the degree of the historical angle is used as the degree of the final angle between the cabinet body and the cabinet door at the current moment. In other application scenarios, when the degree difference is less than the threshold difference, the degree of the target angle is used as the degree of the final angle between the cabinet body and the cabinet door at the current moment.
[0117] In some embodiments, the above step S14 may include the following steps: in response to the degree of the final angle satisfying a preset condition, starting another image acquisition device in the locker.
[0118] The fact that the degree of the final included angle meets the preset condition may indicate that the degree of the included angle between the cabinet door and the cabinet body of the storage cabinet is greater than or equal to the preset degree.
[0119] When the door of the locker is in an open state, the update of the target angle is a relatively smooth process during the process of opening the door. If there is a large angle jump in the target angle, it may be because an erroneous line segment is detected during the straight line detection process, or the line segment is not detected. At this time, an angle oscillation value is set. If the angle change of the target angle is greater than this oscillation value within a certain period of time, the degree of the historical angle is used to determine the final angle to determine whether to start another image acquisition device in the locker. At this time, the degree of the final angle is compared with the preset conditions, so that the degree of the final angle determined is more in line with reality and the degree is more accurate, thereby making the image acquisition timing of another image acquisition device more accurate.
[0120] In some embodiments, after the above step S14, the image acquisition method may further include the following steps: starting another image acquisition device in the locker may be to capture a picture through another image acquisition device in the locker to obtain a number of images to be detected. Performing image recognition on the images to be detected captured by the target objects to obtain image acquisition results. Inputting the images to be detected into the image recognition module for image recognition to obtain image acquisition results output by the image recognition module. Specifically, obtaining a number of images to be detected, the images to be detected are obtained by another image acquisition device in the locker for capturing a number of target objects within a preset time; performing image processing on the images to be detected to obtain image processing results corresponding to each image to be detected; determining the image acquisition results according to the differences between the image processing results, and the image acquisition results are used to characterize the changes in the number of target objects. Exemplarily, after obtaining the captured information, i.e., a number of images to be detected, selecting two or more images to be detected or any two images to be detected from the images to be detected to perform image segmentation and recognition processing to obtain image acquisition results. The image recognition module uses the YOLOV5 model or other image recognition models trained with the commodity data set for segmentation and recognition, obtains the product information in the current cabinet, determines the current cargo situation, and uploads replenishment, settlement and other information to complete detection and recognition and obtain image acquisition results.
[0121] The process of acquiring images to be detected from a number of target objects in a locker can be regarded as a capture process. The capture frequency can be determined based on how fast the target angle changes during the process of opening the locker door. When the target angle is within the capture degree range, another image capture device sets the capture frequency to n frames per second after capturing the first frame of the image to be detected. In addition, when the target angle remains unchanged or changes slightly during the process of opening the locker door, the main image frequency is reduced to n frames per second. During the image capture process, another image acquisition device performs image recognition on the images to be detected acquired from a plurality of target objects to obtain image acquisition results.
[0122] In some embodiments, the image acquisition method may further include the following steps: in response to the target angle not satisfying a preset condition, controlling a heating module in the locker to be in an on state so as to increase the temperature of the area where the image acquisition device is located; or, after the above step S14, the image acquisition method may further include the following steps: controlling a heating module in the locker to be in an off state so as to reduce the temperature of the area where the image acquisition device is located.
[0123] When the temperature difference between the temperature inside the locker and the temperature outside the locker is large, a heating module is required in the locker to prevent the various image acquisition devices in the locker from fogging, thereby avoiding unclear images acquired by each image acquisition device. Therefore, when the image acquisition device is performing image acquisition, a heating module is required to increase the temperature of the area where the image acquisition device is located, thereby preventing the various image acquisition devices in the locker from fogging. However, if the heating module continues to heat up when the door of the locker is opened for too long, the surface of the image acquisition device will be too hot and the temperature of the area where the image acquisition device is located will be too high, which may easily burn the user. In some application scenarios, when the degree of the target angle meets the preset conditions, that is, when the door of the locker is open, the heating module is turned off to reduce the temperature of the area where the image acquisition device is located. In other application scenarios, when the degree of the target angle does not meet the preset conditions, that is, when the door of the locker is closed, the heating module is turned on to increase the temperature of the area where the image acquisition device is located. It can be considered that the present application can achieve temperature control of the area where each image acquisition device in the locker is located only by relying on whether the degree of the target angle meets the preset conditions, without the need to use other temperature detection hardware to detect the temperature, thereby reducing the cost of the locker supporting equipment.
[0124] See also Figure 3 , Figure 3 It is a schematic diagram of a detection line segment of an embodiment of the image acquisition method of the present application.
[0125] In some application scenarios, after the line detection process, each detected line segment can be directly used as each predicted line segment. In other application scenarios, after the line detection process, each detected line segment obtained by the line detection can be screened to obtain each predicted line segment. The line segment screening method can refer to the above content and will not be repeated here. Figure 3 As shown, the storage cabinet 100, the cabinet door 110, the cabinet body 120, and the detection line segment 200. Figure 3 As shown, part of the detection line segment may be on the cabinet door 110, and part of the detection line segment may be on the cabinet body 120. It is understandable that Figure 3In the example, the line segments with the same thickness as the detection line segment 200 are all detection line segments. However, after the actual straight line detection, the thickness of each detection line segment may be different or the same. Here, the detection line segment is exemplified as a line segment of the same thickness only to distinguish the detection line segment from the physical line segment between the cabinet 120 and the cabinet door 110 in the target image. After the actual straight line detection, the thickness of each detection line segment may be different or the same, and the length of each detection line segment may be different or the same. In some application scenarios, after the straight line detection, the detection line segment can be pre-divided into a cabinet door type or a cabinet type according to whether the detection line segment is in the cabinet door area or the cabinet area in the target image. Subsequently, the initial angle of the target type can be determined according to the detection line segment belonging to the target type, and then the initial angle of the target type obtains the candidate angle of the target type or the target angle of the target type. The target type is one of the cabinet door type and the cabinet type. It is thus conducive to simplifying and realizing the above-mentioned steps of only solving the target angle obtained by the initial angle corresponding to the cabinet in the target area, or only solving the target angle obtained by the initial angle corresponding to the cabinet door in the target area. In other application scenarios, the predicted line segment can be pre-classified as a door type or a cabinet type according to whether the predicted line segment is in the door area or the cabinet area in the target image. Therefore, each initial angle obtained in the above step S12 is classified as an initial angle corresponding to the door type or an initial angle corresponding to the cabinet type.
[0126] See also Figure 4 , Figure 4 This is a schematic diagram of the process of an embodiment of the image acquisition method of the present application. Figure 2 .
[0127] Step S40, step S41, step S42 and step S43 are performed in sequence. Step S40: for each initial angle, the initial angle is mapped to obtain a mapped angle. Step S41: based on each mapped angle, each candidate angle is determined. Step S42: each candidate angle is adjusted according to the reference condition to obtain an adjusted angle corresponding to each candidate angle. Step S43: based on each adjusted angle, a target angle is determined.
[0128] See also Figure 5 , Figure 5 This is a schematic diagram of the process of an embodiment of the image acquisition method of the present application. Figure 3 .
[0129] Step S50, step S51, step S52, step S53, step 54 and step 55 are performed in sequence. Step S50: The original images collected by the image acquisition device for several preset areas in the locker are respectively obtained. Step S51: For the original image corresponding to each preset area, based on the position information of at least one predicted line segment in the original image, the original angles between each predicted line segment in the original image and the preset line segment in the original image are respectively determined. Step S52: For each preset area, the standard deviation of each original angle corresponding to the preset area is calculated to obtain the standard deviation angle corresponding to the preset area. Step S53: The preset area that meets the angle condition is determined as the target area. Step S54: At the current moment, the current frame image is collected for the target area in the locker. Step S55: The current frame image is processed by the preset process to obtain the target image.
[0130] The above scheme obtains the target image captured by the image acquisition device for the target area in the locker at the current moment, and then determines the initial angles between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image. According to each initial angle, the target angle between the cabinet body and the cabinet door is determined. This method can achieve the accuracy of the target angle by only using the image acquisition device to determine the target image, and then in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition, another image acquisition device in the locker is started. The present application can improve the accuracy of the degree of the target angle determined, so that the timing of starting another image acquisition device in the locker to capture images is more accurate.
[0131] See also Figure 6 , Figure 6 6 is a schematic diagram of the structure of an embodiment of the image acquisition device of the present application. The image acquisition device 60 includes an acquisition module 61, a first determination module 62, a second determination module 63 and a start module 64. The acquisition module 61 is used to acquire the target image acquired by the image acquisition device at the current moment for the target area in the locker, wherein the target area and the image acquisition device are located in the cabinet body of the locker, and the other is located in the cabinet door of the locker; the first determination module 62 is used to determine the initial angle between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image, wherein each predicted line segment in the target image is obtained by detecting the straight line of the target image; the second determination module 63 is used to determine the target angle between the cabinet body and the cabinet door according to each initial angle; the start module 64 is used to start another image acquisition device in the locker in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition.
[0132] The above scheme obtains the target image captured by the image acquisition device for the target area in the locker at the current moment, and then determines the initial angles between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image. According to each initial angle, the target angle between the cabinet body and the cabinet door is determined. This method can achieve the accuracy of the target angle by only using the image acquisition device to determine the target image, and then in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition, another image acquisition device in the locker is started. The present application can improve the accuracy of the degree of the target angle determined, so that the timing of starting another image acquisition device in the locker to capture images is more accurate.
[0133] Please refer to the image acquisition method for the functions performed by each module, which will not be repeated here.
[0134] See also Figure 7 , Figure 7 : is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 70 includes a memory 71 and a processor 72, and the processor 72 is used to execute program instructions stored in the memory 71 to implement the steps in the above-mentioned image acquisition method embodiment. In a specific implementation scenario, the electronic device 70 may include but is not limited to: a multi-camera device, a microcomputer, and a server. In addition, the electronic device 70 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.
[0135] Specifically, the processor 72 is used to control itself and the memory 71 to implement the steps in the above-mentioned image acquisition method embodiment. The processor 72 can also be called a CPU (Central Processing Unit). The processor 72 may be an integrated circuit chip with signal processing capabilities. The processor 72 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 72 can be implemented by an integrated circuit chip.
[0136] The above scheme obtains the target image captured by the image acquisition device for the target area in the locker at the current moment, and then determines the initial angles between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image. According to each initial angle, the target angle between the cabinet body and the cabinet door is determined. This method can achieve the accuracy of the target angle by only using the image acquisition device to determine the target image, and then in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition, another image acquisition device in the locker is started. The present application can improve the accuracy of the degree of the target angle determined, so that the timing of starting another image acquisition device in the locker to capture images is more accurate.
[0137] See also Figure 8 , Figure 8 The computer-readable storage medium 80 stores program instructions 801, which implement the steps in any of the above-mentioned image acquisition method embodiments when executed by a processor.
[0138] The above scheme obtains the target image captured by the image acquisition device for the target area in the locker at the current moment, and then determines the initial angles between each predicted line segment in the target image and the preset line segment in the target image based on the position information of at least one predicted line segment in the target image. According to each initial angle, the target angle between the cabinet body and the cabinet door is determined. This method can achieve the accuracy of the target angle by only using the image acquisition device to determine the target image, and then in response to the degree of the target angle between the cabinet body and the cabinet door meeting the preset condition, another image acquisition device in the locker is started. The present application can improve the accuracy of the degree of the target angle determined, so that the timing of starting another image acquisition device in the locker to capture images is more accurate.
[0139] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0140] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0141] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0142] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0143] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
Claims
1. An image acquisition method, characterized in that: The method comprises: Acquire a target image captured by an image acquisition device at a current moment for a target area in the locker, wherein the target area and one of the image acquisition devices are located in a cabinet body in the locker, and the other is located in a cabinet door of the locker, wherein the target area included in the target image captured by the image acquisition device is different depending on whether the locker is in an open state or not; Based on the position information of at least one predicted line segment in the target image, respectively determine the initial angle between each predicted line segment in the target image and a preset line segment in the target image, wherein each predicted line segment in the target image is obtained by detecting a straight line in the target image; Determining a target angle between the cabinet body and the cabinet door according to each of the initial angles; In response to the degree of the target angle between the cabinet body and the cabinet door meeting a preset condition, activating another image acquisition device in the storage cabinet; Before acquiring the target image acquired by the image acquisition device at the current moment from the target area in the locker, the method further includes: Respectively acquiring original images captured by the image acquisition device for a plurality of preset areas in the locker; For each original image corresponding to the preset area, based on the position information of at least one predicted line segment in the original image, respectively determine the original angle between each predicted line segment in the original image and the preset line segment in the original image, wherein each predicted line segment in the original image is obtained by detecting the straight line of the original image; For each of the preset areas, calculating the standard deviation of each original angle corresponding to the preset area to obtain the standard deviation angle corresponding to the preset area; A preset area that meets an angle condition is determined as the target area, and the angle condition is that the standard deviation angle corresponding to the preset area is a minimum standard deviation angle.
2. The method according to claim 1, characterized in that: The step of determining a target angle between the cabinet body and the cabinet door according to each of the initial angles includes: Adjusting each of the initial angles according to a reference condition to obtain an adjusted angle corresponding to each of the initial angles, the reference condition comprising a first reference condition and / or a second reference condition, the first reference condition comprising adjusting an initial angle less than a preset threshold to a first fixed value, and the second reference condition comprising taking a difference between an initial angle greater than or equal to the preset threshold and a second fixed value as the adjusted angle; Based on the adjusted angles, the target angle is determined.
3. The method according to claim 2, characterized in that The step of determining the target angle based on each of the adjusted angles includes: In response to the number of each of the adjusted angles being less than the first number, determining each of the adjusted angles as a target angle; or, in response to the number of each of the adjusted angles being greater than or equal to the first number, determining the largest adjusted angle as the target angle; In response to the target angle being greater than or equal to an expected threshold, the target angle is determined as the degree of the target angle, wherein the expected threshold is used to represent an angle value corresponding to a minimum angle between the cabinet body and the cabinet door when the locker is in an open state.
4. The method according to claim 3, characterized in that The method further comprises: In response to the target angle being less than the expected threshold, acquiring a preset angle; The preset angle is determined as the degree of the target angle.
5. The method according to claim 4, characterized in that The method further comprises: Obtaining the degree difference between the target angle and the historical angle, wherein the historical angle is the target angle between the cabinet body and the cabinet door determined based on the target image collected at a historical moment; In response to the degree difference being greater than or equal to the threshold difference, taking the historical angle as the final angle between the cabinet and the cabinet door at the current moment; or, in response to the degree difference being less than the threshold difference, taking the target angle as the final angle between the cabinet and the cabinet door at the current moment; In response to the degree of the target angle between the cabinet body and the cabinet door satisfying a preset condition, another image acquisition device in the storage cabinet is activated, comprising: In response to the degree of the final included angle satisfying the preset condition, another image acquisition device in the locker is started.
6. The method according to any one of claims 1 to 5, characterized in that: The determining, based on the position information of at least one predicted line segment in the target image, respectively the initial angles between each predicted line segment in the target image and a preset line segment in the target image comprises: determining whether the number of the initial angles is greater than a second number; In response to the number of the initial angles being less than or equal to the second number, taking the initial angles as candidate angles respectively; or, in response to the number of the initial angles being greater than the second number, clustering the initial angles to obtain angles corresponding to the clusters; The angles corresponding to the clusters are respectively used as candidate angles; The step of determining a target angle between the cabinet body and the cabinet door according to each of the initial angles includes: According to each of the candidate angles, a target angle between the cabinet body and the cabinet door is determined.
7. The method according to any one of claims 1 to 5, characterized in that The target image is obtained by pre-processing the current frame image, and the target image acquired by the image acquisition device at the current moment from the target area in the locker includes: Sampling each pixel in the current frame image to obtain a plurality of sampled pixel points; Determining the grayscale value of each of the sampled pixel points according to the brightness of each of the sampled pixel points; The target image is determined based on the position information of the target area and the grayscale value of each of the sampled pixels.
8. The method according to claim 7, characterized in that The determining the target image based on the position information of the target area and the grayscale value of each of the sampled pixels includes: According to the position information of the target area, determining candidate pixel points belonging to the target area from each of the sampled pixel points; Acquire floating point data corresponding to each of the candidate pixel points, each of the floating point data being used to indicate that the coordinate values corresponding to the abscissa and ordinate of each of the candidate pixel points are in a decimal position; For each of the candidate pixels, determine the grayscale image data of the candidate pixel according to reference data corresponding to the candidate pixel, the grayscale value of the candidate pixel, and the grayscale value of at least one adjacent candidate pixel, wherein the reference data is obtained based on the coordinate value in the position information of the candidate pixel and the floating-point data; The grayscale image data of each of the candidate pixels is used as the image data corresponding to the target image.
9. The method according to claim 8, characterized in that At least one adjacent candidate pixel point of each candidate pixel point includes a first adjacent pixel point, a second adjacent pixel point, and a third adjacent pixel point, the first adjacent pixel point, the second adjacent pixel point, and the third adjacent pixel point are located in different directions of the candidate pixel point, the reference data includes a reference abscissa value associated with the abscissa of the candidate pixel point and a reference ordinate value associated with the ordinate of the candidate pixel point, The step of determining, for each candidate pixel, the grayscale image data of the candidate pixel according to the reference data corresponding to the candidate pixel, the grayscale value of the candidate pixel, and the grayscale value of at least one adjacent candidate pixel, comprises: Determine first grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the candidate pixel; and determine second grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the first adjacent pixel; and determine third grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the second adjacent pixel; and determine fourth grayscale image data based on the reference horizontal coordinate value, the reference vertical coordinate value and the grayscale value of the third adjacent pixel; The grayscale image data of the candidate pixel is obtained by combining the first grayscale image data, the second grayscale image data, the third grayscale image data and the fourth grayscale image data.
10. The method according to claim 9, characterized in that The method further comprises: The first grayscale image data is a product of a first product value and a grayscale value of the candidate pixel, wherein the first product is a product of a first transformation value and a second transformation value, and a sum of the first transformation value and the reference horizontal coordinate value is equal to a sum of the second transformation value and the reference vertical coordinate value; and The second grayscale image data is the product of a second product value and the grayscale value of the first adjacent pixel point, and the second product value is the product of the reference horizontal coordinate value and the second transformation value; and The third grayscale image data is the product of a third product value and the grayscale value of the second adjacent pixel point, and the third product value is the product of the first transformation value and the reference ordinate value; and The fourth grayscale image data is the product of a fourth product value and the grayscale value of the third adjacent pixel point, and the fourth product value is the product of the reference horizontal coordinate value and the reference vertical coordinate value.
11. The method according to any one of claims 1 to 5, characterized in that After the target image captured by the image acquisition device at the current moment on the target area in the locker is acquired, the method further includes: Performing filtering and / or correction processing on the target image to obtain a new target image; The determining, based on the position information of at least one predicted line segment in the target image, respectively the initial angles between each predicted line segment in the target image and a preset line segment in the target image comprises: Based on the position information of at least one predicted line segment in the new target image, initial angles between each predicted line segment in the new target image and a preset line segment in the new target image are determined respectively.
12. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Performing straight line detection on the target image according to at least one of several preset straight line detection algorithms to obtain several detected line segments; Based on the plurality of detected line segments, each predicted line segment is determined.
13. The method according to claim 12, characterized in that The determining each of the predicted line segments based on the plurality of detected line segments comprises: Determine the average widths of the line segments corresponding to the plurality of detection line segments and the average lengths of the line segments corresponding to the plurality of detection line segments; The detected line segments that do not meet the line segment screening conditions are retained to obtain at least one retained line segment and each of the retained line segments is used as the predicted line segments. The line segment screening conditions include a first line segment screening condition and / or a second line segment screening condition. The first line segment screening condition includes that the line segment width of the detected line segment is less than the line segment width mean; the second line segment screening condition includes that the line segment length of the detected line segment is less than a threshold line segment length, and the threshold line segment length is the sum of the line segment length mean and an offset.
14. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the method according to any one of claims 1 to 13.
15. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, they are used to implement the method according to any one of claims 1 to 13.
