Wire box direction adjusting method based on image processing
The method employs Canny edge detection and multi-angle alignment to enhance line box orientation recognition, addressing inefficiencies in existing image processing systems and ensuring precise alignment for improved production efficiency.
Patent Information
- Application Number
- CN202510389356.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-03-31
AI Technical Summary
In the prior art, the image processing technology has poor cross-domain adaptation effect during the online box direction recognition process, and the deep recognition algorithm is complex to calculate, resulting in low recognition efficiency.
Using an image processing-based method, edge contour detection is performed through the Canny algorithm, standard control images are generated, four vertices of the line box are determined, offset angles are calculated, and the image to be tested is rotated with the lower left corner vertex as the center. The corrected image is used to compare with the standard control image, the angle of the line box is adjusted, and secondary rotation and manual processing is performed if necessary.
It improves the accuracy and efficiency of wire box direction recognition, simplifies the identification process, ensures the processing accuracy of subsequent mechanical equipment, and improves production efficiency.
Smart Images

Figure CN120318265A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more specifically, to a method for adjusting the direction of a wire box based on image processing. Background Art
[0002] A wire box (also known as a concealed box, bottom box, switch socket box) is a plastic or metal box used to fix electrical devices such as switches and sockets in household circuit installations. It is usually embedded inside the wall (concealed installation) or installed on the surface of the wall (surface installation), and is an important auxiliary material for circuit wiring.
[0003] Common wire box models include 86-type wire boxes, 120-type wire boxes, 146-type wire boxes, explosion-proof wire boxes, etc.; as Figure 1 shown, taking the common 86-type concealed wire box as an example, its structure mainly includes the following parts: Shell: A square or rectangular plastic shell with a thickness of about 1.2 - 1.5 mm and a hollow interior. The material is mostly flame-retardant PC or ABS, and some metal wire boxes use galvanized steel sheets.
[0004] Fixing ears: Flaps located on both sides of the wire box, fixed in the wall by expansion screws or gypsum. Some wire box designs can adjust the depth (such as telescopic fixing ears) to adapt to different wall thicknesses.
[0005] Threading holes: Round holes (with a diameter of about 20 mm) reserved at the bottom or side of the box body for power wires to pass through. Some wire boxes come with removable baffles for easy closing after opening the holes.
[0006] Screw holes: Threaded holes symmetrically distributed at the top and bottom (with a spacing of about 60 mm) for fixing the switch socket panel. Some high-end wire boxes are built-in with copper nuts to enhance the screw biting strength.
[0007] Reinforcing ribs: Interlaced reinforcing ribs designed inside the box body to prevent extrusion deformation.
[0008] Moisture-proof structure: Sealing rubber rings or waterproof covers, suitable for humid environments such as bathrooms and balconies.
[0009] For a plastic-structured wire box, after it is formed by an injection molding processing device, a secondary step is required to install a screw hole gasket into the slot of the wire box; in traditional processing methods, manual installation is usually adopted; with the progress of technology, it has gradually changed from manual to automated production. Therefore, after the injection molding processing device forms the wire box, the formed wire box needs to be sent into the subsequent processing device at a relatively fixed angle; thus, it is necessary to identify and adjust the direction of the wire box sent to the transmission line to meet the processing requirements; Image processing refers to the technology of analyzing, enhancing, restoring, or extracting features from digital images through computer algorithms, which is widely used in the process of industrial production; traditional image processing techniques rely on scene adaptation and have poor cross-domain effects, while image processing techniques based on deep recognition algorithms have problems such as a large number of model parameters and complex calculations.
[0010] Therefore, how to combine image processing technology with the wire box direction recognition technology to simplify the recognition process and improve the recognition efficiency has become a technical problem to be solved urgently. Summary of the Invention
[0011] To solve the above technical problems, this application is proposed. This application provides a wire box direction adjustment method based on image processing.
[0012] In the first aspect of this application, a wire box direction adjustment method based on image processing is provided, including the following specific steps:
[0013] S1: Place a wire box standard part at the alignment position in the recognition area, collect image data under different fill light conditions, and perform preprocessing.
[0014] S2: Perform edge contour detection based on the Canny algorithm, and perform color inversion processing on the detected edge contours to generate standard reference images under different fill light conditions.
[0015] S3: Use the steps of S1 and S2 to collect the image data to be measured of the wire box, perform preprocessing and then edge contour detection.
[0016] S4: Process based on the extracted edge contours to determine four vertices.
[0017] S5: Take the lower left vertex as the coordinate origin, calculate the vector between the diagonal vertex and the origin, and calculate the offset angle.
[0018] S6: Rotate the image to be measured according to the offset angle, and match the corresponding standard reference image according to the original fill light information of the collected image.
[0019] S7: Compare the rotated image to be measured with the standard reference image, detect whether there is a large area of color inversion area in the image, and adjust the angle of the wire box according to the detection result.
[0020] Furthermore, in step S1, an image acquisition module and a fill light component are installed at a designated position of the transmission line, and the wire box moving on the transmission line is vertically photographed to acquire an image.
[0021] Furthermore, in step S1, the data of the fill light component is obtained while capturing the image, specifically including color temperature, color rendering index, lumen and brightness.
[0022] Furthermore, the preprocessing steps in step S1 include: grayscale conversion and noise removal.
[0023] Furthermore, in step S2, the grayscale image is inverted to green; different data sets are set for different fill-light conditions to respectively store standard control images corresponding to the fill-light conditions.
[0024] Furthermore, in step S4, the shape of the contour is determined using a polygonal approximation method, the coordinates of the four vertices are calculated, and the vertices are arranged in ascending order of polar angles according to the centroid method.
[0025] Furthermore, in step S5, the vertex with the smallest sum of horizontal and vertical coordinates is taken as the origin, the point with the largest sum of horizontal and vertical coordinates is taken as the diagonal vertex, the vector between the diagonal vertex and the origin is calculated, and the offset angle is calculated.
[0026] Furthermore, in step S6, the lower left corner vertex is used as the rotation center point, and the image to be measured is rotated according to the offset angle.
[0027] Further, in step S7, a determination threshold is set, and if the determination is below the threshold standard, the wire box is adjusted according to the angle of image adjustment;
[0028] If there is color inversion in an area exceeding 2% of the pixel area, it is considered to exceed the threshold standard and requires secondary rotation; the image is rotated 90° clockwise with the centroid of the edge contour as the center point for secondary verification; if it meets the threshold standard, the wire box is adjusted according to the angles of the two image adjustments; if it still does not meet the threshold standard, it is marked for manual processing.
[0029] The second aspect of the present invention provides a wire box direction adjustment system based on image processing, which uses the above method for detection, including an image acquisition module, a fill light component, a preprocessing module, a calculation module, a data annotation module, an angle adjustment module and an interactive display module;
[0030] The image acquisition module is installed vertically just above the transmission line identification area to collect image data of the wire box;
[0031] The fill light component is installed on one side of the image acquisition module and is used to work in conjunction with the image acquisition module to provide a supplementary light source when acquiring image data to reduce the impact of ambient light;
[0032] The preprocessing module is used to perform preprocessing steps on the acquired images to eliminate noise and enhance contrast;
[0033] The calculation module is used to determine the contour and four vertices of the image, and adjust and compare the image according to the offset angle;
[0034] The data annotation module is used to mark the wire boxes that still fail to pass the verification after two rotations and transfer them to manual processing;
[0035] The angle adjustment module is used to adjust the angle of the wire boxes on the conveyor line step by step according to the technical angle output by the calculation module;
[0036] The interactive display module is used to display the running state of the system and provide an interactive control interface; the user manually changes the standard reference image through the interactive control interface and conducts verification manually.
[0037] A third aspect of the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned wire box direction adjustment method based on image processing are implemented.
[0038] A fourth aspect of the present invention provides a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned wire box direction adjustment method based on image processing is implemented.
[0039] Compared with the prior art, the wire box direction adjustment method based on image processing provided by this application establishes standard reference images under different parameters and performs color inversion processing on the standard reference images; then, for the acquired grayscale images, first determine the vertices and offset angles, and after correcting the images using the offset angles; compare the corrected images with the standard reference images. If the comparison is successful, adjust the wire box according to the angle adjustment of the aforementioned images; if the comparison fails, on the basis of the adjustment of the aforementioned images, rotate 90° clockwise for a second verification. If the comparison still fails, perform annotation and transfer it to manual processing, identify the cause of the problem and record the log; through the image adjustment and comparison method, verification can be carried out in advance before the mechanical equipment adjusts the pose of the wire box, so as to improve the accuracy of the subsequent mechanical equipment in adjusting the pose; it is convenient for the processing of subsequent production steps and improves production efficiency. Description of the Drawings
[0040] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. In the drawings:
[0041] Figure 1 It is a top view structural schematic diagram of an 86-type flush-mounted wire box in the prior art.
[0042] Figure 2 It is a flowchart of a wire box direction adjustment method based on image processing according to an embodiment of the present application.
[0043] Figure 3 It is a system structure block diagram of a wire box direction adjustment system based on image processing according to an embodiment of the present application.
[0044] Figure 4 It shows a structural schematic diagram of a computer system of an electronic device suitable for implementing the embodiments of the present invention. Detailed implementation manners
[0045] Next, example embodiments according to the present application will be described in detail with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. It should be understood that the present application is not limited by the example embodiments described herein.
[0046] Embodiment 1
[0047] As Figure 2 shown, it is a flowchart of a wire box direction adjustment method based on image processing according to an embodiment of the present application.
[0048] The present invention provides a wire box direction adjustment method based on image processing, including the following specific steps:
[0049] S1: Place the wire box standard part at the alignment position in the recognition area, collect image data under different supplementary lighting conditions, and perform preprocessing; in this step, first determine the external dimensions of a certain general model wire box and the posture convenient for subsequent processing and installation; then set the recognition area at a specified position on the transmission line and install the corresponding image acquisition module and supplementary lighting component; the image acquisition module is vertically installed directly above the recognition area. When the wire box moves to the alignment position in the recognition area along with the transmission line, the image acquisition module and the supplementary lighting component are activated to collect image information.
[0050] First, use the standard parts of this model to place it at the alignment position in the recognition area, and then control the supplementary lighting component to collect multiple image information of the same wire box at different color temperatures, color rendering indices, and brightness levels; then perform standard preprocessing steps on the collected image information, specifically including grayscale conversion and noise removal steps.
[0051] Furthermore, when collecting images in step S1, obtain the data of the supplementary lighting component, specifically including color temperature, color rendering index, lumen, and brightness. Create folders for the images obtained under different parameters and save them in the database. The pictures obtained under the same supplementary lighting parameters are saved in the same folder.
[0052] S2: Perform edge contour detection based on the Canny algorithm and perform color inversion on the detected edge contours to generate standard reference images under different supplementary lighting conditions; in step S2, invert the grayscale image into green; set different data sets for different supplementary lighting conditions and save the standard reference images corresponding to the supplementary lighting conditions respectively.
[0053] In this step, the Canny algorithm is already a relatively mature contour extraction scheme in the field, so the detailed steps will not be specifically introduced in this article, and only the basic steps will be simply explained; specifically as follows: First, dynamically calculate the threshold based on the image grayscale histogram for the picture processed by grayscale conversion in step S1; perform a morphological closing operation on the edge image to fill the contour gaps; then, extract all external contours and filter them to remove interfering contours with an area smaller than the set threshold, so as to finally obtain the picture after extracting the edge contours.
[0054] For all the processed pictures, use the method of manual annotation to determine the lower left corner vertex of the contour as the recognition point, and manually remove the pictures with poor imaging effects and obvious defects in contour extraction; (such as there are large missing parts between the contour and the actual picture, or there are parts in the contour that do not exist in the actual picture) to obtain the final standard reference image, ensuring that there is at least one standard reference image for each typical supplementary lighting parameter. In this step, after removing the abnormal data, it is beneficial to improve the accuracy and processing speed of the subsequent steps.
[0055] S3: Use the steps of S1 and S2 to collect the image data to be measured of the wire box, perform preprocessing and edge contour detection; in this step, repeat steps S1 and S2 to collect image data of the same type of wire box during the transportation on the transmission line; and perform preprocessing and edge contour detection to obtain the contour map.
[0056] S4: Process based on the extracted edge contours to determine four vertices. In step S4, the polygon approximation method is used to determine the shape of the contour, then the coordinates of the four vertices are calculated, and the vertices are sorted in ascending order of polar angle according to the centroid method. In this step, the contour map is used to obtain the rotation rectangle parameters according to the minimum bounding rectangle algorithm, including the center point (x c , y c ), size (w, h), and rotation angle θ; the coordinates of the four vertices (x i , y i ), i = 1, 2, 3, 4 are deduced according to the rotation matrix parameters; calculate the centroid of the vertex set Calculate the polar angle αi = arctan2(yi - y0, xi - x0) of each vertex relative to the centroid; sort the vertices in ascending order of polar angle.
[0057] S5: Take the bottom - left vertex as the coordinate origin, calculate the vector between the diagonal vertex and the origin, and calculate the offset angle. In step S5, the vertex with the minimum sum of horizontal and vertical coordinates is taken as the origin, and the point with the maximum sum of horizontal and vertical coordinates is taken as the diagonal vertex. Calculate the vector between the diagonal vertex and the origin and calculate the offset angle. In this step, to simplify the subsequent calculation amount, the bottom - left vertex is selected as the origin, and the coordinates of the diagonal vertex are corrected to reduce the data calculation amount.
[0058] S6: Rotate the image to be measured according to the offset angle, and match the corresponding standard reference image according to the original fill - light information of the acquired image. In step S6, the bottom - left vertex is used as the rotation center point to rotate the image to be measured according to the offset angle.
[0059] S7: Compare the rotated image to be measured with the standard reference image, detect whether there is a large - area image color - inversion area, and adjust the angle of the wire box according to the detection result. When detecting, the standard reference image is used as the base layer, the rotated image to be measured is moved above the base layer, and the bottom - left vertex is corresponding to the recognition point of the standard reference image; detect the area of the color - inversion area in the image at this time;
[0060] Set a determination threshold. If the determination is lower than the threshold standard, adjust the wire box according to the angle of image adjustment;
[0061] If there is an area with more than 2% pixel area showing color - inversion phenomenon, it is considered to exceed the threshold standard and requires secondary rotation; rotate the image 90° clockwise with the centroid point of the edge contour as the center point for secondary verification; if it meets the threshold standard, adjust the wire box according to the angles of the two image adjustments; if it still does not meet the threshold standard, make a mark for manual processing.
[0062] The present invention establishes a standard reference image library and uniformly uses the lower left vertex as the recognition point; after preprocessing the collected image to be measured and detecting the edge contour, four vertices are determined; the image is corrected by calculating the offset angle between the diagonal vertices; the corrected image is compared with the standard reference image. If the comparison is successful, the wire box is adjusted according to the angle adjustment of the aforementioned image; if the comparison fails, on the basis of the aforementioned image adjustment, it is rotated 90° clockwise for secondary verification. If the comparison still fails, it is marked and transferred to manual processing to identify the cause of the problem and record the log.
[0063] The following uses a specific case to introduce the solution of the present invention in detail:
[0064] As Figure 1 shown, it is a common 86-type flush-mounted wire box; after being processed by an injection molding processing device, it is generally collected in a large bucket; when a sufficient number of wire boxes are accumulated, they are poured onto a conveyor line to facilitate the subsequent step of installing screw hole gaskets; as Figure 1 shown, symmetric mounting positions 1 are provided on the box body 2 for installing screw hole gaskets; for a wire box with a plastic structure, after being formed by an injection molding processing device, the screw hole gaskets need to be installed in the slots of the wire box through manual or machine automation installation steps; therefore, a wire box adjustment structure needs to be set on the conveyor line to make the mounting position of the screw hole gasket correspond to the position to be processed; since the 86-type wire box has a square structure as a whole and the mounting positions of its screw hole gaskets are completely symmetrically arranged, it is only necessary to ensure that it is aligned on the horizontal plane. The following is the specific recognition and operation process:
[0065] (1): Use the steps such as S1 and S2 above to collect the image data to be measured of the wire box, obtain an RGB image with a resolution of 1920×1200, and convert it into a grayscale image; after preprocessing and edge contour detection; in this step, image data of the same type of wire box produced is collected during the transportation on the conveyor line; and preprocessing and edge contour detection are performed to obtain a contour map; the rectangular frame structure of the entire box body 2 and the structure of the mounting position 1 will be displayed in the contour map. In this step, after applying CLAHE enhancement, the Canny thresholds are automatically calculated as T1 = 45 and T2 = 135; 2 candidate contours are detected in the grayscale image, and the main contour (area ratio 82%) is retained after area filtering;
[0066] (2): Based on the extracted edge contour for processing, determine four vertices; in step (2), the polygon approximation method is used to determine the shape of the contour, then the coordinates of the four vertices are calculated, and the vertices are arranged in ascending order of polar angle according to the centroid method. In this step, the contour map is used to obtain the rotation rectangle parameters according to the minimum circumscribed rectangle algorithm, including the center point (x c , yc ) Dimensions (w, h), and rotation angle θ; Derive the four vertex coordinates (xi, yi), i = 1, 2, 3, 4 according to the rotation matrix parameters; Calculate the centroid of the vertex set Calculate the polar angle αi = arctan2(yi - y0, xi - x0) of each vertex relative to the centroid; Arrange the vertices in ascending order of polar angle. Use polygon approximation to obtain four vertices. After calculation, the aspect ratio r = 1.05 is obtained, so it is judged to be a square; The vertex coordinates are output after sorting by the centroid method: (512.3, 288.7), (1215.1, 290.2), (1210.4, 912.5), (509.8, 910.9) four vertex coordinates.
[0067] (3): Take the lower left vertex as the coordinate origin, calculate the vector between the diagonal vertex and the origin, and calculate the offset angle; In step (2), the vertex with the smallest sum of horizontal and vertical coordinates is used as the origin, that is, A(512.3, 288.7), and the point with the largest sum of horizontal and vertical coordinates is used as the diagonal vertex, that is, B(1210.4, 912.5). Calculate the vector between the diagonal vertex and the origin and calculate the offset angle. In this step, to simplify the subsequent calculation amount, the lower left vertex is selected as the origin, and the coordinates of the diagonal vertex are corrected to reduce the data calculation amount. That is, the coordinates of point A are (0, 0); The corrected coordinates of point B are (698.1, 623.8); According to the angle calculation formula, the angle of the corrected vector can be calculated as 41.8°. Since the 86-type wire box is a square, the included angle of the diagonal vertices is 45°, and the corrected offset angle is 3.2°.
[0068] (4): Rotate the image to be measured counterclockwise by 3.2° according to the offset angle, and match the corresponding standard reference image according to the original fill light information of the collected image; In step (4), the lower left vertex is used as the rotation center point, and the image to be measured is rotated according to the offset angle.
[0069] (5): Compare the rotated image to be measured with the standard reference image, detect whether there is a large area of image color inversion area, and adjust the angle of the wire box according to the detection result. When detecting, take the standard reference image as the base layer, move the rotated image to be measured above the base layer, and correspond the lower left vertex to the recognition point of the standard reference image; Detect the area of the color inversion area in the image at this time; Since the standard reference image has been color-inverted and its background color is green; And the image to be measured is still a grayscale image. Therefore, when the two images are overlapped, the unobscured green area can be conveniently observed. By calculating the pixel area of this part of the area in the entire contour image, it can be determined whether the image to be measured is aligned after being adjusted at the current angle. Take Figure 1 as an example, the base layer is Figure 1The structure shown is green as a whole. If the position of the installation position 1 is the same as the standard control image after the image to be tested is adjusted once, the gray image will cover the green part. If the position of the installation position 1 is different from the standard control image after the adjustment, the installation position 1 on the standard control image will not be blocked, and the green pixel area will be very significant. By identifying the green pixel area, it is convenient to identify whether the image is adjusted in place.
[0070] Set the judgment threshold, if the judgment is lower than the threshold standard, adjust the wire box according to the angle of image adjustment;
[0071] If there is color inversion in an area exceeding 2% of the pixel area, it is considered to exceed the threshold standard and requires secondary rotation; the image is rotated 90° clockwise with the centroid of the edge contour as the center point for secondary verification; if it meets the threshold standard, the wire box is adjusted according to the angles of the two image adjustments; if it still does not meet the threshold standard, it is marked for manual processing.
[0072] Example 2
[0073] like Figure 3 , which is a system structure block diagram of a wire box direction adjustment system based on image processing according to an embodiment of the present application. The present invention provides a wire box direction adjustment system based on image processing, which uses the steps of the method described in Example 1 to detect the wire box on the transmission line, and specifically includes an image acquisition module, a fill light component, a preprocessing module, a calculation module, a data annotation module, an angle adjustment module and an interactive display module;
[0074] The image acquisition module is installed vertically just above the transmission line identification area to collect image data of the wire box;
[0075] The fill light component is installed on one side of the image acquisition module and is used to work in conjunction with the image acquisition module to provide a supplementary light source when acquiring image data to reduce the impact of ambient light;
[0076] The preprocessing module is used to perform preprocessing steps on the collected images to eliminate noise and improve contrast;
[0077] The calculation module is used to determine the contour and four vertices of the image, and to adjust and compare the image according to the offset angle;
[0078] The data annotation module is used to mark the wire boxes that still fail verification after two rotations and transfer them to manual processing;
[0079] The angle adjustment module is used to adjust the angle of the wire box on the transmission line step by step according to the technical angle output by the calculation module;
[0080] The interactive display module is used to display the operating status of the system and provide an interactive control interface; the user manually changes the standard reference image through the interactive control interface and conducts verification manually.
[0081] In this embodiment, the image acquisition module first acquires the standard reference images of this type of wire box under different supplementary lighting conditions, and performs color inversion processing on the standard reference images; in an indoor environment with good lighting conditions, relatively fixed supplementary lighting conditions can be used for image acquisition to reduce the problem of large differences in imaging effects caused by environmental light factors; for scenes with large changes in environmental light, the environmental light intensity can be acquired through an algorithm, and the parameters of the supplementary lighting component can be adaptively adjusted to ensure a stable imaging effect. Here, those skilled in the art can understand that the specific operations of each step in the above wire box direction adjustment method based on image processing have been introduced in detail in the description of the wire box direction adjustment method based on image processing above Figures 2 to 3 and therefore, the repeated description thereof will be omitted.
[0082] Embodiment 3
[0083] Figure 4 FIG. shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present invention.
[0084] It should be noted that the computer system of the electronic device in this embodiment is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0085] The computer system in this embodiment includes a central processing unit 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory 402 or the program loaded from the storage part 408 into the random access memory 403, such as performing the wire box direction adjustment method based on image processing described in the above embodiment. In the random access memory 403, various programs and data required for system operation are also stored. The central processing unit 401, the read-only memory 402, and the random access memory 403 are connected to each other through a bus 404. The input / output interface 405 is also connected to the bus 404.
[0086] The following components are connected to the input / output interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. The drive 410 is also connected to the input / output interface 405 as required. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is installed on the drive 410 as required so that a computer program read from it can be installed into the storage section 408 as required.
[0087] Specifically, according to an embodiment of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present invention includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 409, and / or installed from the removable medium 411. When the computer program is executed by the central processing unit 401, various functions defined in the system of the present invention are executed.
[0088] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable computer program is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0089] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. Among them, each block in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0090] The units involved in the embodiments of the present invention can be implemented in software or in hardware, and the described units can also be provided in a processor. In some cases, the names of these units do not constitute a limitation to the unit itself.
[0091] According to one aspect of the present invention, there is provided a computer program product or a computer program, the computer program product or the computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above various alternative implementations.
[0092] As another aspect, the present invention further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or may exist alone without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device implements the method for adjusting the line box direction based on image processing described in the above embodiments.
[0093] It should be noted that although several modules or units of a device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present invention, the features and functions of two or more of the above-described modules or units can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0094] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the methods according to the embodiments of the present invention.
[0095] In summary, the line box orientation adjustment method based on image processing according to the embodiments of the present application is clarified. It involves establishing standard reference images under different parameters and performing color inversion on the standard reference images. Then, for the collected grayscale image, first determine the vertices and the offset angle, and after correcting the image using the offset angle, compare the corrected image with the standard reference image. If the comparison is successful, adjust the line box according to the angle adjustment of the aforementioned image. If the comparison fails, on the basis of the adjustment of the aforementioned image, rotate it 90° clockwise for secondary verification. If the comparison still fails, make a mark and transfer it to manual processing to identify the cause of the problem and record the log. Through the image adjustment and comparison method, verification can be carried out in advance before the mechanical equipment adjusts the pose of the line box, so as to improve the accuracy of the subsequent mechanical equipment in adjusting the pose, facilitate the processing of subsequent production steps, and improve production efficiency.
Claims
1. A method for adjusting the direction of a wire box based on image processing, characterized in that The specific steps include: S1: Use the standard wire box to place it in the alignment position of the recognition area, collect image data under different fill light conditions, and perform preprocessing; S2: Perform edge contour detection based on the Canny algorithm and perform color inversion on the detected edge contour to generate standard control images under different fill light conditions; S3: using the steps of S1 and S2 to collect the image data of the wire box to be tested, and perform preprocessing and edge contour detection; S4: Processing based on the extracted edge contour to determine four vertices; S5: Taking the lower left vertex as the coordinate origin, calculate the vector between the diagonal vertex and the origin, and calculate the offset angle; S6: Rotate the image to be tested according to the offset angle, and match the corresponding standard reference image according to the original fill light information of the acquired image; S7: Compare the rotated image to be tested with the standard reference image to detect whether there is a large area of image inversion, and adjust the angle of the wire box according to the detection result.
2. The method for adjusting the direction of the wire box based on image processing according to claim 1, wherein In step S1, an image acquisition module and a fill light component are installed at a designated position of the transmission line, and the wire box moving on the transmission line is vertically photographed to acquire an image.
3. The method for adjusting the direction of the wire box based on image processing according to claim 2, characterized in that, In step S1, the data of the fill light component is obtained while capturing the image, specifically including color temperature, color rendering index, lumen and brightness.
4. The method for adjusting the direction of the wire box based on image processing according to any one of claims 1-3, characterized in that, The preprocessing steps in step S1 include: grayscale conversion and noise removal.
5. The method for adjusting the direction of the wire box based on image processing according to claim 1, characterized in that In step S2, the grayscale image is inverted to green; different data sets are set for different fill-light conditions to respectively save standard control images corresponding to the fill-light conditions.
6. The method for adjusting the direction of the wire box based on image processing according to claim 1, wherein In step S4, the shape of the contour is determined using a polygonal approximation method, the coordinates of the four vertices are calculated, and the vertices are arranged in ascending order of polar angles according to the centroid method.
7. The method for adjusting the direction of the wire box based on image processing according to claim 6, wherein In step S5, the vertex with the smallest sum of horizontal and vertical coordinates is taken as the origin, the point with the largest sum of horizontal and vertical coordinates is taken as the diagonal vertex, the vector between the diagonal vertex and the origin is calculated, and the offset angle is calculated.
8. The method for adjusting the direction of the wire box based on image processing according to claim 1, characterized in that In step S6, the lower left corner vertex is used as the rotation center point, and the image to be measured is rotated according to the offset angle.
9. The method for adjusting the direction of the wire box based on image processing according to claim 1, characterized in that In step S7, a determination threshold is set, and if the determination is below the threshold standard, the wire box is adjusted according to the image adjustment angle; If there is color inversion in an area exceeding 2% of the pixel area, it is considered to exceed the threshold standard and requires secondary rotation; the image is rotated 90° clockwise with the centroid of the edge contour as the center point for secondary verification; if it meets the threshold standard, the wire box is adjusted according to the angles of the two image adjustments; if it still does not meet the threshold standard, it is marked for manual processing.
10. A wire box direction adjustment system based on image processing, which uses the method described in any one of claims 1-9 for detection, characterized in that, It includes an image acquisition module, a fill light component, a preprocessing module, a calculation module, a data annotation module, an angle adjustment module and an interactive display module; The image acquisition module is installed vertically just above the transmission line identification area to collect image data of the wire box; The fill light component is installed on one side of the image acquisition module and is used to work in conjunction with the image acquisition module to provide a supplementary light source when acquiring image data to reduce the impact of ambient light; The preprocessing module is used to perform preprocessing steps on the collected images to eliminate noise and improve contrast; The calculation module is used to determine the contour and four vertices of the image, and to adjust and compare the image according to the offset angle; The data annotation module is used to mark the wire boxes that still fail the verification after two rotations and transfer them for manual processing; The angle adjustment module is used to adjust the angles of the wire boxes on the transmission line step by step according to the technical angles output by the calculation module; The interactive display module is used to display the operating status of the system and provide an interactive control interface; the user manually changes the standard comparison image through the interactive control interface and conducts verification manually.
Citation Information
Patent Citations
Multi-feature fusion visual identification method and system
CN112560704A
Visual inspection system and method for liquid crystal display machine of electric energy meter
CN114236885A
Method and system for measuring rotating speed under polar coordinate system based on event camera
CN115205368A
Novel LED crystal grain rapid identification and positioning method
CN117911510A
Visual inspection-based wobble plate adjustment method and wobble plate equipment
CN118514089A