Motor boundary detection method and device, electronic equipment and storage medium
Through image comparison technology, the motor boundary position is determined by using the matching degree between the current captured image and the preset reference map, which solves the problems of detection accuracy and inefficiency in traditional methods, and achieves highly accurate and efficient motor boundary detection.
Patent Information
- Application Number
- CN202411374043.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-03-07
AI Technical Summary
The traditional motor boundary detection method has low detection accuracy after the motor is manually disturbed or moved, and the maximum number of steps rotates, resulting in inefficiency.
By comparing the image based on the current captured image and the preset reference map, it is determined whether the motor is at the boundary position, and unnecessary maximum step rotation is avoided.
Improve the accuracy and efficiency of motor boundary detection, ensuring that the boundary position can be accurately detected when the motor is disturbed.
Smart Images

Figure CN119579630A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a motor boundary detection method, device, electronic equipment and storage medium. Background Art
[0002] The traditional method of detecting the boundary position of the motor usually presets the boundary angle of the motor and measures the current angle of the motor through sensors and other devices. If the current angle matches the boundary angle, it is considered that the motor has reached the boundary position, or it is determined by judging whether the motor has rotated to the maximum number of steps to determine whether the motor has reached the boundary position. However, the angle measurement method causes the motor to have an angle deviation after the motor is manually disturbed or moved, and its boundary detection accuracy is not high. The maximum step method performs the maximum number of steps of rotation each time the motor rotates, resulting in unnecessary repetitive operations and low boundary detection efficiency. Therefore, how to provide a method that can ensure the accuracy of boundary detection while improving the efficiency of boundary detection has become an urgent problem to be solved. Summary of the invention
[0003] The embodiment of the present invention provides a motor boundary detection method, which aims to solve the problem of being unable to ensure the accuracy of boundary detection while improving the efficiency of boundary detection. By performing image comparison processing based on the current captured image and a preset reference image, an image comparison result is obtained. Even if the motor is manually disturbed or moved, it will not affect the acquisition screen of the current captured image, thereby ensuring the accuracy of the image comparison result. In addition, boundary detection is achieved only by acquiring the current captured image, and the motor does not need to perform a maximum number of steps of rotation, which can effectively improve the efficiency of boundary detection.
[0004] In a first aspect, an embodiment of the present invention provides a motor boundary detection method, the method comprising the following steps:
[0005] Before the target motor executes a rotation instruction, obtaining a current captured image of the target motor and a preset reference image;
[0006] Based on the current captured image, an image comparison process is performed with the preset reference image to obtain an image comparison result;
[0007] Based on the image comparison result, it is determined whether the target motor is located at a motor boundary.
[0008] Optionally, the preset reference map includes a boundary endpoint map corresponding to each boundary endpoint of the target motor, and obtaining the preset reference map includes:
[0009] Controlling the target motor to each of the boundary endpoints, and acquiring a first captured image sequence of the target motor during the control process;
[0010] The boundary endpoint map is extracted from the first captured image sequence.
[0011] Optionally, performing image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result includes:
[0012] Based on the rotation instruction, determining a target boundary endpoint map from the plurality of boundary endpoint maps;
[0013] Gray-scale the current captured image and the target boundary endpoint map to obtain a first gray-scale image corresponding to the current captured image and a second gray-scale image corresponding to the target boundary endpoint map;
[0014] Dividing the first grayscale image into a plurality of first regions to be compared, and calculating a pixel difference value of each of the first regions to be compared;
[0015] Based on the pixel difference, determining a first feature point in each of the first to-be-compared areas;
[0016] Based on the image coordinates of the first feature point in the first grayscale image, determining a first reference point having the same image coordinates in the second grayscale image;
[0017] A pixel value comparison process is performed on the first feature point in each of the first to-be-compared areas and the corresponding first reference point to obtain the image comparison result.
[0018] Optionally, the preset reference image includes a first panoramic image corresponding to the target motor, the target motor corresponds to at least one rotation limit position, and the step of obtaining the preset reference image further includes:
[0019] Controlling the target motor to rotate to all the rotation limit positions, and acquiring a second captured image sequence of the target motor during the rotation process;
[0020] splicing the captured images in the second captured image sequence to obtain a second panoramic image corresponding to the target motor;
[0021] Repeat the above steps to obtain a preset number of second panoramic images, until the pixel value similarity between the preset number of second panoramic images is higher than a preset similarity threshold, stop repeating, and use any one of the preset number of second panoramic images as the first panoramic image.
[0022] Optionally, the first panoramic image corresponds to a panoramic expansion direction, and the image comparison processing is performed based on the current captured image and the preset reference image to obtain an image comparison result, further comprising:
[0023] Acquire a third captured image sequence of the target motor during the process of executing the rotation instruction;
[0024] Taking the current captured image as a stitching starting point, and performing stitching processing with the captured images in the third captured image sequence, to obtain a third panoramic image;
[0025] grayscale the third panoramic image and the first panoramic image to obtain a third grayscale image corresponding to the third panoramic image and a fourth grayscale image corresponding to the first panoramic image;
[0026] Dividing the third grayscale image into a plurality of second regions to be compared, and calculating a pixel difference value of each of the second regions to be compared;
[0027] Based on the pixel difference, determining a second feature point in each of the second to-be-compared areas;
[0028] Based on the image coordinates of the second feature point in the third grayscale image and the panoramic expansion direction of the first panoramic image, determining a second reference point set corresponding to each second to-be-compared area in the fourth grayscale image, the second reference point set including at least one second reference point sorted according to the image distance between the second reference point and the reference point in the fourth grayscale image, and the reference point is determined according to the panoramic expansion direction of the first panoramic image;
[0029] According to the ranking of the second reference point corresponding to each second area to be compared in the second reference point set, the second reference points are extracted one by one and pixel value comparison processing is performed with the second feature points to obtain the image comparison result.
[0030] Optionally, judging whether the target motor is at a motor boundary based on the image comparison result includes:
[0031] When the image comparison result is a successful comparison, the target motor is at a motor boundary;
[0032] When the image comparison result is a comparison failure, determining an abnormal position of the target motor, and feeding back the abnormal position to a user of the target motor to receive a judgment prompt from the user, and determining whether to update the reference map based on the judgment prompt and determining whether the target motor is at a motor boundary based on the updated reference map;
[0033] When the image comparison result is a preset scene, abnormal installation scene information is fed back to the user.
[0034] Optionally, after determining whether the target motor is located at a motor boundary based on the image comparison result, the method further includes:
[0035] When it is determined that the target motor is at the motor boundary, marking the boundary position of the target motor in the preset reference map;
[0036] Acquire adjacent image frames at the boundary position;
[0037] In a subsequent rotation process of the target motor, judging whether the target motor is adjacent to the boundary position based on the adjacent image frames;
[0038] If the target motor is close to the boundary position, the target motor is controlled to perform a deceleration process.
[0039] In a second aspect, an embodiment of the present invention further provides a motor boundary detection device, the motor boundary detection device comprising:
[0040] An acquisition module, used for acquiring a current captured image of the target motor and a preset reference image before the target motor executes a rotation instruction;
[0041] A comparison module, used to perform image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result;
[0042] A judgment module is used to judge whether the target motor is at a motor boundary based on the image comparison result.
[0043] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the motor boundary detection method provided in the embodiment of the present invention when executing the computer program.
[0044] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the motor boundary detection method provided in the embodiment of the present invention are implemented.
[0045] In an embodiment of the present invention, before the target motor executes a rotation instruction, the current captured image and a preset reference image of the target motor are obtained; based on the current captured image, an image comparison process is performed with the preset reference image to obtain an image comparison result; based on the image comparison result, it is determined whether the target motor is at the motor boundary. By performing an image comparison process with the preset reference image based on the current captured image to obtain an image comparison result, even if the motor is manually disturbed or moved, it will not affect the acquisition screen of the current captured image, thereby ensuring the accuracy of the image comparison result, and only by acquiring the current captured image to achieve boundary detection, the motor does not need to perform the maximum number of steps of rotation, which can effectively improve the efficiency of boundary detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 is a flow chart of a motor boundary detection method provided by an embodiment of the present invention;
[0048] Figure 2 is a flow chart of another motor boundary detection method provided by an embodiment of the present invention;
[0049] Figure 3 is a structural schematic diagram of a motor boundary detection device provided in an embodiment of the present invention;
[0050] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] like Figure 1 As shown, Figure 1 : is a flow chart of a motor boundary detection method provided by an embodiment of the present invention, comprising:
[0053] 101. Before the target motor executes a rotation instruction, obtain a current captured image of the target motor and a preset reference image.
[0054] In an embodiment of the present invention, the above-mentioned motor boundary detection method can be applied to a motor boundary detection platform, can be applied to the above-mentioned target motor or a camera device based on motor rotation, and the above-mentioned motor boundary detection platform is constructed by a server or a server cluster, and the above-mentioned server or server cluster can be any electronic device with image processing, image recognition, data storage, data transmission and other functions.
[0055] It is understood that the motor can generate rotational motion by converting electrical energy into mechanical energy and utilizing the Lorentz force generated by a conductor passing current in a magnetic field. The rotational motion can be transmitted to other parts of the device through gears, belts or other transmission systems, thereby pushing or driving the movement of the corresponding device. Therefore, the rotation instruction can be an instruction for controlling the target motor to perform the rotational motion.
[0056] The above-mentioned current captured image can be captured by an image capturing device deployed on the above-mentioned target motor (that is, the above-mentioned target motor can be understood as a motor for realizing rotation in a camera with a rotation function, and the shooting angle can be selected), and the above-mentioned current captured image is acquired by the image capturing device deployed on the target motor. The above-mentioned preset reference map can include a boundary endpoint map and a first panoramic map. Figure 2 At least one of the above-mentioned boundary endpoint map and the first panoramic map Figure 2 At least one of the above-mentioned current captured image is compared with the above-mentioned current captured image to determine whether the target motor is at the motor boundary.
[0057] 102. Perform image comparison processing on the current captured image and a preset reference image to obtain an image comparison result.
[0058] In the embodiment of the present invention, it should be noted that the preset reference image may include the boundary endpoint image and the first panoramic image. Figure 2 Therefore, during the image comparison process, the current captured image can be adaptively compared with the boundary endpoint map, and the current captured image can be compared with the first panoramic map.
[0059] Specifically, when the above-mentioned preset reference image only includes the above-mentioned boundary endpoint map, the first feature point in the currently captured image can be determined according to the pixel values of each pixel point in the above-mentioned currently captured image, and the corresponding first reference point can be determined in the boundary endpoint map according to the image coordinates of the above-mentioned first feature point, and the pixel value of the above-mentioned first feature point is compared with the pixel value of the above-mentioned first reference point to obtain the above-mentioned image comparison result.
[0060] When the above-mentioned preset reference image only includes the above-mentioned first panoramic image, a sequence of captured images of the above-mentioned target motor when executing the above-mentioned rotation instruction can be obtained, and the above-mentioned current captured image is used as the stitching starting point for stitching together with the captured image sequence to obtain a third panoramic image. Similarly, the second feature point in the third panoramic image can be determined based on the pixel value of each pixel point in the third panoramic image, and the pixel value of the above-mentioned second feature point can be compared with the pixel value of the above-mentioned second reference point to obtain the above-mentioned image comparison result.
[0061] Alternatively, when the preset reference image includes both the first panoramic image and the boundary endpoint image, image comparison processing can be performed on the first panoramic image and the boundary endpoint image respectively to obtain a first image comparison result corresponding to the boundary endpoint image and a second image comparison result corresponding to the first panoramic image. When the first image comparison result is the same as the second image comparison result (i.e., both are successfully compared or both are failed), the first image or the second image comparison result can be used as the above image comparison result. When the first image comparison result is different from the second image comparison result, it means that there is an error in the boundary endpoint image or the first panoramic image. At this time, a prompt message can be sent to the user of the target motor, prompting the user to update the boundary endpoint image and the first panoramic image.
[0062] 103. Based on the image comparison result, determine whether the target motor is at the motor boundary.
[0063] In the embodiment of the present invention, when the image comparison result is a successful comparison, the target motor is at the motor boundary. When the image comparison result is a failed comparison, it can be determined that the target motor may be abnormal, and the abnormal position where the motor is stuck can be further confirmed, and the position information of the motor abnormality can be notified to the user.
[0064] In an embodiment of the present invention, before the target motor executes a rotation instruction, the current captured image and a preset reference image of the target motor are obtained; based on the current captured image, an image comparison process is performed with the preset reference image to obtain an image comparison result; based on the image comparison result, it is determined whether the target motor is at the motor boundary. By performing an image comparison process with the preset reference image based on the current captured image to obtain an image comparison result, even if the motor is manually disturbed or moved, it will not affect the acquisition screen of the current captured image, thereby ensuring the accuracy of the image comparison result, and only by acquiring the current captured image to achieve boundary detection, the motor does not need to perform the maximum number of steps of rotation, which can effectively improve the efficiency of boundary detection.
[0065] It can be understood that in the specific implementation of the present application, related data such as the current captured image, the preset reference image, the panoramic image, etc. are involved. When the embodiments in the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data and the construction, training and use of related models need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0066] It should be noted that the motor boundary detection method provided in the embodiment of the present invention can be applied to devices such as computers and servers that can perform motor boundary detection.
[0067] Optionally, in the step of acquiring a preset reference image, the target motor may be controlled to each boundary endpoint, and during the control process, a first captured image sequence of the target motor may be acquired; and in the first captured image sequence, a boundary endpoint map may be extracted.
[0068] In an embodiment of the present invention, the preset reference map may include a boundary endpoint map corresponding to each boundary endpoint of the target motor. Specifically, the target motor may store endpoint values of different endpoints, and rotate the motor to each endpoint value. A first captured image sequence of the target motor is acquired during the control process. According to the moment when the target motor rotates to the endpoint value, an image frame at the same moment is extracted from the first captured image sequence as the boundary endpoint map corresponding to the endpoint value.
[0069] It should be noted that, assuming that the target motor has a first boundary endpoint and a second boundary endpoint, when rotating from the first boundary endpoint to the second boundary endpoint, the image sequence during the rotation from the first boundary endpoint to the second boundary endpoint can be extracted from the first captured image sequence, and the image sequence can be stitched (i.e., panoramic stitching) to obtain a fourth panoramic image between the first boundary endpoint and the second boundary endpoint. In the above manner, a fourth panoramic image between every two boundary endpoints can be obtained. Specifically, the boundary endpoint image can be extracted from the first captured image sequence or directly extracted from the fourth panoramic image.
[0070] Optionally, in the step of performing image comparison processing based on the current captured image and a preset reference image to obtain an image comparison result, a target boundary endpoint map can also be determined from multiple boundary endpoint maps based on a rotation instruction; the current captured image and the target boundary endpoint map are grayscaled to obtain a first grayscale image corresponding to the current captured image and a second grayscale image corresponding to the target boundary endpoint map; the first grayscale image is divided into multiple first areas to be compared, and the pixel difference of each first area to be compared is calculated; based on the pixel difference, a first feature point is determined in each first area to be compared; based on the image coordinates of the first feature point in the first grayscale image, a first reference point with the same image coordinates is determined in the second grayscale image; pixel value comparison processing is performed on the first feature point in each first area to be compared with the corresponding first reference point to obtain an image comparison result.
[0071] In an embodiment of the present invention, the above-mentioned rotation instruction may include parameters such as rotation speed and rotation direction, among which the current captured image frame can be used as a reference, and a boundary endpoint map with a direction corresponding to the current captured image frame can be determined from multiple boundary endpoint maps according to the above-mentioned rotation direction as the above-mentioned target boundary endpoint map.
[0072] To eliminate the influence of lighting, if the image is shot differently under different lighting conditions, the target boundary endpoint map and the current shot image can be grayed out. Specifically, the graying process can be to convert the RGB value of the image into a gray value. The gray conversion can be further described by the following gray conversion formula:
[0073] Gray=0.299×R+0.587×G+0.114×B
[0074] Among them, Gray represents the color of any pixel in the image, R represents the red channel value of any pixel, G represents the green channel value of any pixel, and B represents the blue channel value of any pixel. Through the above grayscale conversion formula, the RGB value of the pixel in the image can be converted to the grayscale value. After the RGB values of all pixels in the image are converted to the above grayscale values, the above grayscale processing is completed. The above first grayscale image and the above second grayscale image can be obtained.
[0075] After completing the above-mentioned grayscale processing, the above-mentioned first grayscale image can be divided into multiple first areas to be compared. The above-mentioned division can be an equal-proportion division, and the specific division granularity can be set according to the resolution of the above-mentioned first grayscale image. When the above-mentioned resolution is larger, the division granularity can also be set accordingly. Larger, when the above-mentioned resolution is smaller, the division granularity can also be set accordingly. Smaller.
[0076] The pixel difference may be the difference between the pixel value of each pixel in the first grayscale image and the average pixel value of all pixels in the image. Further, in a preferred embodiment, after the first grayscale image is divided into a plurality of first regions to be compared, the pixel difference may be the difference between each pixel in a single first region to be compared and the average pixel value of all pixels in the image of the first region to be compared. According to the pixel difference, the first feature point is determined in each first region to be compared. For example, the nth first region to be compared includes n∈{1, 2, ..., L}, where 1, 2, L are the first first feature point, the second first feature point and the Lth first feature point. The first feature points in each first region to be compared may be sorted according to the difference between the pixel value of each first feature point and the corresponding average pixel value to obtain a sorted set of first feature points. The larger the difference, the higher the ranking in the sorted set of first feature points (or the higher the level), and the first feature point with the highest level (i.e., the largest difference between the pixel value and the average pixel value) is used as the first feature point for the first comparison.
[0077] It should be noted that the above-mentioned feature points usually refer to points where the grayscale value in the image changes dramatically or points with large curvature on the edge of the image. The pixels of the feature points actually involve a key concept in image processing, that is, the specific position of the feature point in the image, which is usually expressed in pixels. The feature point contains multiple pixels, because in actual image processing and computer vision tasks, the feature point is not a "point" in the strict sense, but an entity with a certain spatial range or influence area. This area or range is usually composed of pixels around the feature point, which have similar properties or characteristics to the feature point itself to some extent.
[0078] Therefore, the starting coordinates (x, y) of the first feature point of the first comparison in I_cutt (i.e., the first grayscale image) can be recorded, the first reference point with the same image coordinates can be determined in the boundary endpoint map, and the pixel values can be extracted at (x, y) for comparison. If the pixel values are consistent, the pixel values of the next image coordinates of the feature point can be compared until a complete feature point comparison is completed. As long as there is a feature point match in a certain first area to be compared, the comparison of the area is stopped, and the next area is compared until all areas are compared.
[0079] If all the first feature points in a first area to be compared fail to be compared, switch to the next first area to be compared and continue the comparison until all the first areas to be compared are compared. Through the above steps, a comparison effect from shallow to deep is achieved, and there is no need to compare all the pixel points in all areas every time, thereby improving the comparison efficiency.
[0080] More specifically, the above-mentioned feature points can be determined in a small area. When the pixel difference value is large (greater than the pixel difference value threshold), and the number of pixels that meet the adjacent distance requirements reaches a certain number (specifically, they can be sorted from small to large according to the pixel value difference to confirm that the distance requirements are met, or understood as the number of pixels that meet the association requirements), the above-mentioned small area can be determined as a feature point, which is a valid feature point.
[0081] Alternatively, in each area, determine the pixel points that exceed the average pixel value of the area. For example, a threshold value L can be set, where |L|>P, P represents the average pixel value of the current area, and the number of pixels that meet the conditions in the above formula can be calculated. The more pixel points that meet the conditions in a certain area, the higher the level of the area, and these pixel points that meet the conditions at the same time constitute the corresponding feature points. It should be noted that |L|>P, and the absolute value should be taken here. After passing the above area level, the comparison order can be determined according to the above area level, that is, the area to be compared with a high area level (that is, the first area to be compared or the second area to be compared) is preferentially extracted for comparison, which can further enhance the contrast effect from shallow to deep.
[0082] Furthermore, the threshold L can be understood as how large the pixel difference should be. For example, the average pixel value of an area is 150, where the pixel value range is 0-255. Assuming L is set to 50, only the pixel points in the two intervals of 0-100 and 200-255 will be included in the valid pixel values, because the difference between the pixel value in this pixel value interval and P exceeds L, that is, exceeds 50. The threshold L is still the difference between adjacent pixels in a feature point. Therefore, when the pixel values of the pixels in a small range are all in the above two intervals, the above small range can be determined as a feature point.
[0083] Optionally, in the step of obtaining a preset reference image, the target motor can also be controlled to rotate to all rotation limit positions, and a second captured image sequence of the target motor during the rotation process can be obtained; the captured images in the second captured image sequence are stitched to obtain a second panoramic image corresponding to the target motor; the above steps are repeated to obtain a preset number of second panoramic images, until the pixel value similarity between the preset number of second panoramic images is higher than a preset similarity threshold, the repetition is stopped, and any one of the preset number of second panoramic images is used as the first panoramic image.
[0084] In an embodiment of the present invention, the preset reference image may further include a first panoramic image corresponding to the target motor. The target motor corresponds to at least one rotation limit position, and the target motor may be rotated to all rotation limit positions and remain stationary at each position. That is, when the target motor drives the camera to rotate to the limit position, a panoramic image of the motor movement direction is generated.
[0085] For example, the captured images can be stitched panoramically (multi-frame stitching) using SIFT or SURF algorithms to generate panoramic images (which can be named according to the actual direction) of the device (i.e., the image capturing device with the target motor) at the end point of the direction.
[0086] Repeat the above steps until the comparison results of the second panoramic images obtained for multiple consecutive times (i.e., a preset number of second panoramic images obtained consecutively) are consistent (through pixel point comparison, the similarity of pixel values corresponding to all pixel points is higher than the set threshold), it can be determined as a valid image (i.e., the second panoramic image that meets the above conditions is determined as a valid image). The above valid image can be understood as the above first panoramic image.
[0087] Of course, the embodiment of the present invention may also have multiple motors (i.e., the above-mentioned target motors may be multiple). The number of motors on the device may be confirmed first. If there are N motors on the device, they are marked as motor 1, motor 2, ... motor N. (For example, the motor may rotate left and right, up and down, etc.). After the direction of movement of motor 1 has generated a valid panoramic image (i.e., the first panoramic image corresponding to motor 1), motor 2 is driven to drive the camera to rotate to the extreme position and generate a panoramic image of the direction of movement of motor 2 and perform effective judgment to obtain the first panoramic image corresponding to motor 2, and so on, to generate a series of first panoramic images.
[0088] Optionally, the first panoramic image corresponds to a panoramic expansion direction. In the step of performing image comparison processing based on the current captured image and a preset reference image to obtain an image comparison result, a third captured image sequence of the target motor in the process of executing a rotation instruction can also be obtained; the current captured image is used as a stitching starting point and is stitched with the captured images in the third captured image sequence to obtain a third panoramic image; the third panoramic image and the first panoramic image are grayscaled to obtain a third grayscale image corresponding to the third panoramic image and a fourth grayscale image corresponding to the first panoramic image; the third grayscale image is divided into a plurality of second areas to be compared, and the pixel difference of each second area to be compared is calculated; based on the pixel difference, a second feature point is determined in each second area to be compared; based on the image coordinates of the second feature point in the third grayscale image and the panoramic expansion direction of the first panoramic image, a second reference point set corresponding to each second area to be compared is determined in the fourth grayscale image; according to the ranking of the second reference point corresponding to each second area to be compared in the second reference point set, the second reference points are extracted one by one and pixel value comparison processing is performed with the second feature point to obtain an image comparison result.
[0089] In an embodiment of the present invention, the above-mentioned first panoramic image corresponds to a panoramic expansion direction, and the above-mentioned panoramic expansion direction may include horizontal and vertical. When the above-mentioned first panoramic image is a panoramic image with a horizontal visual range, the above-mentioned panoramic expansion direction is horizontal, and when the above-mentioned first panoramic image is a panoramic image with a vertical visual range, the above-mentioned panoramic expansion direction is vertical.
[0090] When the target motor executes the rotation instruction, the image capturing device disposed on the target motor can continuously capture the third captured image sequence in the process, and use the current captured image as the stitching starting point to perform stitching processing with the captured images in the third captured image sequence to obtain the third panoramic image. The stitching processing can also be achieved by performing panoramic stitching using SIFT or SURF algorithms.
[0091] It should be noted that the third panorama is different from the first and second panorama in that the third panorama is a mosaic of multiple frames (including two or more frames) relative to the current captured image, and the mosaic will be updated as the current captured image is updated. The first and second panorama are mosaics of all frames at any two rotation limits.
[0092] In addition, the third captured image sequence can be understood as: all image sequences obtained by the target motor in the same moving direction in the same driving cycle before acquiring the current captured image, based on which all images can be sequentially spliced. In one embodiment, a historical splicing image relative to the current captured image can be formed based on the third captured image sequence, or a third panoramic image of the previous moment (i.e., before the current captured image is spliced), and then the historical splicing image is further spliced with the current captured image as the splicing starting point to form a new third panoramic image. In other embodiments, multiple frames of images can also be spliced in real time directly based on the current captured image and all the aforementioned images, and based on the determined splicing starting point (current captured image) and the third captured image sequence.
[0093] Similarly, in order to eliminate the influence of lighting, the grayscale conversion formula can also be used to realize the grayscale processing of the above-mentioned first panoramic image and the above-mentioned third panoramic image. The above-mentioned grayscale processing is consistent with the grayscale processing of the above-mentioned target boundary endpoint map and the current captured image, and the effect is the same. In order to avoid repetition and redundancy, it will not be repeated here.
[0094] Similarly, after completing the above-mentioned grayscale processing, the above-mentioned third grayscale image can be divided into multiple second areas to be compared. The above-mentioned division can be an equal-proportional division, and the specific division granularity can be set according to the resolution of the above-mentioned third grayscale image. When the above-mentioned resolution is larger, the division granularity can also be set to be larger accordingly, and when the above-mentioned resolution is smaller, the division granularity can also be set to be smaller accordingly.
[0095] According to the pixel difference, the second feature point is determined in each second area to be compared. For example, the nth second area to be compared includes n∈{1, 2, ..., L}, where 1, 2, L are the first second feature point, the second second feature point and the Lth second feature point. The average pixel value of all pixels in each second area to be compared can be calculated, and the second feature points in each second area to be compared can be sorted according to the difference between each second feature point and the corresponding average pixel value to obtain a sorted set of second feature points, and the second feature point with the highest level (i.e., the difference between the pixel value and the average pixel value is the largest) is used as the second feature point for the first comparison.
[0096] Specifically, when the panoramic expansion direction is horizontal (or understood as horizontal), the pixel point at the (x, y) position of I_cutt (i.e., the third grayscale image) can be compared starting from the (0, y) position in the fourth grayscale image (i.e., the image position of the second feature point in the third grayscale image). The pixel values of the two pixels are extracted and compared to see if they are consistent. If the pixel values are consistent, the pixel positions to be compared in the two images are offset by 1 unit toward the direction of the second feature point according to the distribution direction of the second feature point, and the next pixel point is compared until a complete second feature point comparison is completed. If they are inconsistent, only the x coordinate of the panoramic image is offset by one unit to continue the comparison. Or it can be understood that when the panoramic expansion direction is horizontal, the reference point is (0, y), and the second reference points in the second reference point set are sorted according to the image distance from the (0, y) position. For example, assuming that the reference point is (0, y), the second reference points may include (1, y), (2, y), (3, y), ..., (x, y) in order of ranking. When comparing, the second reference points may be directly extracted one by one from the second reference point set in order of ranking for comparison with the second feature points.
[0097] It should be noted that, in one embodiment, when the panorama is expanded in the horizontal direction, the comparison starts from the position (0, y), and also includes: keeping y fixed and increasing x from 0, which is equivalent to a "sliding" comparison to see where the image is in the panorama. (In the previous endpoint comparison, the sizes of the two compared images are the same, so this sliding comparison does not need to be used).
[0098] When the above panoramic expansion direction is vertical (or understood as vertical), start from the (x, 0) position of the panorama and compare it with the pixel point at the (x, y) position of I_cutt. Extract the pixel values of the two positions and compare whether they are consistent. If the pixel values are consistent, according to the distribution direction of the second feature point, the pixel point positions to be compared in the two pictures are offset by 1 unit towards the direction of the second feature point, and continue to compare the next pixel point until a complete second feature point comparison is completed. If they are inconsistent, only the y coordinate of the panorama is offset by one unit to continue the comparison. Or it can be understood that when the panoramic expansion direction is vertical, the reference point is (x, 0), and the second reference points in the second reference point set are sorted according to the image distance from the (x, 0) position. For example, assuming that the reference point is (x, 0), the second reference points may include (x, 1), (x, 2), (x, 3), ..., (x, y) in order of ranking. When comparing, the second reference points can be directly extracted one by one from the second reference point set in order of ranking for comparison with the second feature points.
[0099] It should be noted here that, in one embodiment, when the panoramic expansion direction is vertical, the comparison is started according to the position (x, 0), and also includes: keeping x fixed and increasing y from 0, which is also equivalent to a "sliding" comparison.
[0100] If the x or y coordinate reaches the maximum value and no matching second feature point is found in the panorama, the comparison is switched to the next second feature point until all second feature points are matched.
[0101] As long as a second feature point in a certain area is successfully matched, the comparison of this area is stopped and the next area is compared (the next area of the panorama is relative to the previous comparison area), until all areas of I_cutt (i.e., the third grayscale image) are compared. Through the above steps, the comparison effect from shallow to deep is achieved without comparing all area pixels every time.
[0102] Optionally, in the step of determining whether the target motor is at the motor boundary based on the image comparison result, when the image comparison result is a successful comparison, the target motor is at the motor boundary; when the image comparison result is a failed comparison, the abnormal position of the target motor is determined, and the abnormal position is fed back to the user of the target motor to receive the user's judgment prompt, and based on the judgment prompt, determine whether to update a preset number of reference images and determine whether the target motor is at the motor boundary based on the updated reference images; when the image comparison result is a preset scene, abnormal installation scene information is fed back to the user.
[0103] In the embodiment of the present invention, if the continuously captured images do not change significantly during the rotation of the target motor (indicating that no further rotation occurs in the same direction) and the image comparison result is a successful comparison, it means that the boundary position has been reached in this direction, that is, it is at the motor boundary;
[0104] If the continuously captured images do not change significantly during the rotation of the target motor and the image comparison result is a comparison failure, the abnormal position of the target motor can be determined and the abnormal position can be fed back to the user of the target motor. A pop-up window will prompt the user that the target motor is abnormal. Two options can be provided to the user (i.e., normal motor, abnormal motor). If the user checks the normal motor, the preset baseline image will be updated. If the user selects the abnormal motor, the motor status will be checked regularly and this action will be repeated (for example, the machine may have been rotated, resulting in a failure in the image comparison).
[0105] Specifically, the abnormal position of the target motor can be determined by the following method:
[0106] Method (A) can identify the current abnormal position (i.e., the rotational boundary position) based on the coverage area / overlapping area of the abnormal position mosaic (i.e., the third panoramic image or the third grayscale image) in the panoramic image. Based on the boundary position, the current patrollable area and the non-patrollable area can also be known.
[0107] Method (B): the target motor first returns to the initialization, then moves to the abnormal position (reaching the same position as its image before initialization), and counts the corresponding steps. According to the preset maximum number of steps of the target motor, the abnormal position of the target motor is calculated.
[0108] More specifically, after determining the abnormal position, the abnormal position information of the target motor is notified to the user, a pop-up window prompts the user that the motor is abnormal, and the currently acquired abnormal position information is sent to the user, and several options can be provided to the user (motor normal, motor abnormal, motor stopped);
[0109] Furthermore, based on the current abnormal position of the target motor, a fifth panoramic view that is currently visible is obtained, and the fifth panoramic view that is currently visible together with the aforementioned motor abnormality information is sent to the user in a pop-up window for reference.
[0110] If the preset reference image includes the first panoramic image, and the user has checked that the motor is normal, then the status of the first panoramic image is updated (the current fifth panoramic image is obtained, and the currently visible fifth panoramic image is used as the panoramic image of the rotation position of the camera motor. Among them, if the preset reference image only includes the boundary endpoint image, the current two endpoint frame images can also be marked from the fifth panoramic image, and the new endpoint frames can be used as the comparison basis for left and right switching).
[0111] The above-mentioned preset scene can be a single scene of a solid color or a "wall", so when the image comparison result is a preset scene, abnormal installation scene information is fed back to the user.
[0112] It should be noted that if the user selects motor abnormality, the motor status will be checked regularly and this action will be repeated. In the aforementioned [Method (B)], the number of steps can be used to confirm whether it is consistent with the standard number of steps stored initially. If they are consistent, the machine (i.e., the image capture device with adjustable shooting angle corresponding to the target motor) can also simultaneously make a self-judgment: whether there is a fault, or the machine has moved but is not a fault.
[0113] However, it is understandable that as the motor wears out, there will be errors in the number of steps. Therefore, when the wear accumulates to a certain extent or there are other interference factors, it may be judged that the number of steps is different and the product is considered abnormal. At this time, you can still switch to this solution and send the situation to the user, allowing the user to confirm the current status independently.
[0114] Optionally, after determining whether the target motor is at the motor boundary based on the image comparison result, the boundary position of the target motor can be marked in a preset reference image after determining that the target motor is at the motor boundary; adjacent image frames of the boundary position are acquired; during the subsequent rotation of the target motor, determining whether the target motor is adjacent to the boundary position based on adjacent image frames; if adjacent to the boundary position, controlling the target motor to perform deceleration processing.
[0115] In the embodiment of the present invention, since the preset reference image may include a boundary endpoint image and a first panoramic image Figure 2 Therefore, the corresponding method for determining whether the target motor is adjacent to the boundary position in the subsequent process may also be different in specific details, and may specifically include the following methods:
[0116] Method 1: If the above-mentioned preset reference image includes the above-mentioned boundary endpoint image, then a frame atlas set near the boundary endpoint (i.e., the set of adjacent image frames) can be obtained first, and the shapes / lines of certain contents in the adjacent image frames can be specially marked. By comparing the current captured image with the frame atlas set near the boundary endpoint and identifying whether those marks appear, it can be determined whether the current camera rotation is close to the boundary in that direction, so as to perform early deceleration.
[0117] When the machine determines that "an abnormal position exists" and the user clicks "Motor is normal" to execute, after the panoramic image is updated, the shapes / lines of certain contents in the frame image / image specially marked above must also be updated synchronously.
[0118] Method 2: If the above-mentioned preset reference image includes the above-mentioned first panoramic image, special marks are made on the shapes / lines of certain contents in the frame image / image (i.e. the above-mentioned adjacent image frames) close to the boundary position of the motor in the first panoramic image, and by comparing the current captured image with the first panoramic image, it is identified whether these marks appear to identify whether it is close to the boundary position, so as to perform early deceleration.
[0119] If the preset reference image includes both the first panoramic image and the boundary endpoint image, then by executing either method 1 or method 2, it is possible to determine whether the target motor is adjacent to the boundary position during the subsequent rotation of the motor.
[0120] like Figure 2 As shown, the embodiment of the present invention also provides a flowchart of another motor boundary detection method, which includes:
[0121] The first step is to obtain panoramic images (i.e., the first panoramic image mentioned above) of different directions of the terminal device (i.e., an image capturing device equipped with the target motor, which can capture images at different angles);
[0122] The second step is to obtain the motor state of the terminal device, which can be specifically understood as obtaining the above-mentioned rotation instruction. Since the motion state of the motor's rotational motion is related to the above-mentioned rotation instruction, after determining the rotation instruction, the above-mentioned motor state can be determined by the rotation instruction;
[0123] The third step is image comparison, that is, comparing the current captured image with the preset reference image;
[0124] The fourth step is abnormality detection and prompting, that is, judging whether it is at the motor boundary based on the image comparison result. If it is at the motor boundary, the user can be notified. If the comparison fails, the preset reference map can be updated by receiving user feedback information, and judging whether it is at the motor boundary based on the updated reference map;
[0125] The fifth step is status update, that is, after receiving the user feedback information, updating the above preset reference map according to the user feedback information.
[0126] It can be understood that, through any one of the motor boundary detection methods provided by the embodiments of the present invention, it is possible to accurately determine whether an image belongs to a panoramic image without being interfered by ambient lighting and unnecessary objects, and to achieve efficient motor status monitoring and anomaly detection.
[0127] Specifically, the motor boundary detection method provided by the embodiment of the present invention has the following advantages:
[0128] High-precision detection: Through real-time image capture and comparison, the system can accurately determine whether the motor has reached the boundary position, avoiding misjudgment caused by manual interference that may occur in traditional methods.
[0129] Reduce unnecessary operations: After confirming that the motor has reached the boundary position, the system automatically stops rotating, avoiding unnecessary maximum step rotation operations, thereby improving operating efficiency.
[0130] Reduce equipment wear and energy consumption: Due to the reduction of unnecessary rotation movements, equipment wear and energy consumption are significantly reduced, extending the service life of the motor and reducing maintenance costs.
[0131] like Figure 3 As shown, an embodiment of the present invention further provides a motor boundary detection device, comprising:
[0132] An acquisition module 301 is used to acquire a current captured image of the target motor and a preset reference image before the target motor executes a rotation instruction;
[0133] A comparison module 302 is used to perform image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result;
[0134] The judgment module 303 is used to judge whether the target motor is at the motor boundary based on the image comparison result.
[0135] Optionally, the preset reference map includes a boundary endpoint map corresponding to each boundary endpoint of the target motor, and the acquisition module 301 includes:
[0136] A first control submodule is used to control the target motor to each of the boundary endpoints, and in the control process, obtain a first captured image sequence of the target motor;
[0137] The first extraction submodule is used to extract the boundary endpoint map from the first captured image sequence.
[0138] Optionally, the comparison module 302 includes:
[0139] A first determination submodule, configured to determine a target boundary endpoint graph from among the plurality of boundary endpoint graphs based on the rotation instruction;
[0140] A first grayscale submodule, configured to grayscale the current captured image and the target boundary endpoint map to obtain a first grayscale image corresponding to the current captured image and a second grayscale image corresponding to the target boundary endpoint map;
[0141] A first calculation submodule, used for dividing the first grayscale image into a plurality of first regions to be compared, and calculating a pixel difference value of each of the first regions to be compared;
[0142] A second determining submodule, configured to determine a first feature point in each of the first to-be-compared areas based on the pixel difference;
[0143] A third determination submodule, configured to determine, in the second grayscale image, a first reference point having the same image coordinates based on the image coordinates of the first feature point in the first grayscale image;
[0144] The first comparison submodule is used to perform pixel value comparison processing on the first feature point in each of the first to-be-compared areas and the corresponding first reference point to obtain the image comparison result.
[0145] Optionally, the preset reference image includes a first panoramic image corresponding to the target motor, the target motor corresponds to at least one rotation limit position, and the acquisition module 301 further includes:
[0146] A second control submodule, used for controlling the target motor to rotate to all the rotation limit positions, and acquiring a second captured image sequence of the target motor during the rotation process;
[0147] A first stitching submodule, configured to stitch the captured images in the second captured image sequence to obtain a second panoramic image corresponding to the target motor;
[0148] The first repetition submodule is used to repeat the above steps to obtain a preset number of second panoramic images, until the pixel value similarity between the preset number of second panoramic images is higher than a preset similarity threshold, stop the repetition, and use any one of the preset number of second panoramic images as the first panoramic image.
[0149] Optionally, the first panoramic image corresponds to a panoramic expansion direction, and the comparison module 302 further includes:
[0150] A first acquisition submodule, used for acquiring a third captured image sequence of the target motor in the process of executing the rotation instruction;
[0151] A second stitching submodule is used to stitch the current captured image with the captured images in the third captured image sequence using the current captured image as a stitching starting point to obtain a third panoramic image;
[0152] A second grayscale submodule, configured to grayscale the third panoramic image and the first panoramic image to obtain a third grayscale image corresponding to the third panoramic image and a fourth grayscale image corresponding to the first panoramic image;
[0153] A second calculation submodule, used for dividing the third grayscale image into a plurality of second regions to be compared, and calculating a pixel difference value of each of the second regions to be compared;
[0154] A fourth determination submodule, configured to determine a second feature point in each of the second to-be-compared areas based on the pixel difference;
[0155] a fifth determination submodule, configured to determine, in the fourth grayscale image, a second reference point set corresponding to each second area to be compared based on the image coordinates of the second feature point in the third grayscale image and the panoramic expansion direction of the first panoramic image, wherein the second reference point set includes at least one second reference point sorted according to the image distance between the second reference point and the reference point in the fourth grayscale image, and the reference point is determined according to the panoramic expansion direction of the first panoramic image;
[0156] The second comparison submodule is used to extract the second reference points one by one according to the ranking of the second reference points corresponding to each second comparison area in the second reference point set, and perform pixel value comparison processing with the second feature points to obtain the image comparison result.
[0157] Optionally, the judging module 303 includes:
[0158] A first processing submodule, configured to, when the image comparison result is successful, indicate that the target motor is at a motor boundary;
[0159] a sixth determination submodule, configured to determine an abnormal position of the target motor when the image comparison result is a comparison failure, and feed back the abnormal position to a user of the target motor to receive a judgment prompt from the user, determine whether to update the reference map based on the judgment prompt, and determine whether the target motor is at a motor boundary based on the updated reference map;
[0160] The feedback submodule is used to feedback installation scene abnormality information to the user when the image comparison result is a preset scene.
[0161] Optionally, the motor boundary detection device further includes:
[0162] A marking module, for marking a boundary position of the target motor in the preset reference map after determining that the target motor is at the motor boundary;
[0163] A second acquisition module, used to acquire adjacent image frames at the boundary position;
[0164] A second judgment module is used to judge whether the target motor is adjacent to the boundary position based on the adjacent image frames during the subsequent rotation of the target motor;
[0165] The control module is used to control the target motor to perform a deceleration process if the target motor is close to the boundary position.
[0166] like Figure 4 As shown, an embodiment of the present invention further provides an electronic device, characterized in that it includes a processor, and the processor can execute any one of the above-mentioned motor boundary detection methods.
[0167] Specifically, it includes a processor 401 and a memory 402, and a computer program for executing the motor boundary detection method stored in the memory 402 and capable of running on the processor 401, wherein:
[0168] The processor 401 runs the computer program of the motor boundary detection method stored in the memory 402 to perform the following steps:
[0169] Before the target motor executes a rotation instruction, obtaining a current captured image of the target motor and a preset reference image;
[0170] Based on the current captured image, an image comparison process is performed with the preset reference image to obtain an image comparison result;
[0171] Based on the image comparison result, it is determined whether the target motor is located at a motor boundary.
[0172] Optionally, the preset reference map includes a boundary endpoint map corresponding to each boundary endpoint of the target motor, and the processor 401 executes the step of obtaining the preset reference map, including:
[0173] Controlling the target motor to each of the boundary endpoints, and acquiring a first captured image sequence of the target motor during the control process;
[0174] The boundary endpoint map is extracted from the first captured image sequence.
[0175] Optionally, the processor 401 performs image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result, including:
[0176] Based on the rotation instruction, determining a target boundary endpoint map from the plurality of boundary endpoint maps;
[0177] Gray-scale the current captured image and the target boundary endpoint map to obtain a first gray-scale image corresponding to the current captured image and a second gray-scale image corresponding to the target boundary endpoint map;
[0178] Dividing the first grayscale image into a plurality of first regions to be compared, and calculating a pixel difference value of each of the first regions to be compared;
[0179] Based on the pixel difference, determining a first feature point in each of the first to-be-compared areas;
[0180] Based on the image coordinates of the first feature point in the first grayscale image, determining a first reference point having the same image coordinates in the second grayscale image;
[0181] A pixel value comparison process is performed on the first feature point in each of the first to-be-compared areas and the corresponding first reference point to obtain the image comparison result.
[0182] Optionally, the preset reference image includes a first panoramic image corresponding to the target motor, the target motor corresponds to at least one rotation limit position, and the acquisition of the preset reference image executed by the processor 401 further includes:
[0183] Controlling the target motor to rotate to all the rotation limit positions, and acquiring a second captured image sequence of the target motor during the rotation process;
[0184] splicing the captured images in the second captured image sequence to obtain a second panoramic image corresponding to the target motor;
[0185] Repeat the above steps to obtain a preset number of second panoramic images, until the pixel value similarity between the preset number of second panoramic images is higher than a preset similarity threshold, stop repeating, and use any one of the preset number of second panoramic images as the first panoramic image.
[0186] Optionally, the first panoramic image corresponds to a panoramic expansion direction, and the processor 401 performs image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result, further comprising:
[0187] Acquire a third captured image sequence of the target motor during the process of executing the rotation instruction;
[0188] Taking the current captured image as a stitching starting point, and performing stitching processing with the captured images in the third captured image sequence, to obtain a third panoramic image;
[0189] grayscale the third panoramic image and the first panoramic image to obtain a third grayscale image corresponding to the third panoramic image and a fourth grayscale image corresponding to the first panoramic image;
[0190] Dividing the third grayscale image into a plurality of second regions to be compared, and calculating a pixel difference value of each of the second regions to be compared;
[0191] Based on the pixel difference, determining a second feature point in each of the second to-be-compared areas;
[0192] Based on the image coordinates of the second feature point in the third grayscale image and the panoramic expansion direction of the first panoramic image, determining a second reference point set corresponding to each second to-be-compared area in the fourth grayscale image, the second reference point set including at least one second reference point sorted according to the image distance between the second reference point and the reference point in the fourth grayscale image, and the reference point is determined according to the panoramic expansion direction of the first panoramic image;
[0193] According to the ranking of the second reference point corresponding to each second area to be compared in the second reference point set, the second reference points are extracted one by one and pixel value comparison processing is performed with the second feature points to obtain the image comparison result.
[0194] Optionally, the processor 401 performs the step of determining whether the target motor is at a motor boundary based on the image comparison result, including:
[0195] When the image comparison result is a successful comparison, the target motor is at a motor boundary;
[0196] When the image comparison result is a comparison failure, determining an abnormal position of the target motor, and feeding back the abnormal position to a user of the target motor to receive a judgment prompt from the user, and determining whether to update the reference map based on the judgment prompt and determining whether the target motor is at a motor boundary based on the updated reference map;
[0197] When the image comparison result is a preset scene, abnormal installation scene information is fed back to the user.
[0198] Optionally, after determining whether the target motor is located at a motor boundary based on the image comparison result, the method executed by the processor 401 further includes:
[0199] When it is determined that the target motor is at the motor boundary, marking the boundary position of the target motor in the preset reference map;
[0200] Acquire adjacent image frames at the boundary position;
[0201] In a subsequent rotation process of the target motor, judging whether the target motor is adjacent to the boundary position based on the adjacent image frames;
[0202] If the target motor is close to the boundary position, the target motor is controlled to perform a deceleration process.
[0203] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the motor boundary detection method or the application-end motor boundary detection method provided in the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0204] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0205] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A motor boundary detection method, characterized in that: The method comprises the following steps: Before the target motor executes a rotation instruction, obtaining a current captured image of the target motor and a preset reference image; Based on the current captured image, an image comparison process is performed with the preset reference image to obtain an image comparison result; Based on the image comparison result, it is determined whether the target motor is located at a motor boundary.
2. The motor boundary detection method according to claim 1, characterized in that: The preset reference map includes a boundary endpoint map corresponding to each boundary endpoint of the target motor, and the step of obtaining the preset reference map includes: Controlling the target motor to each of the boundary endpoints, and acquiring a first captured image sequence of the target motor during the control process; The boundary endpoint map is extracted from the first captured image sequence.
3. The motor boundary detection method according to claim 2, characterized in that: The performing image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result includes: Based on the rotation instruction, determining a target boundary endpoint map from the plurality of boundary endpoint maps; Gray-scale the current captured image and the target boundary endpoint map to obtain a first gray-scale image corresponding to the current captured image and a second gray-scale image corresponding to the target boundary endpoint map; Dividing the first grayscale image into a plurality of first regions to be compared, and calculating a pixel difference value of each of the first regions to be compared; Based on the pixel difference, determining a first feature point in each of the first to-be-compared areas; Based on the image coordinates of the first feature point in the first grayscale image, determining a first reference point having the same image coordinates in the second grayscale image; A pixel value comparison process is performed on the first feature point in each of the first to-be-compared areas and the corresponding first reference point to obtain the image comparison result.
4. The motor boundary detection method according to claim 1, characterized in that: The preset reference image includes a first panoramic image corresponding to the target motor, and the target motor corresponds to at least one rotation limit position. The step of obtaining the preset reference image further includes: Controlling the target motor to rotate to all the rotation limit positions, and acquiring a second captured image sequence of the target motor during the rotation process; splicing the captured images in the second captured image sequence to obtain a second panoramic image corresponding to the target motor; Repeat the above steps to obtain a preset number of second panoramic images, until the pixel value similarity between the preset number of second panoramic images is higher than a preset similarity threshold, stop repeating, and use any one of the preset number of second panoramic images as the first panoramic image.
5. The motor boundary detection method according to claim 4, characterized in that: The first panoramic image corresponds to a panoramic expansion direction, and the image comparison processing is performed based on the current captured image and the preset reference image to obtain an image comparison result, and further includes: Acquire a third captured image sequence of the target motor during the process of executing the rotation instruction; Taking the current captured image as a stitching starting point, and performing stitching processing with the captured images in the third captured image sequence, to obtain a third panoramic image; grayscale the third panoramic image and the first panoramic image to obtain a third grayscale image corresponding to the third panoramic image and a fourth grayscale image corresponding to the first panoramic image; Dividing the third grayscale image into a plurality of second regions to be compared, and calculating a pixel difference value of each of the second regions to be compared; Based on the pixel difference, determining a second feature point in each of the second to-be-compared areas; Based on the image coordinates of the second feature point in the third grayscale image and the panoramic expansion direction of the first panoramic image, determining a second reference point set corresponding to each second to-be-compared area in the fourth grayscale image, the second reference point set including at least one second reference point sorted according to the image distance between the second reference point and the reference point in the fourth grayscale image, and the reference point is determined according to the panoramic expansion direction of the first panoramic image; According to the ranking of the second reference point corresponding to each second area to be compared in the second reference point set, the second reference points are extracted one by one and pixel value comparison processing is performed with the second feature points to obtain the image comparison result.
6. The motor boundary detection method according to any one of claims 1 to 5, characterized in that: The determining, based on the image comparison result, whether the target motor is at a motor boundary includes: When the image comparison result is a successful comparison, the target motor is at a motor boundary; When the image comparison result is a comparison failure, determining an abnormal position of the target motor, and feeding back the abnormal position to a user of the target motor to receive a judgment prompt from the user, and determining whether to update the reference map based on the judgment prompt and determining whether the target motor is at a motor boundary based on the updated reference map; When the image comparison result is a preset scene, abnormal installation scene information is fed back to the user.
7. The motor boundary detection method according to any one of claims 1 to 5, characterized in that: After determining whether the target motor is located at a motor boundary based on the image comparison result, the method further includes: When it is determined that the target motor is at the motor boundary, marking the boundary position of the target motor in the preset reference map; Acquire adjacent image frames at the boundary position; In a subsequent rotation process of the target motor, judging whether the target motor is adjacent to the boundary position based on the adjacent image frames; If the target motor is close to the boundary position, the target motor is controlled to perform a deceleration process.
8. A motor boundary detection device, characterized in that: The motor boundary detection device comprises: An acquisition module, used for acquiring a current captured image of the target motor and a preset reference image before the target motor executes a rotation instruction; A comparison module, used to perform image comparison processing based on the current captured image and the preset reference image to obtain an image comparison result; A judgment module is used to judge whether the target motor is at a motor boundary based on the image comparison result.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the motor boundary detection method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the motor boundary detection method according to any one of claims 1 to 7 are implemented.