A method and system for automatically identifying concealed items in a cargo of a vehicle

By using edge detection and grayscale thresholding technology to automatically identify contraband in cargo compartments, this method can quickly and accurately identify prohibited items inside the compartments, solving the problem of low efficiency in human eye recognition. It is suitable for places such as customs and ports.

CN115578356BActive Publication Date: 2025-11-11BELTECNO CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211292963.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-21
Publication Date
2025-11-11
Estimated Expiration
2042-10-21

AI Technical Summary

Technical Problem

In existing technologies, the identification of prohibited or dangerous items in customs radiation imaging inspection systems mainly relies on the human eye, which is inefficient and prone to misjudgment and omission.

Method used

The method of automatically identifying hidden objects in the cargo compartment is adopted. The image file is acquired, converted into a grayscale image, the edge detection algorithm is used to detect the outline of the whole vehicle, a histogram is built, a grayscale threshold is set, the bounding boxes are selected and merged, and the bounding boxes that conform to the size range are displayed.

Benefits of technology

It enables rapid and accurate identification of concealed items in cargo compartments, and is suitable for places such as customs and ports that require the identification of a large number of vehicles in a short period of time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115578356B_ABST
    Figure CN115578356B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for automatically identifying concealed objects in cargo within a train carriage. The method includes: acquiring a target image from an image file and converting it into a grayscale image; performing edge detection on the grayscale image to obtain a binary image of the entire train carriage outline, and preprocessing the binary image of the entire train carriage outline to obtain a target carriage interior bounding box; determining whether the grayscale value of each pixel in the target carriage interior bounding box is greater than a preset grayscale threshold; if the grayscale value of a pixel in the target carriage interior bounding box is greater than the preset grayscale threshold, then selecting the pixel along its perimeter and merging adjacent bounding boxes; determining whether the size of each merged bounding box is within a preset size range; if the size of each merged bounding box is within the preset size range, then retaining the bounding box and displaying it in the target image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer image processing technology, and in particular relates to a method and system for automatically identifying concealed objects in cargo in a train carriage. Background Technology

[0002] Currently, the identification of prohibited or dangerous items in China's customs radiation imaging inspection system mainly relies on the human eye. Human eye recognition is relatively inefficient; identifying prohibited items in an image typically takes 5 to 10 seconds, and some complex images may require half a minute or longer. Furthermore, human fatigue and eye strain can easily lead to misjudgments and missed detections. Summary of the Invention

[0003] This invention provides a method and system for automatically identifying concealed objects in cargo compartments, which solves the problem that current technology relying on human visual identification is too inefficient.

[0004] In a first aspect, the present invention provides a method for automatically identifying concealed objects in cargo within a train carriage, comprising: acquiring a specific image to be identified from an image file, and converting the specific image to be identified into a grayscale image; performing edge detection on the grayscale image to obtain a binary image of the entire train carriage outline, and preprocessing the binary image of the entire train carriage outline to obtain a target carriage interior frame; determining whether the grayscale value of each pixel in the target carriage interior frame is greater than a preset grayscale threshold, wherein the grayscale threshold is set according to the following rule: establishing a histogram based on the grayscale value of each pixel in the target carriage interior frame, wherein the vertical axis of the histogram represents the grayscale value of the pixel, and the horizontal axis represents the coordinate value of the pixel; and calculating the first pixel in the histogram whose grayscale value is not zero. The first pixel with a non-zero grayscale value is connected to the pixel with the highest grayscale value, forming an AB line. All pixels on one side of the histogram along the AB line are traversed, and the pixel furthest from the AB line is found. The grayscale value corresponding to this furthest pixel is the grayscale threshold. If the grayscale value of a pixel in the target carriage's inner frame is greater than the preset grayscale threshold, the pixel is selected by framing it, and adjacent bounding boxes are merged. The size of the merged bounding boxes is determined to be within a preset size range. If the size of the merged bounding boxes is within the preset size range, the bounding boxes are retained and displayed in the image to be recognized.

[0005] Secondly, the present invention provides a system for automatically identifying concealed objects in cargo within a train carriage, comprising: a conversion module configured to acquire a specific image to be identified from an image file and convert the specific image to be identified into a grayscale image; a processing module configured to detect the grayscale image based on an edge detection algorithm to obtain a binary image of the entire train carriage outline, and to preprocess the binary image of the entire train carriage outline to obtain a target carriage interior frame; and a first judgment module configured to judge whether the grayscale value of each pixel in the target carriage interior frame is greater than a preset grayscale threshold, wherein the grayscale threshold is set according to the following rule: a histogram is established based on the grayscale value of each pixel in the target carriage interior frame, wherein the vertical axis of the histogram is the grayscale value of the pixel, and the horizontal axis is the coordinate value of the pixel; and the first pixel with a non-zero grayscale value in the histogram is calculated. The first non-zero grayscale value pixel is connected to the pixel with the highest grayscale value to form an AB line. All pixels on one side of the histogram along the AB line are traversed to find the pixel furthest from the AB line; the grayscale value corresponding to this furthest pixel is the grayscale threshold. A merging module is configured to select a pixel along its perimeter if its grayscale value exceeds a preset grayscale threshold, and merge adjacent bounding boxes. A second judgment module is configured to determine if the size of each merged bounding box is within a preset size range. A display module is configured to retain and display the merged bounding boxes in the image to be recognized if their size is within the preset size range.

[0006] Thirdly, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the steps of a method for automatically identifying concealed objects in cargo compartments according to any embodiment of the present invention.

[0007] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the steps of a method for automatically identifying concealed objects in cargo compartments according to any embodiment of the present invention.

[0008] This application discloses a method and system for automatically identifying concealed items in cargo compartments. Through intelligent software algorithms, it can quickly identify concealed items in cargo, fundamentally solving the two aforementioned defects. It is particularly suitable for places such as customs, ports, and free trade zones that require the identification of a large number of vehicles in a short period of time. Attached Figure Description

[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A flowchart illustrating a method for automatically identifying concealed objects in cargo compartments according to an embodiment of the present invention;

[0011] Figure 2 A histogram established according to a specific embodiment of the present invention is provided;

[0012] Figure 3 A binary image based on the transformation of the target carriage's internal block diagram is provided as a specific embodiment of the present invention;

[0013] Figure 4 This is a structural block diagram of a system for automatically identifying concealed objects in cargo compartments according to an embodiment of the present invention;

[0014] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0016] Please see Figure 1 The diagram illustrates a flowchart of a method for automatically identifying concealed objects in cargo compartments according to this application.

[0017] like Figure 1 As shown, in step S101, a certain image to be identified is obtained from the image file, and the certain image to be identified is converted into a grayscale image;

[0018] Step S102: Detect the grayscale image based on the edge detection algorithm to obtain a binary image of the entire vehicle outline, and preprocess the binary image of the entire vehicle outline to obtain the inner frame of the target vehicle compartment.

[0019] Step S103: Determine whether the grayscale value of each pixel in the target carriage inner frame diagram is greater than a preset grayscale threshold. The grayscale threshold is set according to the following rules: A histogram is established based on the grayscale value of each pixel in the target carriage inner frame diagram, where the horizontal axis of the histogram is the grayscale value of the pixel and the vertical axis is the total number of pixels; the first pixel with a non-zero grayscale value and the pixel with the largest grayscale value in the histogram are calculated, and the first pixel with a non-zero grayscale value and the pixel with the largest grayscale value are connected to obtain the AB line; all pixels on one side of the histogram on the AB line are traversed, and the pixel farthest from the AB line is found. The grayscale value corresponding to the pixel farthest from the AB line is the grayscale threshold.

[0020] Step S104: If the gray value of a certain pixel in the target carriage inner frame is greater than a preset gray value threshold, then the certain pixel is selected along the perimeter of the certain pixel, and the adjacent annotation boxes are merged.

[0021] Step S105: Determine whether the dimensions of each merged annotation box are within the preset size range;

[0022] Step S106: If the size of each of the merged annotation boxes is within the preset size range, then the annotation boxes are retained and displayed in the image to be identified.

[0023] In one specific embodiment, a method for automatically identifying concealed objects in cargo compartments includes the following steps:

[0024] Step 1: Read the image file and convert it to an 8-bit grayscale image using OpenCV's cvtColor function;

[0025] Step 2: After performing morphological closing operations, the image is blurred, which can remove noise and fine lines.

[0026] Step 3: Apply the Canny edge detection algorithm to the grayscale image after removing noise and fine lines to obtain a binary image of the entire vehicle's outline;

[0027] Step 4: Delete the blank areas at the front, rear, and top of the vehicle, and delete the walls of the carriage to obtain the inner frame of the carriage. Specifically:

[0028] By traversing the pixels of the binary image from top to bottom and from left to right, the top left vertex of the carriage can be obtained; by traversing the pixels of the binary image from top to bottom and from right to left, the top right vertex of the carriage can be obtained; the outer frame of the carriage is marked based on the top left and top right vertices, and the pixels within the carriage walls of the outer frame are used to obtain the first inner frame of the carriage, wherein the first inner frame of the carriage only contains the left boundary line, the right boundary line, and the top boundary line; the target carriage floor line is identified in the first inner frame of the carriage to obtain the target inner frame of the carriage, wherein the target inner frame of the carriage only contains the left boundary line, the right boundary line, the top boundary line, and the bottom boundary line;

[0029] It should be noted that the target carriage floor is identified as a straight line:

[0030] The Hough transform is used to detect straight lines, and the straight lines that meet the conditions are identified. The line with the highest average height is taken as the floor line of the carriage (i.e., the lower boundary of the carriage).

[0031] 1) Because the floor line is at the bottom of the image, it is cropped. Figure 5 The lower half of it.

[0032] 2) Use Hough transform: HoughLines(edge,lines,1,CV_PI / 180,vv,0,0);

[0033] The parameter vv represents the minimum number of pixels on the line to be identified, and is usually set to half the width of the image, i.e., vv = w / 2.

[0034] The result of the Hough transform is that all lines with a length greater than vv will be stored in the lines array.

[0035] 3) Because the floor line to be identified is approximately horizontal, the angle (theta value) between the perpendicular line of the floor line and the horizontal line is approximately 90 degrees, which is π / 2 in radians, approximately equal to 1.57.

[0036] 4) The theta value of the line that meets the condition should be around 1.57. Delete all lines in the lines array where theta > 1.5 or theta < 1.65. The remaining lines are the horizontal lines we are looking for, as shown in the red lines in the image below. Take the topmost line as the target carriage floor line.

[0037] Step 5: Remove the ceiling and floor.

[0038] The grayscale of the ceiling and floor in the carriage image can interfere with the identification of goods and concealed items, so the ceiling and floor need to be removed. When there are too many goods and the height of the goods exceeds the ceiling, deleting the ceiling image will also delete the goods and concealed items above the ceiling line, so the ceiling cannot be deleted when there are too many goods.

[0039] Using the Sobel operator and setting appropriate parameters, the Y-axis gradient map of the lower part of the target carriage's inner block diagram is obtained.

[0040] The Hough transform is used again to detect straight lines, and the upper bound of the contours of bottom objects such as the floor and railings is obtained.

[0041] Step 6: Obtain the grayscale threshold using the triangular thresholding method.

[0042] 1) Draw Figure 2 The histogram, as shown by the black vertical bars in the figure.

[0043] 2) Calculate the first non-zero point (point A) and the point with the largest value (point B) in the histogram.

[0044] 3) Traverse all values ​​on the side of the histogram connected to line AB, and find the point (point C) that is furthest from line AB.

[0045] 4) The ordinate of point C is 51, which is the grayscale threshold.

[0046] Step 7: Based on the grayscale threshold, convert the target carriage interior bounding image into a binary image (see...). Figure 3 Points larger than the threshold are set to white (carriage background and cargo), and points smaller than the threshold are set to black (contained objects).

[0047] Step 8: Use a separation algorithm to... Figure 3 Separate the attached items to obtain the borders of each attached item.

[0048] 1) Draw a border for each black dot;

[0049] 2) Traverse all black dots. If a black dot is adjacent to another black dot, merge the two borders to obtain multiple borders.

[0050] It's important to note that a frame that's too large could represent an entire floor or a large item, while a frame that's too small could represent image noise—both are misclassifications. Therefore, it's necessary to set parameters such as minimum and maximum size; objects that are too large or too small will not be labeled.

[0051] Please see Figure 4 The diagram shows a structural block diagram of a system for automatically identifying concealed objects in cargo compartments according to this application.

[0052] like Figure 4 As shown, the system 200 for automatically identifying concealed objects in cargo compartments includes a conversion module 210, a processing module 220, a first judgment module 230, a merging module 240, a second judgment module 250, and a display module 260.

[0053] The conversion module 210 is configured to acquire a specific image to be recognized from an image file and convert the image to be recognized into a grayscale image; the processing module 220 is configured to detect the grayscale image based on an edge detection algorithm to obtain a binary image of the entire vehicle outline, and preprocess the binary image of the entire vehicle outline to obtain a target vehicle compartment inner frame; the first judgment module 230 is configured to judge whether the grayscale value of each pixel in the target vehicle compartment inner frame is greater than a preset grayscale threshold, wherein the grayscale threshold is set according to the following rules: a histogram is established based on the grayscale value of each pixel in the target vehicle compartment inner frame, wherein the horizontal axis of the histogram is the grayscale value of the pixel, and the vertical axis is the total number of pixels; the first pixel with a non-zero grayscale value and the pixel with the largest grayscale value in the histogram are calculated, and then... A line is drawn between the first non-zero grayscale pixel and the pixel with the largest grayscale value to form an AB line. All pixels on one side of the histogram along the AB line are traversed to find the pixel furthest from the AB line. The grayscale value corresponding to the pixel furthest from the AB line is the grayscale threshold. A merging module 240 is configured to select a pixel along its perimeter if the grayscale value of a pixel in the target carriage's inner frame is greater than a preset grayscale threshold, and merge adjacent bounding boxes. A second judgment module 250 is configured to determine whether the size of each merged bounding box is within a preset size range. A display module 260 is configured to retain and display the bounding box in the image to be recognized if the size of each merged bounding box is within the preset size range.

[0054] It should be understood that Figure 4 The modules and references described in the document Figure 1 The steps described in the text correspond to those in the method described above. Therefore, the operations, features, and corresponding technical effects described above also apply to the method described in the text. Figure 4 The various modules in the document will not be described in detail here.

[0055] In other embodiments, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the method for automatically identifying concealed objects in cargo compartments in any of the above method embodiments.

[0056] In one embodiment, the computer-readable storage medium of the present invention stores computer-executable instructions, which are configured as follows:

[0057] Obtain a specific image to be identified from an image file, and convert the specific image to be identified into a grayscale image;

[0058] The grayscale image is detected based on an edge detection algorithm to obtain a binary image of the entire vehicle outline. The binary image of the entire vehicle outline is then preprocessed to obtain the inner frame of the target vehicle compartment.

[0059] Determine whether the grayscale value of each pixel in the target carriage inner frame is greater than a preset grayscale threshold. The grayscale threshold is set according to the following rules: A histogram is built based on the grayscale values ​​of each pixel in the target carriage inner frame, where the horizontal axis of the histogram represents the grayscale value of the pixel, and the vertical axis represents the total number of pixels. The first non-zero pixel and the pixel with the largest grayscale value in the histogram are calculated, and a line is drawn between them to obtain the AB line. All pixels on one side of the AB line in the histogram are traversed, and the pixel furthest from the AB line is found. The grayscale value corresponding to the pixel furthest from the AB line is the grayscale threshold.

[0060] If the gray value of a certain pixel in the target carriage's inner frame is greater than a preset gray value threshold, then the pixel is selected by drawing a box around it, and the adjacent annotation boxes are merged.

[0061] Determine whether the dimensions of the merged annotation boxes are within the preset size range;

[0062] If the size of each of the merged annotation boxes is within the preset size range, the annotation boxes will be retained and displayed in the image to be recognized.

[0063] Computer-readable storage media may include a stored program area and a stored data area, wherein the stored program area may store an operating system and an application program required for at least one function; the stored data area may store data created based on the use of the system for automatically identifying concealed items in cargo compartments. Furthermore, the computer-readable storage medium may include high-speed random access memory, and may also include memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the computer-readable storage medium may optionally include memory remotely configured relative to a processor, which can be connected via a network to the system for automatically identifying concealed items in cargo compartments. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0064] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present invention, such as... Figure 5As shown, the device includes a processor 310 and a memory 320. The electronic device may also include an input device 330 and an output device 340. The processor 310, memory 320, input device 330, and output device 340 can be connected via a bus or other means. Figure 5 Taking a bus connection as an example, the memory 320 is the computer-readable storage medium described above. The processor 310 executes various server functions and data processing by running non-volatile software programs, instructions, and modules stored in the memory 320, thereby implementing the method for automatically identifying concealed objects in cargo compartments as described in the above embodiment. The input device 330 can receive input digital or character information, and generate key signal inputs related to user settings and function control of the system for automatically identifying concealed objects in cargo compartments. The output device 340 may include a display screen or other display device.

[0065] The aforementioned electronic device can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.

[0066] In one implementation, the above-described electronic device is applied to a system for automatically identifying concealed objects in cargo within a vehicle compartment. As a client, it includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:

[0067] Obtain a specific image to be identified from an image file, and convert the specific image to be identified into a grayscale image;

[0068] The grayscale image is detected based on an edge detection algorithm to obtain a binary image of the entire vehicle outline. The binary image of the entire vehicle outline is then preprocessed to obtain the inner frame of the target vehicle compartment.

[0069] Determine whether the grayscale value of each pixel in the target carriage inner frame is greater than a preset grayscale threshold. The grayscale threshold is set according to the following rules: A histogram is built based on the grayscale values ​​of each pixel in the target carriage inner frame, where the horizontal axis of the histogram represents the grayscale value of the pixel, and the vertical axis represents the total number of pixels. The first non-zero pixel and the pixel with the largest grayscale value in the histogram are calculated, and a line is drawn between them to obtain the AB line. All pixels on one side of the AB line in the histogram are traversed, and the pixel furthest from the AB line is found. The grayscale value corresponding to the pixel furthest from the AB line is the grayscale threshold.

[0070] If the gray value of a certain pixel in the target carriage's inner frame is greater than a preset gray value threshold, then the pixel is selected by drawing a box around it, and the adjacent annotation boxes are merged.

[0071] Determine whether the dimensions of the merged annotation boxes are within the preset size range;

[0072] If the size of each of the merged annotation boxes is within the preset size range, the annotation boxes will be retained and displayed in the image to be recognized.

[0073] 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., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.

[0074] 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 automatically identifying concealed objects in cargo within a train carriage, characterized in that, include: Obtain a specific image to be identified from an image file, and convert the specific image to be identified into a grayscale image; The grayscale image is detected using an edge detection algorithm to obtain a binary image of the entire vehicle outline. This binary image is then preprocessed to obtain a target vehicle compartment interior bounding image. The preprocessing of the binary image of the entire vehicle outline to obtain the target vehicle compartment interior bounding image includes: By traversing the pixels of the binary image from top to bottom and from left to right, the top left vertex of the carriage can be obtained. By traversing the pixels of the binary image from top to bottom and from right to left, the top right vertex of the carriage can be obtained. The outer frame of the carriage is marked according to the upper left vertex and the upper right vertex, and the first inner frame of the carriage is obtained by marking the pixels inside the carriage wall in the outer frame of the carriage. The first inner frame of the carriage only includes the left boundary line, the right boundary line and the upper boundary line. Identify the target carriage floor line in the first carriage interior diagram to obtain the target carriage interior diagram, wherein the target carriage interior diagram only includes the left boundary line, right boundary line, upper boundary line and lower boundary line; The identification of the target carriage floor line in the first carriage interior diagram includes: The Hough transform is used to detect straight lines on the car floor. Straight lines on the car floor with the angle between the perpendicular line and the horizontal line within a preset threshold range are obtained, and the straight line on the car floor with the highest average height is taken as the target car floor line. Determine whether the grayscale value of each pixel in the target carriage inner frame is greater than a preset grayscale threshold. The grayscale threshold is set according to the following rules: A histogram is built based on the grayscale values ​​of each pixel in the target carriage inner frame, where the horizontal axis of the histogram represents the grayscale value of the pixel, and the vertical axis represents the total number of pixels. The first non-zero pixel and the pixel with the largest grayscale value in the histogram are calculated, and a line is drawn between them to obtain the AB line. All pixels on one side of the AB line in the histogram are traversed, and the pixel furthest from the AB line is found. The grayscale value corresponding to the pixel furthest from the AB line is the grayscale threshold. If the gray value of a certain pixel in the target carriage's inner frame is greater than a preset gray value threshold, then the pixel is selected by drawing a box around it, and the adjacent annotation boxes are merged. Determine whether the dimensions of the merged annotation boxes are within the preset size range; If the size of each of the merged annotation boxes is within the preset size range, the annotation boxes will be retained and displayed in the image to be recognized.

2. A system for automatically identifying concealed objects in cargo within a train carriage, characterized in that, include: The conversion module is configured to acquire a specific image to be recognized from an image file and convert the specific image to be recognized into a grayscale image; The processing module is configured to detect the grayscale image based on an edge detection algorithm to obtain a binary image of the entire vehicle outline, and to preprocess the binary image of the entire vehicle outline to obtain a target vehicle compartment inner frame image. The preprocessing of the binary image of the entire vehicle outline to obtain the target vehicle compartment inner frame image includes: By traversing the pixels of the binary image from top to bottom and from left to right, the top left vertex of the carriage can be obtained. By traversing the pixels of the binary image from top to bottom and from right to left, the top right vertex of the carriage can be obtained. The outer frame of the carriage is marked according to the upper left vertex and the upper right vertex, and the first inner frame of the carriage is obtained by marking the pixels inside the carriage wall in the outer frame of the carriage. The first inner frame of the carriage only includes the left boundary line, the right boundary line and the upper boundary line. Identify the target carriage floor line in the first carriage interior diagram to obtain the target carriage interior diagram, wherein the target carriage interior diagram only includes the left boundary line, right boundary line, upper boundary line and lower boundary line; The identification of the target carriage floor line in the first carriage interior diagram includes: The Hough transform is used to detect straight lines on the car floor. Straight lines on the car floor with the angle between the perpendicular line and the horizontal line within a preset threshold range are obtained, and the straight line on the car floor with the highest average height is taken as the target car floor line. The first judgment module is configured to determine whether the grayscale value of each pixel in the target carriage inner frame is greater than a preset grayscale threshold. The grayscale threshold is set according to the following rules: a histogram is built based on the grayscale value of each pixel in the target carriage inner frame, where the vertical axis of the histogram is the grayscale value of the pixel and the horizontal axis is the coordinate value of the pixel; the first pixel with a non-zero grayscale value and the pixel with the largest grayscale value in the histogram are calculated, and the first pixel with a non-zero grayscale value and the pixel with the largest grayscale value are connected to obtain the AB line; all pixels on one side of the histogram on the AB line are traversed, and the pixel farthest from the AB line is found, where the grayscale value corresponding to the pixel farthest from the AB line is the grayscale threshold. The merging module is configured to select a pixel along its perimeter if the grayscale value of a pixel in the target carriage's inner frame is greater than a preset grayscale threshold, and then merge the adjacent annotation frames. The second judgment module is configured to determine whether the dimensions of each merged annotation box are within the preset size range; The display module is configured to retain and display the annotation boxes in a certain image to be recognized if the size of each merged annotation box is within a preset size range.

3. An electronic device, characterized in that, include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of claim 1.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method of claim 1.

Citation Information

Patent Citations

  • Lane line recognition method and device

    CN111046741A

  • Annotation box updating method and device, storage medium and computer equipment

    CN111209908A