Positioning method and device, electronic equipment and storage medium
By extracting and segmenting the edges of electronic product images, edge segments are constructed to determine the logo attachment location, which solves the problem of inaccurate logo positioning caused by different surface shapes and sizes of electronic product, and improves the success rate of logo installation.
Patent Information
- Application Number
- CN202411985420.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-13
AI Technical Summary
Due to the different shapes and sizes of the surfaces of electronic products, the positioning of the logo attaches is inaccurate, and a method of accurately positioning the position of the logo attaches is needed.
By acquiring the product image to be processed, extracting the edge image and segmenting it, extracting the target edge pixel points, building the first and second edge segments, and using these segments to determine the attachment position of the logo on the product surface.
It improves the success rate of logo installation and ensures accurate positioning of logo attachment.
Smart Images

Figure CN119991798A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a positioning method, device, electronic device and storage medium. Background Art
[0002] Electronic products such as mobile phones and laptops need to be affixed with logos before leaving the factory. At present, due to the different shapes and sizes of the surfaces of electronic products, the logo attachment position is not accurately positioned. Therefore, how to accurately locate the logo attachment position has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The present disclosure provides a positioning method, device, electronic device and storage medium.
[0004] According to a first aspect of the present disclosure, a positioning method is provided, the method comprising:
[0005] Obtain the product image to be processed;
[0006] Extracting an edge image corresponding to the product image to be processed;
[0007] Segmenting the edge image to obtain a plurality of sub-edge images;
[0008] Extracting target edge pixel points corresponding to each of the sub-edge images;
[0009] Based on each of the target edge pixels, construct a first edge line segment and a second edge line segment corresponding to the edge image, wherein the first edge line segment is not parallel to the second edge line segment;
[0010] The attachment position of the target identification product on the surface of the product to be processed corresponding to the first edge line segment and the second edge line segment is determined, and the target identification product is installed at the attachment position.
[0011] In an implementation of the present application, the step of obtaining the image of the product to be processed includes:
[0012] Collecting an appearance image of the product to be processed, wherein the appearance image includes an area image corresponding to the target identified product;
[0013] The appearance image is subjected to denoising processing to obtain a denoised image as the product image to be processed.
[0014] In an implementation of the present application, the step of extracting an edge image corresponding to the product image to be processed includes:
[0015] A preset edge convolution kernel is used to perform convolution processing on the product image to be processed, and the image after convolution processing is obtained as the edge image corresponding to the product image to be processed.
[0016] In an implementation of the present application, constructing a first edge line segment corresponding to the edge image based on each of the target edge pixels includes:
[0017] Selecting two target edge pixel points as first edge pixel points;
[0018] Determine a first distance between each of the remaining target edge pixel points and a first straight line, where the first straight line is a straight line determined based on the first edge pixel point;
[0019] Determine the target edge pixel point whose corresponding first distance is less than a first preset distance threshold as a first fitting pixel point;
[0020] Each of the first fitting pixel points is fitted to obtain a line segment as the first edge line segment corresponding to the edge image.
[0021] In an implementation of the present application, before determining the target edge pixel point whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel point, the method further includes:
[0022] Determine whether the number of target edge pixel points whose corresponding first distance is less than a first preset distance threshold is greater than a first preset number;
[0023] If yes, determining the target edge pixel point whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel point;
[0024] If not, two new target edge pixel points are selected as first edge pixel points, and the process returns to the step of determining the first distance between each of the remaining target edge pixel points and the first straight line.
[0025] In an implementation of the present application, determining the attachment position of the target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and installing the target identification product at the attachment position includes:
[0026] Determine the intersection position between the first edge line segment and the second edge line segment as the attachment position corresponding to the target identification product on the surface of the product to be processed;
[0027] determining the offset angle of the first edge line segment as the installation angle;
[0028] According to the installation angle, the target identification product is installed at the attachment position.
[0029] According to a second aspect of the present disclosure, a positioning device is provided, the device comprising:
[0030] An image acquisition module, used to acquire the image of the product to be processed;
[0031] An edge extraction module, used to extract an edge image corresponding to the product image to be processed;
[0032] An image segmentation module, used for segmenting the edge image to obtain a plurality of sub-edge images;
[0033] An edge pixel determination module, used for extracting target edge pixel points corresponding to each of the sub-edge images;
[0034] An edge line segment construction module, configured to construct a first edge line segment and a second edge line segment corresponding to the edge image based on each of the target edge pixels, wherein the first edge line segment is not parallel to the second edge line segment;
[0035] A positioning module is used to determine the attachment position of the target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and install the target identification product at the attachment position.
[0036] In one implementation of the present application, the image acquisition module is specifically used to collect the appearance image of the product to be processed, wherein the appearance image includes the area image corresponding to the target identification product; and denoise the appearance image to obtain the denoised image as the image of the product to be processed.
[0037] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0038] at least one processor; and
[0039] a memory communicatively coupled to the at least one processor;
[0040] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the present disclosure.
[0041] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0042] The positioning method provided by the present disclosure is adopted to obtain an image of a product to be processed, extract an edge image corresponding to the image of the product to be processed, segment the edge image to obtain a plurality of sub-edge images, extract the target edge pixel points corresponding to each sub-edge image, and construct the first edge line segment and the second edge line segment corresponding to the edge image based on each target edge pixel point, wherein the first edge line segment is not parallel to the second edge line segment, and the attachment position corresponding to the target identification product on the surface of the product to be processed is determined according to the first edge line segment and the second edge line segment, and the target identification product is installed at the attachment position. By extracting the edge pixel points of the logo groove position, removing the outliers in the edge pixel points, and accurately locating the attachment position corresponding to the logo through the first edge line segment and the second edge line segment corresponding to the edge image, the success rate of logo installation is improved.
[0043] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0045] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0046] Figure 1 A schematic diagram of an implementation flow of a positioning method provided in an embodiment of the present application is shown;
[0047] Figure 2 A schematic diagram of an edge segment determination process provided by an embodiment of the present application is shown;
[0048] Figure 3 A schematic diagram of determining an attachment position provided in an embodiment of the present application is shown;
[0049] Figure 4 A schematic diagram of the structure of a positioning device provided in an embodiment of the present application is shown;
[0050] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0051] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0052] At present, due to the different shapes and sizes of electronic product surfaces, the logo attachment position is not accurately located. Therefore, in order to accurately locate the logo attachment position, the present application provides a positioning method, device, electronic device and storage medium. The electronic device provided in the present application can be a mobile phone, a computer, a tablet computer and other devices.
[0053] The technical solution of the embodiment of the present application will be described below in conjunction with the drawings in the embodiment of the present application.
[0054] Figure 1 A schematic diagram of an implementation process of the positioning method provided in an embodiment of the present application is shown. Figure 1 As shown, the method includes:
[0055] S101, obtaining an image of a product to be processed.
[0056] In the present disclosure, the image of the product to be processed refers to the appearance image of the product to be processed. The product to be processed refers to an electronic product that needs to be attached with a logo, and the product to be processed may include electronic products such as laptops and mobile phones. For example, if the electronic product that needs to be attached with a logo is a laptop, usually the logo of the laptop is attached to the C-side of the laptop, then the C-side image of the laptop can be collected as the image of the product to be processed. In the present disclosure, in order to improve the accuracy of logo positioning, the area containing the logo in the collected C-side image of the laptop can also be cropped, and the image containing the logo after cropping is used as the image of the product to be processed. Specifically, the area containing the logo in the C-side image of the laptop can be cropped by setting the coordinates of the center point of the rectangular area and the corresponding width and height, and the cropped logo area image can be obtained as the image of the product to be processed.
[0057] In the present disclosure, an image acquisition device such as a video camera or a camera may be used to acquire the C-side image of the laptop computer.
[0058] In a possible implementation, the step of obtaining the image of the product to be processed includes steps A1-A2:
[0059] Step A1, collecting an appearance image of the product to be processed, wherein the appearance image includes an area image corresponding to the target identified product.
[0060] In the present disclosure, an image acquisition device such as a video camera or a camera may be used to acquire the appearance image of the product to be processed. The target logo product refers to a logo that needs to be installed or attached to the product to be processed.
[0061] Step A2: denoising the appearance image to obtain a denoised image as the product image to be processed.
[0062] In the present disclosure, the appearance image can be subjected to Gaussian blur processing, and the noise with higher energy in the appearance image can be removed by Gaussian blur processing to obtain a Gaussian processed image. In the present disclosure, the Gaussian processed image corresponding to the appearance image can be used as the product image to be processed.
[0063] S102: extracting an edge image corresponding to the product image to be processed.
[0064] In the present disclosure, the product image to be processed can be convolved, and the pixel points in the product image to be processed can be convolved by the convolution kernel K, and the obtained convolved image can be used as the edge image corresponding to the product image to be processed. By performing convolution processing on the product image to be processed, the edge gradient of the image can be enhanced, which facilitates the extraction of the boundary position corresponding to the target identification product in the image.
[0065] In a possible implementation, a preset edge convolution kernel may be used to perform convolution processing on the product image to be processed, and the image after convolution processing is obtained as the edge image corresponding to the product image to be processed. The preset edge convolution kernel may be set according to the actual application scenario. Specifically, the pixel points in the product image to be processed may be convolved using the convolution kernel K and the following formula, and the obtained convolution image may be used as the edge image corresponding to the product image to be processed:
[0066]
[0067] Among them, M kg (i, j) represents the convolved image, K(x, y) represents the convolution kernel, and x and y represent the horizontal and vertical coordinates of the pixel point in the i-th row and j-th column.
[0068] S103, segmenting the edge image to obtain a plurality of sub-edge images.
[0069] In the present disclosure, the edge image can be equivalently divided into a preset number of sub-edge images of equal area. The preset number can be set according to actual application requirements, for example, the preset number can be set to 4 or 6.
[0070] In the present disclosure, the edge image may also be equivalently divided into a plurality of sub-edge images each having an area of the preset area according to the preset area. The preset area may be set according to actual application requirements.
[0071] S104: extract target edge pixel points corresponding to each of the sub-edge images.
[0072] In the present disclosure, for each sub-edge image, the gradient value of each pixel in the sub-edge image can be determined according to the gradient algorithm. The pixel points in the sub-edge image whose gradient value is greater than the preset gradient threshold can be screened by a preset gradient threshold as the target edge pixel points corresponding to the sub-edge image. The preset gradient threshold can be set according to the actual application scenario. In an optional embodiment, for each sub-edge image, the middle column of pixels in the sub-edge image can be set to I, and the edge point P in the pixel point I can be determined by the preset gradient threshold T. i As the target edge pixel points corresponding to the sub-edge image, all target edge pixel points can form a set V Pi Specifically, set V Pi It can be expressed as: V pi ={i|P i =|I i+1 -I i |>T,i=1,2,…,n-1}, where n represents the number of pixels in the middle column of the sub-edge image.
[0073] S105: construct a first edge line segment and a second edge line segment corresponding to the edge image based on each of the target edge pixels, wherein the first edge line segment is not parallel to the second edge line segment.
[0074] In the present disclosure, the first edge line segment may be a line segment representing a horizontal boundary of an edge image, and the second edge line segment may be a line segment representing a vertical boundary of an edge image.
[0075] S106, determining an attachment position of a target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and installing the target identification product at the attachment position.
[0076] In the present disclosure, the first edge line segment may be a line segment representing the horizontal boundary of the edge image, and the second edge line segment may be a line segment representing the vertical boundary of the edge image. Then, the intersection position of the first edge line segment and the second edge line segment may be determined and the intersection position may be used as the attachment position corresponding to the surface of the product to be processed.
[0077] In an optional embodiment, determining the attachment position of the target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and installing the target identification product at the attachment position may include steps B1-B3:
[0078] Step B1: determining the intersection position between the first edge line segment and the second edge line segment as the attachment position corresponding to the target identification product on the surface of the product to be processed.
[0079] In the present disclosure, a first segment equation of the first edge segment can be constructed according to any two points in the first edge segment, and a second segment equation of the second edge segment can be constructed according to any two points in the second edge segment, and the intersection of the first segment equation and the second segment equation can be analyzed as the intersection position between the first edge segment and the second edge segment.
[0080] Step B2: determining the offset angle of the first edge segment as the installation angle.
[0081] In the present disclosure, an inverse tangent function may be used to calculate the offset angle of the first edge line segment, and the offset angle of the first edge line segment may be used as the installation angle.
[0082] Step B3: installing the target identification product at the attachment position according to the installation angle.
[0083] In the present disclosure, the logo installation device can be controlled to align the logo with the attachment position according to the installation angle, and the logo can be installed at the attachment position.
[0084] The positioning method provided by the present disclosure is adopted to obtain an image of a product to be processed, extract an edge image corresponding to the image of the product to be processed, segment the edge image to obtain a plurality of sub-edge images, extract the target edge pixel points corresponding to each sub-edge image, and construct the first edge line segment and the second edge line segment corresponding to the edge image based on each target edge pixel point, wherein the first edge line segment is not parallel to the second edge line segment, and the attachment position corresponding to the target identification product on the surface of the product to be processed is determined according to the first edge line segment and the second edge line segment, and the target identification product is installed at the attachment position. By extracting the edge pixel points of the logo groove position, removing the outliers in the edge pixel points, and accurately locating the attachment position corresponding to the logo through the first edge line segment and the second edge line segment corresponding to the edge image, the success rate of logo installation is improved.
[0085] In one possible implementation, Figure 2 FIG. 4 shows a schematic diagram of an edge segment determination process provided by an embodiment of the present application. Figure 2 As shown, the step of constructing a first edge line segment corresponding to the edge image based on each of the target edge pixels includes:
[0086] S201: Select two target edge pixel points as first edge pixel points.
[0087] In the present disclosure, two target edge pixel points may be selected as the first edge pixel points, and then the first straight line may be constructed according to the coordinates of the first edge pixel points. For example, the target edge pixel points may constitute a set V Pi , can be randomly selected from the set V Pi Select two target edge pixels P from s1 (x1,y1) and P s2 (x2, y2) is used as the first edge pixel, and then according to the pixel point P s1 (x1,y1) and P s2 The coordinates of (x2, y2) construct the first straight line L.
[0088] Specifically, the following formula can be used to construct the linear equation of the first straight line L according to the coordinates of the pixel points Ps1 (x1, y1) and Ps2 (x2, y2):
[0089] L:Ax+By+C=0
[0090] Among them, A=y2-y1, B=x2-x1, C=x2y1-x1y2.
[0091] S202: Determine a first distance between each of the remaining target edge pixel points and a first straight line, where the first straight line is a straight line determined based on the first edge pixel point.
[0092] For example, we can randomly select Pi Select two target edge pixels P from s1 (x1,y1) and P s2 (x2, y2) is taken as the first edge pixel point, according to the pixel point P s1 (x1,y1) and P s2 The coordinates of (x2, y2) construct the first straight line L. For the set V Pi For the remaining target edge pixel points, the distance from each remaining edge pixel point to the first straight line L can be calculated as the first distance.
[0093] Specifically, the distance Di from each remaining edge pixel point to the first straight line L may be calculated using the following formula:
[0094]
[0095] Among them, the linear equation of the straight line L is L:Ax+By+C=0.
[0096] S203: Determine the target edge pixel point whose corresponding first distance is less than a first preset distance threshold as a first fitting pixel point.
[0097] In the present disclosure, the first preset distance threshold can be set according to actual application requirements.
[0098] S204: Fit each of the first fitting pixel points to obtain a line segment as a first edge line segment corresponding to the edge image.
[0099] In the present disclosure, the least square method may be used to perform line segment fitting on each first fitting pixel point to obtain a first edge line segment corresponding to the edge image.
[0100] For example, each first fitting pixel point can constitute a set V s , we can s The number of first fitting pixels within the filter is filtered when |V s |>N, then perform linear equation fitting L'=a ′ x+b ′ y+c ′ :
[0101]
[0102] Among them: a ′ 、b ′ 、c ′ represents the parameters for solving the straight line equation, |V s | represents the number of first fitting pixel points that meet the requirements, and N represents the first preset distance threshold.
[0103] In a possible implementation, before determining the target edge pixel point whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel point, the method may further include steps C1-C3:
[0104] Step C1, determining whether the number of target edge pixel points corresponding to the first distance less than a first preset distance threshold is greater than a first preset number.
[0105] In the present disclosure, the first preset number can be set according to actual needs.
[0106] Step C2: if yes, determine the target edge pixel point whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel point.
[0107] Step C3: if not, select two new target edge pixel points as first edge pixel points, and return to execute the step of determining the first distance between each of the remaining target edge pixel points and the first straight line.
[0108] In the present disclosure, if the number of target edge pixel points whose corresponding first distance is less than the first preset distance threshold is not greater than the first preset number, the pixel points screened by the current first straight line are not the pixel points representing the edge of the logo. Therefore, two new target edge pixel points can be selected as the first edge pixel points, the first straight line can be reconstructed, and the above steps S201-S204 can be executed.
[0109] In one possible implementation, Figure 3 A schematic diagram of determining an attachment position provided in an embodiment of the present application is shown. Figure 3 As shown, in the present disclosure, an edge image corresponding to the product image 301 to be processed is extracted, the edge image is segmented to obtain a plurality of sub-edge images, and target edge pixel points corresponding to each sub-edge image are extracted. Based on each target edge pixel point, a first edge line segment and a second edge line segment corresponding to the edge image are constructed, wherein the first edge line segment is not parallel to the second edge line segment, and an attachment position 302 is obtained according to the intersection of the first edge line segment and the second edge line segment, and the intersection can be used as the installation position of the Logo. The Logo installation position positioning method in the present disclosure improves the success rate of Logo installation.
[0110] Based on the same inventive concept, according to the positioning method provided in the above embodiment of the present disclosure, correspondingly, another embodiment of the present disclosure further provides a positioning device, whose structural schematic diagram is shown in FIG. Figure 4 As shown, specifically including:
[0111] An image acquisition module 401 is used to acquire an image of a product to be processed;
[0112] The edge extraction module 402 is used to extract the edge image corresponding to the product image to be processed;
[0113] An image segmentation module 403 is used to segment the edge image to obtain a plurality of sub-edge images;
[0114] The edge pixel determination module 404 is used to extract the target edge pixel points corresponding to each of the sub-edge images;
[0115] An edge line segment construction module 405 is used to construct a first edge line segment and a second edge line segment corresponding to the edge image based on each of the target edge pixels, wherein the first edge line segment is not parallel to the second edge line segment;
[0116] The positioning module 406 is used to determine the attachment position of the target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and install the target identification product at the attachment position.
[0117] The positioning device provided by the present disclosure is used to obtain an image of a product to be processed, extract an edge image corresponding to the image of the product to be processed, segment the edge image to obtain multiple sub-edge images, extract the target edge pixel points corresponding to each sub-edge image, and construct the first edge line segment and the second edge line segment corresponding to the edge image based on each target edge pixel point. The first edge line segment is not parallel to the second edge line segment. The attachment position corresponding to the target identification product on the surface of the product to be processed is determined according to the first edge line segment and the second edge line segment, and the target identification product is installed at the attachment position. By extracting the edge pixel points of the logo groove position, removing the outliers in the edge pixel points, and accurately locating the attachment position corresponding to the logo through the first edge line segment and the second edge line segment corresponding to the edge image, the success rate of logo installation is improved.
[0118] In one possible implementation, the image acquisition module 401 is specifically used to collect the appearance image of the product to be processed, wherein the appearance image includes the area image corresponding to the target identified product; and perform denoising on the appearance image to obtain the denoised image as the product image to be processed.
[0119] In one possible implementation, the edge extraction module 402 is specifically configured to perform convolution processing on the product image to be processed using a preset edge convolution kernel, and obtain the image after the convolution processing as the edge image corresponding to the product image to be processed.
[0120] In one possible implementation, the edge segment construction module 405 is specifically used to select two of the target edge pixel points as first edge pixel points; determine the first distance between each of the remaining target edge pixel points and a first straight line, where the first straight line is a straight line determined based on the first edge pixel points; determine the target edge pixel points whose corresponding first distance is less than a first preset distance threshold as first fitting pixel points; and fit each of the first fitting pixel points to obtain a line segment as the first edge line segment corresponding to the edge image.
[0121] In one embodiment, the edge segment construction module 405 is specifically used to determine whether the number of the target edge pixel points whose corresponding first distance is less than the first preset distance threshold is greater than the first preset number; if so, determine the target edge pixel points whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel points; if not, select two new target edge pixel points as the first edge pixel points, and return to execute the step of determining the first distance between the remaining target edge pixel points and the first straight line.
[0122] In one possible implementation, the positioning module 406 is specifically used to determine the intersection position between the first edge segment and the second edge segment as the attachment position corresponding to the target identification product on the surface of the product to be processed; determine the offset angle of the first edge segment as the installation angle; and install the target identification product at the attachment position according to the installation angle.
[0123] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0124] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0125] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0126] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0127] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the positioning method. For example, in some embodiments, the positioning method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the positioning method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the positioning method in any other appropriate manner (e.g., by means of firmware).
[0128] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), integrated systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0129] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0130] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0131] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0132] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0133] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0134] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0135] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0136] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A positioning method, characterized in that: The method comprises: Obtain the product image to be processed; Extracting an edge image corresponding to the product image to be processed; Segmenting the edge image to obtain a plurality of sub-edge images; Extracting target edge pixel points corresponding to each of the sub-edge images; Based on each of the target edge pixels, construct a first edge line segment and a second edge line segment corresponding to the edge image, wherein the first edge line segment is not parallel to the second edge line segment; The attachment position of the target identification product on the surface of the product to be processed corresponding to the first edge line segment and the second edge line segment is determined, and the target identification product is installed at the attachment position.
2. The method according to claim 1, characterized in that: The step of obtaining the image of the product to be processed comprises: Collecting an appearance image of the product to be processed, wherein the appearance image includes an area image corresponding to the target identified product; The appearance image is subjected to denoising processing to obtain a denoised image as the product image to be processed.
3. The method according to claim 1, characterized in that The step of extracting an edge image corresponding to the product image to be processed includes: A preset edge convolution kernel is used to perform convolution processing on the product image to be processed, and the image after convolution processing is obtained as the edge image corresponding to the product image to be processed.
4. The method according to claim 1, characterized in that: The step of constructing a first edge line segment corresponding to the edge image based on each of the target edge pixels includes: Selecting two target edge pixel points as first edge pixel points; Determine a first distance between each of the remaining target edge pixel points and a first straight line, where the first straight line is a straight line determined based on the first edge pixel point; Determine the target edge pixel point whose corresponding first distance is less than a first preset distance threshold as a first fitting pixel point; Each of the first fitting pixel points is fitted to obtain a line segment as the first edge line segment corresponding to the edge image.
5. The method according to claim 4, characterized in that Before determining the target edge pixel point whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel point, the method further includes: Determine whether the number of target edge pixel points whose corresponding first distance is less than a first preset distance threshold is greater than a first preset number; If yes, determining the target edge pixel point whose corresponding first distance is less than the first preset distance threshold as the first fitting pixel point; If not, two new target edge pixel points are selected as first edge pixel points, and the process returns to the step of determining the first distance between each of the remaining target edge pixel points and the first straight line.
6. The method according to claim 1, characterized in that The step of determining the attachment position of the target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and installing the target identification product at the attachment position includes: Determine the intersection position between the first edge line segment and the second edge line segment as the attachment position corresponding to the target identification product on the surface of the product to be processed; determining the offset angle of the first edge line segment as the installation angle; According to the installation angle, the target identification product is installed at the attachment position.
7. A positioning device, characterized in that: The device comprises: An image acquisition module, used to acquire the image of the product to be processed; An edge extraction module, used to extract an edge image corresponding to the product image to be processed; An image segmentation module, used for segmenting the edge image to obtain a plurality of sub-edge images; An edge pixel determination module, used for extracting target edge pixel points corresponding to each of the sub-edge images; An edge line segment construction module, configured to construct a first edge line segment and a second edge line segment corresponding to the edge image based on each of the target edge pixels, wherein the first edge line segment is not parallel to the second edge line segment; A positioning module is used to determine the attachment position of the target identification product on the surface of the product to be processed according to the first edge line segment and the second edge line segment, and install the target identification product at the attachment position.
8. The device according to claim 7, characterized in that The image acquisition module is specifically used to collect the appearance image of the product to be processed, wherein the appearance image includes the area image corresponding to the target identified product; perform denoising on the appearance image to obtain the denoised image as the product image to be processed.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
10. A storage medium comprising computer executable instructions, which when executed by a computer processor are used to perform the method of any one of claims 1 to 6.
Citation Information
Patent Citations
2D code positioning method and system
CN106485183A
Fast positioning method for two-dimensional codes
CN106845314A
Pose determination method and related equipment
CN113313966A
Novel automatic labeling machine for limiting strip of sweeper
CN113460431A
Two-dimensional code positioning method and device, electronic equipment and computer readable storage medium
CN115456004A