Bottle capacity detection method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211379179.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-04
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-11-04
AI Technical Summary
[0004]本发明提供一种瓶体容量检测方法、装置、电子设备和存储介质,用以解决现有技术中维护瓶身条形码成本较高的缺陷,通过实时检测到的图像确定瓶体容量,降低维护成本
[0040]本发明提供的瓶体容量检测方法、装置、电子设备和存储介质,通过获取瓶体的至少两幅声波图像,在获取成像宽度和成像高度后,实现对瓶体的还原,并将成像宽度沿成像高度方向切割后,通过确定各段瓶体的子容量进而得到瓶体的成像容量,并通过各声波图像中的成像容量与成像比例的关系,充分考虑瓶体在不同程度的压瘪后造成的形变,以确定不同压瘪程度的瓶体对应的声波图像还原至正常水平的目标成像比例,结合成像容量和目标成像比例,得到声波图像还原至常规瓶体的容量,且通过实时检测得到瓶体的容量进行售卖,避免维护瓶身的条形码以及通过条形码作弊。
Smart Images

Figure CN115797261B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and storage medium for detecting bottle capacity. Background Technology
[0002] When the number of bottles is small, the volume of each bottle needs to be determined and different prices should be set based on the volume of each bottle. For example, the prices of bottles with a volume of 350ml or less, 500ml or less, 1200ml or less, and more than 1200ml will have different prices.
[0003] In existing technologies, barcodes for each water bottle are pre-determined, and the barcode information is obtained by scanning the barcodes on the bottle body with a barcode scanner. The barcode information is then retrieved from a database to obtain the corresponding capacity information for each water bottle. However, the above solution requires maintaining a large amount of barcode information and ensuring the integrity of the barcodes on the bottle body. In addition, misjudgments can easily occur when a small-capacity barcode is mistakenly affixed to a large-capacity water bottle. Summary of the Invention
[0004] This invention provides a bottle capacity detection method, device, electronic device, and storage medium to address the high cost of maintaining bottle barcodes in existing technologies. It determines bottle capacity through real-time detected images, thereby reducing maintenance costs.
[0005] This invention provides a method for detecting bottle capacity, comprising:
[0006] At least two acoustic images of the bottle are acquired, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0007] Determine the imaging width of the bottle in each of the aforementioned acoustic images, and cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle;
[0008] Based on each of the sub-capacities, the imaging capacity of the bottle is determined;
[0009] The capacity of the bottle is determined based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle.
[0010] According to the bottle capacity detection method provided by the present invention, determining the imaging ratio includes:
[0011] Multiple sample acoustic images corresponding to bottles with different real volumes are obtained, wherein the degree of compression of the bottle is different in each sample acoustic image corresponding to the same real volume;
[0012] The sample imaging width and the corresponding true width of each of the sample acoustic images are compared to determine the target width threshold corresponding to the sample imaging width and the true width;
[0013] Based on the target width threshold and the actual volume corresponding to the bottle, the imaging ratio corresponding to the bottle is determined.
[0014] According to the bottle capacity detection method provided by the present invention, determining the target width threshold corresponding to the sample imaging width and the true width includes:
[0015] The bottle body is cut along the height direction to determine the sub-sample imaging width and sub-real width corresponding to each segment of the bottle body;
[0016] Based on the imaging width and the actual width of each sub-sample corresponding to each segment of the bottle, a threshold for the width of each sub-sample corresponding to each segment of the bottle is determined;
[0017] Based on the width threshold of each subsample, the target width threshold corresponding to the bottle is determined.
[0018] According to the bottle capacity detection method provided by the present invention, the step of cutting the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle includes:
[0019] Based on each of the acoustic images, multiple inflection points of the bottle are determined, and the change value between the sub-image width corresponding to the inflection point and the sub-image width corresponding to the adjacent position is greater than a second preset threshold.
[0020] Cut along the direction perpendicular to the imaging height from each inflection point to determine the shape, sub-imaging height and sub-imaging width of each inflection point of the sub-sound wave image;
[0021] Based on the shape of each sub-sound image segment, the sub-imaging height, and the sub-imaging width corresponding to each inflection point, the sub-capacity corresponding to each sub-sound image segment is determined.
[0022] According to the bottle capacity detection method provided by the present invention, the step of cutting the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle includes:
[0023] The imaging width is cut at equal intervals along the direction of the imaging height to determine the sub-imaging height of each sub-sound wave image and the sub-imaging width of different parts in the sub-sound wave image.
[0024] Based on the sub-imaging widths corresponding to each sub-sonic image segment, the average sub-imaging width corresponding to each sub-sonic image segment is determined.
[0025] Based on the average sub-imaging height and sub-imaging width, the sub-capacity corresponding to each sub-sound wave image segment is determined.
[0026] According to the bottle capacity detection method provided by the present invention, determining the imaging height of the acoustic image includes:
[0027] Determine the true height of the bottle and the imaging length of the bottle in the acoustic image;
[0028] The actual height and the imaging length are compared, and the height of the acoustic device corresponding to each acoustic image is adjusted based on the comparison result.
[0029] The updated acoustic image is acquired, and the steps of comparing the actual height with the imaging length corresponding to the updated acoustic image are repeated until the difference between the imaging length and the actual height is less than a first preset threshold. Then, the imaging length is determined as the imaging height of the bottle.
[0030] According to the bottle capacity detection method provided by the present invention, the bottle comprises at least two bottles; the method further comprises:
[0031] When at least two of the bottles are placed side by side, multiple detection images are acquired, and the number of the bottles in each detection image is greater than 1;
[0032] Each of the detected images is segmented to obtain multiple acoustic images, wherein each acoustic image includes one of the bottle bodies.
[0033] The present invention also provides a bottle capacity detection device, comprising:
[0034] The acquisition module is used to acquire at least two acoustic images of the bottle, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0035] The first determining module is used to determine the imaging width of the bottle in each of the acoustic images, and to cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle;
[0036] The second determining module is used to determine the imaging capacity of the bottle body based on each of the sub-capacities;
[0037] The third determining module is used to determine the capacity of the bottle based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle.
[0038] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the bottle capacity detection method as described above.
[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the bottle capacity detection method as described above.
[0040] The bottle capacity detection method, device, electronic device, and storage medium provided by this invention acquire at least two acoustic images of the bottle. After acquiring the imaging width and imaging height, the bottle is reconstructed. The imaging width is then cut along the imaging height direction, and the sub-capacity of each segment of the bottle is determined to obtain the imaging capacity of the bottle. By considering the relationship between the imaging capacity and imaging ratio in each acoustic image, the deformation caused by the bottle being crushed to different degrees is fully taken into account, and the target imaging ratio for restoring the acoustic image to a normal level for bottles of different degrees of crushing is determined. Combining the imaging capacity and the target imaging ratio, the capacity of the acoustic image restored to a conventional bottle is obtained. The bottle capacity is obtained in real time for sale, avoiding the need to maintain the barcode on the bottle and to prevent cheating through the barcode. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0042] Figure 1 This is a flowchart illustrating the bottle capacity detection method provided by the present invention;
[0043] Figure 2 This is a schematic diagram of the imaging structure of the acoustic wave device provided by the present invention;
[0044] Figure 3 This is one of the schematic diagrams of bottle cutting provided by the present invention;
[0045] Figure 4 This is the second schematic diagram of bottle cutting provided by the present invention;
[0046] Figure 5 This is a schematic diagram of the bottle capacity detection device provided by the present invention;
[0047] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0049] To address the issues of high maintenance costs and susceptibility to cheating associated with barcodes on bottle bodies in existing technologies, this invention provides a method for detecting bottle capacity. Figure 1 This is a flowchart illustrating the bottle capacity detection method provided by the present invention, as shown below. Figure 1 As shown, the method includes:
[0050] Step 110: Obtain at least two acoustic images of the bottle, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0051] Optionally, Figure 2 This is a schematic diagram of the imaging structure of the acoustic device provided by the present invention, as shown below. Figure 2 As shown, the bottle can be placed on the conveyor belt of the conveyor device. The conveyor belt can be provided with grooves along the conveying direction. The extension direction of the grooves is consistent with the transmission direction of the conveyor belt, so that when the bottle is placed in the groove, the placement direction of the bottle is parallel to the transmission direction of the conveyor belt.
[0052] Optionally, such as Figure 2 As shown, taking the presence of two acoustic devices as an example, when the bottle moves with the conveyor belt, the movement time or distance can be preset based on the conveyor belt's speed, so that the bottle moves directly under acoustic device 1. The bottle is then imaged by acoustic device 1, resulting in acoustic image 1. Afterwards, when the conveyor belt is restarted, the distance between acoustic devices 1 and 2, as well as the conveyor belt's speed, can be used to determine the point at which the conveyor belt stops, so that the bottle moves directly under acoustic device 2. The bottle is then imaged by acoustic device 2, resulting in acoustic image 2.
[0053] Optionally, the heights of the aforementioned acoustic device 1 and acoustic device 2 are the same, and the acoustic devices are arranged sequentially along the conveyor belt's transport direction. Considering the possibility of the bottle being crushed, acoustic device 1 and acoustic device 2 can be tilted at a certain angle perpendicular to the conveyor belt's transport direction, with opposite tilting directions, so that the imaging heights in the acoustic image 1 obtained by acoustic device 1 and the acoustic image 2 obtained by acoustic device 2 are the same. The tilting angle range can be (0°, 90°), and acoustic device 1 can be tilted 45° to the left for imaging, while acoustic device 2 can be tilted 45° to the right for imaging.
[0054] Optionally, the aforementioned acoustic device can also be a camera or video camera, or any device capable of capturing images of the bottle. This embodiment of the invention does not impose any limitations on this.
[0055] Optionally, the bottle body can be a bottle body with different degrees of compression, or it can be a conventional bottle body with very little compression. The embodiments of the present invention do not limit this.
[0056] Optionally, the bottle body comprises at least two; the method further includes:
[0057] When at least two of the bottles are placed side by side, multiple detection images are acquired, and the number of the bottles in each detection image is greater than 1;
[0058] Each of the detected images is segmented to obtain multiple acoustic images, wherein each acoustic image includes one of the bottle bodies.
[0059] Specifically, if there are a large number of bottles, to improve detection efficiency, multiple grooves can be set parallel to each other along the conveyor belt to allow multiple bottles to be placed side by side. When each acoustic device images the image, the resulting detection image includes multiple bottles. The detection image can be segmented to obtain multiple acoustic images, so that each acoustic image includes only one bottle.
[0060] Optionally, determining the imaging height of the acoustic image includes:
[0061] Determine the true height of the bottle and the imaging length of the bottle in the acoustic image;
[0062] The actual height and the imaging length are compared, and the height of the acoustic device corresponding to each acoustic image is adjusted based on the comparison result.
[0063] The updated acoustic image is acquired, and the steps of comparing the actual height with the imaging length corresponding to the updated acoustic image are repeated until the difference between the imaging length and the actual height is less than a first preset threshold. Then, the imaging length is determined as the imaging height of the bottle.
[0064] Specifically, since the height of the acoustic wave device has a significant impact on the size of the acoustic image—that is, if the acoustic wave device is too high, the generated acoustic image will be smaller than the actual size of the bottle, and if the acoustic wave device is too low, the generated acoustic image will be larger than the actual size of the bottle—to avoid excessive discrepancies between the acoustic image and the actual size of the bottle, in this embodiment of the invention, during acoustic imaging, the true height of the bottle and the imaging length of the bottle in the acoustic image at the corresponding height are obtained. If the imaging length is greater than the true height, and the absolute value of the difference between the imaging length and the true height is greater than a first preset threshold, the height of all acoustic wave devices can be increased, and acoustic imaging can be performed again until the absolute value of the difference between the imaging length and the true height is less than the first preset threshold. Then, the imaging length is determined as the imaging height of the bottle. If the imaging length is less than the true height, and the absolute value of the difference between the imaging length and the true height is greater than the first preset threshold, the height of all acoustic wave devices can be decreased, and acoustic imaging can be performed again until the absolute value of the difference between the imaging length and the true height is less than the first preset threshold. Then, the imaging length is determined as the imaging height of the bottle.
[0065] It should be noted that since all the sound wave devices are at the same height, after adjusting the height of all the sound wave devices, it is necessary to check whether the sound wave devices are at the same height after the height adjustment.
[0066] Optionally, after obtaining the acoustic image, it can be preprocessed. Preprocessing includes smoothing the edge portion, removing burrs from the edge portion, and removing special protrusions in the acoustic image. For example, if a label is affixed to the bottle, the irregular deformation of the label often exceeds the range of the bottle body after the bottle is crushed. Therefore, it is necessary to remove special protrusions caused by such reasons to improve the accuracy of subsequent edge detection and further improve the accuracy of imaging width and prediction capacity.
[0067] Step 120: Determine the imaging width of the bottle in each of the acoustic images, and cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle.
[0068] Specifically, due to the irregular shape of the bottle, the imaging width of different parts of the bottle is different. For example, the imaging width at the bottle mouth is smaller, while the imaging width at the bottle body is larger. Therefore, in order to reduce the error of the imaging capacity, in this embodiment of the invention, the bottle body in the acoustic image is cut along the imaging height direction, and each segment of the bottle body is approximated as a regular body. By determining the sub-imaging width and sub-imaging height of each segment of the bottle body, the sub-capacity of each segment of the bottle body is determined, thereby improving the calculation speed and the accuracy of capacity calculation.
[0069] It should be noted that, taking an irregular cylinder as an example, the above imaging width is the diameter of each part of the bottle, and the above imaging height is the vertical height from the bottle mouth to the bottom of the bottle.
[0070] Step 130: Determine the imaging capacity of the bottle body based on each of the sub-capacities.
[0071] Specifically, after calculating the sub-capacity of each segment of the bottle, the sub-capacities are summed to obtain the imaging capacity corresponding to the bottle. By combining the imaging capacity and the target imaging ratio, the capacity restored to that of a conventional bottle is obtained.
[0072] Step 140: Determine the capacity of the bottle based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle.
[0073] Specifically, because the bottle bulges outward after being crushed, the imaging width of the bottle portion in the generated acoustic image differs significantly from the actual width of a conventional bottle, as does the difference between the imaging capacity and the actual volume. Furthermore, the larger the actual volume of the bottle, the greater the difference between the imaging capacity and the actual volume. Therefore, to reduce the error in detecting the bottle's capacity, in this embodiment of the invention, since the imaging height is close to the actual height of the bottle, after obtaining the imaging capacity corresponding to the acoustic image through the imaging width and imaging height, the target imaging ratio corresponding to the current acoustic image can be determined by pre-establishing the correspondence between imaging capacity and imaging ratio. This target imaging ratio, i.e., the scaling ratio by which the acoustic image is restored to a conventional bottle, further reduces the error in imaging capacity.
[0074] Optionally, determining the imaging scale includes:
[0075] Multiple sample acoustic images corresponding to bottles with different real volumes are obtained, wherein the degree of compression of the bottle is different in each sample acoustic image corresponding to the same real volume;
[0076] The sample imaging width and the corresponding true width of each of the sample acoustic images are compared to determine the target width threshold corresponding to the sample imaging width and the true width;
[0077] Based on the target width threshold and the actual volume corresponding to the bottle, the imaging ratio corresponding to the bottle is determined.
[0078] Specifically, to reduce capacity detection errors, in this embodiment of the invention, before detecting the bottle capacity, bottles with different actual volumes, or bottles with similar actual volumes but different shapes, are first acquired, and multiple sample acoustic images of the corresponding bottles are obtained. Then, the bottles are compressed, with the degree of compression gradually increasing. For bottles with different degrees of compression, multiple sample acoustic images of the compressed bottles are acquired, forming a sample dataset. After obtaining the sample dataset, for multiple sample acoustic images with similar volumes and the same degree of compression, the sample imaging width of each sample acoustic image is determined. Based on the imaging width of each sample and the actual width of the bottle, a target width threshold is determined, and based on the target width threshold and the actual volume of the bottle, the imaging ratio corresponding to the bottle is further determined.
[0079] Optionally, determining the target width threshold corresponding to the sample imaging width and the true width includes:
[0080] The bottle body is cut along the height direction to determine the sub-sample imaging width and sub-real width corresponding to each segment of the bottle body;
[0081] Based on the imaging width and the actual width of each sub-sample corresponding to each segment of the bottle, a threshold for the width of each sub-sample corresponding to each segment of the bottle is determined;
[0082] Based on the width threshold of each subsample, the target width threshold corresponding to the bottle is determined.
[0083] Specifically, when determining the target width threshold, considering that the width of different parts of the bottle body is different after being crushed, for multiple sample acoustic images corresponding to bottles of the same or similar volume, each sample acoustic image is cut along the height direction of the bottle, that is, the bottle body is segmented, and the sub-sample imaging width and sub-true width of the same segment in the multiple sample acoustic images are determined. In order to make the determined imaging ratio applicable to bottles with similar capacity but different shapes, the mean value of each sub-sample imaging width can be determined. By determining the ratio coefficient between the mean value and the sub-true width, the sub-sample width threshold corresponding to each segment of the bottle body is obtained. To simplify the calculation process, the target width threshold corresponding to the bottle body can be further determined by the mean value of each sub-sample width threshold.
[0084] In addition, by determining the target width threshold corresponding to a similar real volume, and by determining the mean value corresponding to each target width threshold, the imaging ratio within a volume range can be further determined.
[0085] Therefore, in application, the two acoustic images can be segmented. By combining the tilt angles of acoustic device 1 and acoustic device 2, the sub-imaging width with smaller error corresponding to each segment can be obtained. By combining the sub-imaging width and sub-imaging height of each segment, the sub-capacity of each segment can be obtained. Based on each sub-capacity, the imaging capacity corresponding to the acoustic image can be obtained. By using the imaging capacity, the corresponding volume range and the imaging ratio corresponding to the volume range can be found. After combining the imaging capacity and the imaging ratio, the capacity of the restored bottle can be obtained.
[0086] Optionally, the step of cutting the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle includes:
[0087] Based on each of the acoustic images, multiple inflection points of the bottle are determined, and the change value between the sub-image width corresponding to the inflection point and the sub-image width corresponding to the adjacent position is greater than a second preset threshold.
[0088] Cut along the direction perpendicular to the imaging height from each inflection point to determine the shape, sub-imaging height and sub-imaging width of each inflection point of the sub-sound wave image;
[0089] Based on the shape of each sub-sound image segment, the sub-imaging height, and the sub-imaging width corresponding to each inflection point, the sub-capacity corresponding to each sub-sound image segment is determined.
[0090] Specifically, since most bottles are irregular shapes, directly calculating the capacity by treating them as cylinders would lead to significant errors. For example, the bottle opening is narrow while the bottom is wide. If the bottom width is used as the bottle width, the calculated capacity will be too large, resulting in a discrepancy between the selling price and the actual volume of the bottle. Therefore, in this embodiment of the invention, by combining the acoustic images corresponding to multiple acoustic devices, a reconstructed image close to the bottle can be obtained. The outline of the bottle in the reconstructed image can be determined by edge detection, and the pixels at each point on the outline of the bottle and the pixels adjacent to that pixel can be identified. The corresponding change in sub-image width, i.e., the absolute value of the difference between the sub-image width of this pixel and the sub-image widths of its two adjacent pixels, is used to determine the pixel as an inflection point if at least one of the two absolute values is greater than a second threshold. Repeating the steps to determine inflection points yields multiple inflection points within the reconstructed image. Cutting from the inflection point perpendicular to the image height direction divides the bottle in the reconstructed image into multiple regular shapes. By determining the sub-image width corresponding to the inflection point at the boundary of each regular shape and the sub-image height corresponding to that regular shape, the sub-capacity of that regular shape can be determined using the volume formula for that regular shape.
[0091] For example, Figure 3 This is one of the schematic diagrams of bottle cutting provided by the present invention, such as... Figure 3As shown, the bottle is an irregular shape. By comparing the change in the sub-image width of each pixel in the bottle outline with the sub-image width of the pixels on both sides, we can obtain inflection points A1, A2, B1, and B2. Taking pixel A1 as an example, the sub-image width of the pixel to the left of pixel A1 is the same as that of pixel A1, and the sub-image width of the pixel to the right of pixel A1 is greater than that of pixel A1. That is, the change in the sub-image width of the pixel to the right of pixel A1 with the sub-image width of pixel A1 is greater than the second preset threshold. Therefore, pixel A1 is determined as an inflection point. Similarly, inflection points A2, B1, and B2 can be obtained. Inflection points A1 and A2 are axially symmetrical about the center line of the bottle, and inflection points B1 and B2 are axially symmetrical about the center line of the bottle. This will not be elaborated further here. Furthermore, after obtaining inflection points A1, A2, B1, and B2, line segments A1A2 and B1B2 divide the bottle into two cylinders and a frustum. The volume V1 of the cylinder can be further determined by determining the sub-image width corresponding to inflection point A1 or A2, and the sub-image height of the cylinder formed from the bottle mouth to line segment A1A2. The volume V3 of the cylinder can be further determined by determining the sub-image width corresponding to inflection point B1 or B2, and the sub-image height of the cylinder formed from the bottle bottom to line segment B1B2. The volume V2 of the frustum can be further determined by determining the sub-image width corresponding to inflection point A1 or A2, the sub-image width corresponding to inflection point B1 or B2, and the sub-image height of the frustum formed from line segment A1A2 to line segment B1B2. Therefore, the imaging capacity of the bottle is the sum of V1, V2, and V3.
[0092] Optionally, Figure 4 This is the second schematic diagram of bottle cutting provided by the present invention, as shown below. Figure 4 As shown, the step of cutting the imaging width along the imaging height direction to determine the sub-capacity of each segment of the bottle includes:
[0093] The imaging width is cut at equal intervals along the direction of the imaging height to determine the sub-imaging height of each sub-sound wave image and the sub-imaging width of different parts in the sub-sound wave image.
[0094] Based on the sub-imaging widths corresponding to each sub-sonic image segment, the average sub-imaging width corresponding to each sub-sonic image segment is determined.
[0095] Based on the average sub-imaging height and sub-imaging width, the sub-capacity corresponding to each sub-sound wave image segment is determined.
[0096] Specifically, since most bottles are irregular shapes, directly calculating the capacity by treating the bottle as a cylinder would result in a large error. Therefore, in this embodiment of the invention, a reconstructed image can be obtained based on the acoustic images generated by the acoustic devices at different tilt angles. The reconstructed image is then cut at equal intervals along the imaging height direction. When the intervals are small, multiple segments of regular bodies can be obtained after the cut. By determining the multiple sub-imaging widths of each segment of regular bodies and averaging the sub-imaging widths, each regular body can be determined as a cylinder with a base diameter equal to the average of the sub-imaging widths. The capacity of the bottle is obtained by calculating the sub-capacity of each cylinder and summing the sub-capacities.
[0097] The bottle capacity detection method provided by this invention acquires at least two acoustic images of the bottle. After obtaining the imaging width and imaging height, the bottle is reconstructed. The imaging width is then cut along the imaging height direction, and the sub-capacity of each segment of the bottle is determined to obtain the imaging capacity of the bottle. By considering the relationship between the imaging capacity and imaging ratio in each acoustic image, the deformation caused by the bottle being crushed to different degrees is fully taken into account, and the target imaging ratio for restoring the acoustic image to a normal level for bottles of different degrees of crushing is determined. Combining the imaging capacity and the target imaging ratio, the capacity of the acoustic image restored to a conventional bottle is obtained. The bottle capacity is obtained in real time for sale, avoiding the need to maintain the barcode on the bottle and to prevent cheating through the barcode.
[0098] The bottle capacity detection device provided by the present invention is described below. The bottle capacity detection device described below can be referred to in correspondence with the bottle capacity detection method described above.
[0099] Figure 5 This is a schematic diagram of the bottle capacity detection device provided by the present invention, as shown below. Figure 5 As shown, the bottle capacity detection device 500 includes: an acquisition module 501, a first determination module 502, a second determination module 503, and a third determination module 504, wherein:
[0100] The acquisition module 501 is used to acquire at least two acoustic images of the bottle, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0101] The first determining module 502 is used to determine the imaging width of the bottle in each of the acoustic images, and to cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle;
[0102] The second determining module 503 is used to determine the imaging capacity of the bottle body based on each of the sub-capacities;
[0103] The third determining module 504 is used to determine the capacity of the bottle based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic wave image corresponding to the bottle with different degrees of compression and the acoustic wave image corresponding to the normal bottle.
[0104] The bottle capacity detection device provided by this invention acquires at least two acoustic images of the bottle. After acquiring the imaging width and imaging height, it restores the bottle. After cutting the imaging width along the imaging height direction, it determines the sub-capacity of each segment of the bottle to obtain the imaging capacity of the bottle. By considering the relationship between the imaging capacity and imaging ratio in each acoustic image, it fully considers the deformation caused by the bottle after different degrees of compression to determine the target imaging ratio for restoring the acoustic image to a normal level for bottles with different degrees of compression. Combining the imaging capacity and the target imaging ratio, it obtains the capacity of the acoustic image restored to a conventional bottle. Furthermore, it sells the bottle by obtaining the bottle capacity in real time, avoiding the need to maintain the barcode on the bottle and to prevent cheating through the barcode.
[0105] Optionally, module 501 is used specifically for:
[0106] Determining the imaging height of the acoustic image includes:
[0107] Determine the true height of the bottle and the imaging length of the bottle in the acoustic image;
[0108] The actual height and the imaging length are compared, and the height of the acoustic device corresponding to each acoustic image is adjusted based on the comparison result.
[0109] The updated acoustic image is acquired, and the steps of comparing the actual height with the imaging length corresponding to the updated acoustic image are repeated until the difference between the imaging length and the actual height is less than a first preset threshold. Then, the imaging length is determined as the imaging height of the bottle.
[0110] Optionally, the first determining module 502 is specifically used for:
[0111] Determining the imaging scale includes:
[0112] Multiple sample acoustic images corresponding to bottles with different real volumes are obtained, wherein the degree of compression of the bottle is different in each sample acoustic image corresponding to the same real volume;
[0113] The sample imaging width and the corresponding true width of each of the sample acoustic images are compared to determine the target width threshold corresponding to the sample imaging width and the true width;
[0114] Based on the target width threshold and the actual volume corresponding to the bottle, the imaging ratio corresponding to the bottle is determined.
[0115] Optionally, the first determining module 502 is specifically used for:
[0116] Determining the target width threshold corresponding to the sample imaging width and the true width includes:
[0117] The bottle body is cut along the height direction to determine the sub-sample imaging width and sub-real width corresponding to each segment of the bottle body;
[0118] Based on the imaging width and the actual width of each sub-sample corresponding to each segment of the bottle, a threshold for the width of each sub-sample corresponding to each segment of the bottle is determined;
[0119] Based on the width threshold of each subsample, the target width threshold corresponding to the bottle is determined.
[0120] Optionally, the second determining module 503 is specifically used for:
[0121] The step of cutting the imaging width along the imaging height direction to determine the sub-capacity of each segment of the bottle includes:
[0122] Based on each of the acoustic images, multiple inflection points of the bottle are determined, and the change value between the sub-image width corresponding to the inflection point and the sub-image width corresponding to the adjacent position is greater than a second preset threshold.
[0123] Cut along the direction perpendicular to the imaging height from each inflection point to determine the shape, sub-imaging height and sub-imaging width of each inflection point of the sub-sound wave image;
[0124] Based on the shape of each sub-sound image segment, the sub-imaging height, and the sub-imaging width corresponding to each inflection point, the sub-capacity corresponding to each sub-sound image segment is determined.
[0125] Optionally, the second determining module 503 is specifically used for:
[0126] The step of cutting the imaging width along the imaging height direction to determine the sub-capacity of each segment of the bottle includes:
[0127] The imaging width is cut at equal intervals along the direction of the imaging height to determine the sub-imaging height of each sub-sound wave image and the sub-imaging width of different parts in the sub-sound wave image.
[0128] Based on the sub-imaging widths corresponding to each sub-sonic image segment, the average sub-imaging width corresponding to each sub-sonic image segment is determined.
[0129] Based on the average sub-imaging height and sub-imaging width, the sub-capacity corresponding to each sub-sound wave image segment is determined.
[0130] Optionally, the bottle capacity detection device 500 further includes a segmentation module, specifically used for:
[0131] The bottle body comprises at least two; the method further includes:
[0132] When at least two of the bottles are placed side by side, multiple detection images are acquired, and the number of the bottles in each detection image is greater than 1;
[0133] Each of the detected images is segmented to obtain multiple acoustic images, wherein each acoustic image includes one of the bottle bodies.
[0134] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a bottle capacity detection method, which includes:
[0135] At least two acoustic images of the bottle are acquired, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0136] Determine the imaging width of the bottle in each of the aforementioned acoustic images, and cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle;
[0137] Based on each of the sub-capacities, the imaging capacity of the bottle is determined;
[0138] The capacity of the bottle is determined based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle.
[0139] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0140] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the bottle capacity detection method provided by the above methods, the method comprising:
[0141] At least two acoustic images of the bottle are acquired, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0142] Determine the imaging width of the bottle in each of the aforementioned acoustic images, and cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle;
[0143] Based on each of the sub-capacities, the imaging capacity of the bottle is determined;
[0144] The capacity of the bottle is determined based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle.
[0145] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the bottle capacity detection method provided by the methods described above, the method comprising:
[0146] At least two acoustic images of the bottle are acquired, wherein the difference between the imaging height of each acoustic image and the actual height of the bottle is less than a first preset threshold.
[0147] Determine the imaging width of the bottle in each of the aforementioned acoustic images, and cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle;
[0148] The imaging capacity of the bottle is determined based on each of the sub-capacities;
[0149] The capacity of the bottle is determined based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio, and the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle.
[0150] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0151] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting bottle capacity, characterized in that, include: At least two acoustic images of the bottle are acquired, wherein the difference between the image height of the bottle and the actual height of the bottle in each acoustic image is less than a first preset threshold. Determine the imaging width of the bottle in each of the aforementioned acoustic images, and cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle; Determine the imaging scale; the imaging scale is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle. Based on each of the sub-capacities, the imaging capacity of the bottle is determined; The capacity of the bottle is determined based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio; Determining the imaging scale includes: Multiple sample acoustic images corresponding to bottles with different real volumes are obtained, wherein the degree of compression of the bottle is different in each sample acoustic image corresponding to the same real volume; The sample imaging width and the corresponding true width of each of the sample acoustic images are compared to determine the target width threshold corresponding to the sample imaging width and the true width; Based on the target width threshold and the actual volume corresponding to the bottle, the imaging ratio corresponding to the bottle is determined; Determining the target width threshold corresponding to the sample imaging width and the true width includes: Multiple sample acoustic images corresponding to the bottle with the same or similar volume are cut along the height direction to determine the sub-sample imaging width and sub-real width of the same segment in the multiple sample acoustic images. Determine the mean value of the imaging width of each of the sub-samples; Based on the ratio coefficient between each mean and the sub-true width, the sub-sample width threshold corresponding to each segment of the bottle is determined; Based on the mean of the width thresholds of each of the sub-samples, the target width threshold corresponding to the bottle with a similar real volume is determined. The step of determining the imaging scale corresponding to the bottle body based on the target width threshold and the actual volume corresponding to the bottle body includes: Based on the mean value corresponding to each of the target width thresholds, the imaging ratio corresponding to a real volume range is determined.
2. The bottle capacity detection method according to claim 1, characterized in that, The step of cutting the imaging width along the imaging height direction to determine the sub-capacity of each segment of the bottle includes: Based on each of the acoustic images, multiple inflection points of the bottle are determined, and the change value between the sub-image width corresponding to the inflection point and the sub-image width corresponding to the adjacent position is greater than a second preset threshold. Cut along the direction perpendicular to the imaging height from each inflection point to determine the shape, sub-imaging height and sub-imaging width of each inflection point of the sub-sound wave image; Based on the shape of each sub-sound image segment, the sub-imaging height, and the sub-imaging width corresponding to each inflection point, the sub-capacity corresponding to each sub-sound image segment is determined.
3. The bottle capacity detection method according to claim 1, characterized in that, The step of cutting the imaging width along the imaging height direction to determine the sub-capacity of each segment of the bottle includes: The imaging width is cut at equal intervals along the direction of the imaging height to determine the sub-imaging height of each sub-sound wave image and the sub-imaging width of different parts in the sub-sound wave image. Based on the sub-imaging widths corresponding to each sub-sonic image segment, the average sub-imaging width corresponding to each sub-sonic image segment is determined. Based on the average sub-imaging height and sub-imaging width, the sub-capacity corresponding to each sub-sound wave image segment is determined.
4. The bottle capacity detection method according to claim 1, characterized in that, The imaging height of the bottle in each of the aforementioned acoustic images is determined based on the following steps: Determine the true height of the bottle and the imaging length of the bottle in the acoustic image; The actual height and the imaging length are compared, and the height of the acoustic device corresponding to each acoustic image is adjusted based on the comparison result. The updated acoustic image is acquired, and the steps of comparing the actual height with the imaging length corresponding to the updated acoustic image are repeated until the difference between the imaging length and the actual height is less than a first preset threshold. Then, the imaging length is determined as the imaging height of the bottle.
5. The bottle capacity detection method according to claim 1, characterized in that, The bottle body comprises at least two; the method further includes: When at least two of the bottles are placed side by side, multiple detection images are acquired, and the number of the bottles in each detection image is greater than 1; Each of the detected images is segmented to obtain multiple acoustic images, wherein each acoustic image includes one of the bottle bodies.
6. A bottle capacity detection device, characterized in that, include: The acquisition module is used to acquire at least two acoustic images of the bottle, wherein the difference between the image height of the bottle and the actual height of the bottle in each acoustic image is less than a first preset threshold. The first determining module is used to determine the imaging width of the bottle in each of the acoustic images, and to cut the imaging width along the direction of the imaging height to determine the sub-capacity of each segment of the bottle; and to determine the imaging ratio; the imaging ratio is used to characterize the scaling ratio of the acoustic images corresponding to the bottle with different degrees of compression and the acoustic images corresponding to the normal bottle. The second determining module is used to determine the imaging capacity of the bottle body based on each of the sub-capacities; The third determining module is used to determine the capacity of the bottle based on the imaging capacity and the target imaging ratio, wherein the target imaging ratio is determined based on the relationship between the imaging capacity and the imaging ratio; The first determining module is specifically used for: acquiring multiple sample acoustic images corresponding to bottles with different real volumes, wherein the degree of bottle compression is different in each of the sample acoustic images corresponding to the same real volume; comparing the sample imaging width of each sample acoustic image with the corresponding real width to determine a target width threshold corresponding to the sample imaging width and the real width; and determining the imaging ratio corresponding to the bottle based on the target width threshold and the real volume corresponding to the bottle. The first determining module is further configured to: cut multiple sample acoustic images corresponding to the bottle body with the same or similar volume along the height direction to determine the sub-sample imaging width and sub-true width of the same segment in the multiple sample acoustic images; determine the mean value of each sub-sample imaging width; determine the sub-sample width threshold corresponding to each segment of the bottle body based on the ratio coefficient between each mean value and the sub-true width; and determine the target width threshold corresponding to the bottle body with similar true volume based on the mean value of each sub-sample width threshold. The first determining module is further configured to: determine the imaging ratio corresponding to a real volume range based on the mean value corresponding to each of the target width thresholds.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the bottle capacity detection method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the bottle capacity detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method for adjusting volume of bottle type container and volume detection method based on method for adjusting volume of bottle type container
CN103900655A
Wine bottle volume detection system and method
CN113731854A