WO2019113859A1 - Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device - Google Patents

Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device Download PDF

Info

Publication number
WO2019113859A1
WO2019113859A1 PCT/CN2017/116015 CN2017116015W WO2019113859A1 WO 2019113859 A1 WO2019113859 A1 WO 2019113859A1 CN 2017116015 W CN2017116015 W CN 2017116015W WO 2019113859 A1 WO2019113859 A1 WO 2019113859A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
virtual wall
movable electronic
image
target image
Prior art date
Application number
PCT/CN2017/116015
Other languages
French (fr)
Chinese (zh)
Inventor
李北辰
Original Assignee
广州艾若博机器人科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州艾若博机器人科技有限公司 filed Critical 广州艾若博机器人科技有限公司
Priority to PCT/CN2017/116015 priority Critical patent/WO2019113859A1/en
Priority to CN201780017028.8A priority patent/CN109313822B/en
Publication of WO2019113859A1 publication Critical patent/WO2019113859A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/006Mixed reality

Definitions

  • the invention relates to the field of real-time positioning and map construction, in particular to a virtual wall construction method and device based on machine vision, a map construction method and a movable electronic device.
  • the mobile device uses the sensors carried by itself to identify feature marks (such as RFID tags and color block tags) in the unknown environment, and then recognizes the accessible area and the forbidden entry area according to the information carried on the feature mark. Thereby, the mobile device is guided to enter the designated area according to the personalized needs of the user.
  • the existing guidance method has the following defects: the inaccessible area and the forbidden entry area cannot be accurately identified, and misidentification and inaccurate identification are likely to occur, and the mobile device enters the forbidden entry area, which may cause damage to the mobile device.
  • the object of the embodiments of the present invention is to provide a virtual wall construction method based on machine vision, a map construction method, and a mobile electronic device, which can effectively solve the problem that the prior art is prone to misidentification and inaccurate recognition, and the mobile device enters the forbidden entry area.
  • the problem is to provide a virtual wall construction method based on machine vision, a map construction method, and a mobile electronic device, which can effectively solve the problem that the prior art is prone to misidentification and inaccurate recognition, and the mobile device enters the forbidden entry area.
  • Embodiments of the present invention provide a virtual wall construction method based on machine vision, including the steps of:
  • the image of the surrounding environment is collected in real time by a camera disposed on the movable electronic device, and the image captured at each moment is projected.
  • the key points of the target image on the photosensitive surface are all located on a characteristic line; x ⁇ 2;
  • the virtual wall is constructed on a vertical plane.
  • the method further comprises the steps of:
  • the target image acquired at any time matches any of the mark patterns in the mark pattern library, the target image is acquired in the light-sensitive
  • the x key points on the surface are:
  • Obtaining a feature point of the matching relationship between the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when acquiring When the number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
  • the feature points in which x are on the same straight line are taken as key points.
  • the image matching algorithm is a scale invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature descriptor of the mark pattern/target image is obtained by the following steps:
  • the scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Perform verification to remove the marker image/target image An unstable extreme point in the scale space, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
  • the intra-block gradient histogram is calculated by performing area segmentation on the surrounding image of the feature point, thereby generating a feature descriptor of the feature point.
  • the image acquired by the camera is projected to the photosensitive surface of the image sensor through the imaging lens; the distance between the virtual wall and the movable electronic device is calculated by a triangulation method.
  • the calculating the distance between the virtual wall and the movable electronic device based on the key point of the target image on the photosensitive surface is specifically:
  • the distance between the virtual wall and the removable electronic device is calculated by the following formula:
  • the distance between the virtual wall and the removable electronic device is calculated by the following formula:
  • a is the distance from the upper border of the virtual wall to the photosensitive surface
  • b is the distance between the imaging lens and the photosensitive surface
  • S is the distance between the characteristic straight line and the center point of the photosensitive surface
  • D is a distance between the virtual wall and a center point of the photosensitive surface
  • is the preset angle
  • the image sensor includes a PSD sensor, a CCD sensor, or a CMOS sensor.
  • the width of the virtual wall is calculated by the following formula:
  • W is the width of the virtual wall
  • a is the distance from the upper border of the virtual wall to the photosensitive surface
  • is the wide angle of the camera.
  • the method further comprises the steps of:
  • the method further comprises the steps of:
  • the movable electronic device After constructing the virtual wall, the movable electronic device is controlled to pass through the virtual wall in a preset path.
  • the method further includes the following steps:
  • Correction of lens deformation is performed on the target image.
  • the embodiment of the invention further provides a map construction method, which comprises the steps of:
  • Real-time map construction is performed on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
  • the real-time map construction of the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall includes:
  • Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
  • At least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed at a specific position of the to-be-positioned area, and each of the positioning tag information includes The uniquely encoded information of the absolute position; the real-time map construction of the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall further includes:
  • the to-be-positioned area performs real-time map construction.
  • the method further comprises the steps of:
  • the movable electronic device is returned to a center line of the virtual wall along a trajectory parallel to the virtual wall according to a distance of the movable electronic device from a center line of the virtual wall.
  • the removable electronic device includes a driving wheel and a driven wheel, and the method further includes the steps of:
  • the speed of the driven wheel of the movable electronic device is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
  • the speed of the driving wheel is used as a reference speed
  • the theoretical speed is calculated according to a speed of the driving wheel.
  • the embodiment of the present invention further provides a virtual machine building device based on machine vision.
  • the virtual machine building device based on machine vision is disposed on the mobile electronic device, and includes:
  • a camera for collecting an image of the surrounding environment in real time at a preset frequency during the traversing of the area to be located by the movable electronic device
  • An image sensor for receiving an image acquired at each moment on a photosensitive surface of the image sensor to form a target image
  • a storage device for pre-storing a plurality of mark patterns
  • a controller configured to acquire, according to a preset image matching algorithm, an image of the target image on the photosensitive surface when the target image acquired at any time matches any of the marking patterns in the mark pattern library a key point; calculating a distance between the virtual wall and the movable electronic device based on a key point of the target image on the photosensitive surface, according to a distance between the virtual wall and the movable electronic device, Constructing the virtual wall with a characteristic straight line at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the characteristic line and The virtual wall is constructed on a surface perpendicular to the photosensitive surface; the key points of the target image on the photosensitive surface are all located on a characteristic line; x ⁇ 2.
  • the controller is further configured to acquire, by the camera, an image directly above the movable electronic device by the camera in response to the calibration instruction, and store the image in the mark pattern library as a new mark. a pattern; acquiring, by the image matching algorithm, a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
  • the controller when the target image acquired at any time matches any of the mark patterns in the mark pattern library, the controller acquires the target image in the The x key points on the photosensitive surface are as follows:
  • Obtaining a feature point of the matching relationship between the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when acquiring When the number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
  • the feature points in which a x are located on the same straight line are taken as key points.
  • the image matching algorithm is a scale-invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature descriptor of the mark pattern/target image is obtained by the controller by using the following steps:
  • the scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Performing a check to remove an unstable extreme point in the scale space of the mark image/target image, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
  • the intra-block gradient histogram is calculated by performing area segmentation on the surrounding image of the feature point, thereby generating a feature descriptor of the feature point.
  • the camera further includes an imaging lens, and an image captured by the camera is projected to the photosensitive surface of the image sensor through the imaging lens; the distance between the virtual wall and the movable electronic device is triangulated Calculated by the distance method.
  • the controller calculates the distance between the virtual wall and the movable electronic device based on the key point of the target image on the photosensitive surface:
  • the distance between the virtual wall and the removable electronic device is calculated by the following formula:
  • the distance between the virtual wall and the removable electronic device is calculated by the following formula:
  • a is the distance from the upper border of the virtual wall to the photosensitive surface
  • b is the distance between the imaging lens and the photosensitive surface
  • S is the distance between the characteristic straight line and the center point of the photosensitive surface
  • D is a distance between the virtual wall and a center point of the photosensitive surface
  • is the preset angle
  • the controller calculates the width of the virtual wall based on the following formula:
  • W is the width of the virtual wall
  • a is the distance from the upper border of the virtual wall to the photosensitive surface
  • is the wide angle of the camera.
  • the image sensor includes a PSD sensor, a CCD sensor, or a CMOS sensor.
  • the controller when the distance between the virtual wall and the mobile electronic device is less than a preset distance, the controller is further configured to move the mobile electronic device by using a preset avoidance policy. The distance of the mobile electronic device from the virtual wall is increased.
  • the controller is further configured to control the movable electronic device to pass through the virtual wall in a preset path after constructing the virtual wall.
  • the controller is further configured to perform perspective distortion on the target image. Correction.
  • the embodiment of the invention further provides a removable electronic device, including:
  • a machine vision-based virtual wall building device for constructing a virtual wall
  • the controller is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
  • An encoder configured to calculate, in real time, a displacement and a direction of the movable electronic device relative to the coordinate origin in a process in which the movable electronic device traverses the to-be-positioned area;
  • the controller is further configured to receive a displacement and a direction of the movable electronic device sent by the encoder with respect to the coordinate origin, and acquire coordinate values of the movable electronic device in the coordinate system at any time;
  • the controller is further configured to perform real-time map construction on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
  • the controller is based on a moving direction and movement of the movable electronic device relative to the starting point when an obstacle is sensed by the collision sensor a distance, a coordinate value of a current position of the movable electronic device as a coordinate value of the obstacle position;
  • the controller calculates the position of the obstacle relative to the currently movable electronic device according to the laser/infrared distance calculation principle, so that the movable electronic device according to the current moment Calculating a coordinate value of the obstacle at the current time relative to a moving direction and a moving distance of the starting point;
  • the controller is configured to perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
  • At least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed at a specific position of the to-be-positioned area, and each of the positioning tag information includes The unique coding information of the absolute position; the real-time map construction of the to-be-positioned area by the controller according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall includes:
  • Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
  • the controller is further configured to calculate, according to the perspective deformation of the target image, a distance of the movable electronic device from the center line of the virtual wall; according to the movable electronic device deviating from the virtual The distance from the centerline of the wall causes the moveable electronic device to return to the centerline of the virtual wall along a trajectory parallel to the virtual wall.
  • the movable electronic device includes a driving wheel and a driven wheel
  • the controller is further configured to detect the detachable time when the movable electronic device travels along any straight line
  • the speed of the driving wheel of the mobile electronic device is inconsistent with the speed of the driven wheel
  • the smaller value of the speed of the driving wheel and the speed of the driven wheel is used as a reference speed, and the movable electronic is calculated according to the reference speed.
  • the speed of the driven wheel of the movable electronic device is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
  • the speed of the driving wheel is used as a reference speed
  • the theoretical speed is calculated according to a speed of the driving wheel.
  • the embodiment of the present invention provides a virtual wall construction method and device based on machine vision, a map construction method, and a mobile electronic device.
  • a matching operation is performed on an image acquired in real time, when the matching is successful, Selecting a specific feature point on the image as a key point, calculating a position of the virtual wall relative to the movable electronic device according to the key point, and automatically constructing a virtual wall, thereby accurately constructing a dividing line dividing the accessible area and the forbidden entering area
  • the obvious dividing line can completely prohibit the movable electronic device from entering the forbidden entry area, and has the advantages of simple practicality and high reliability; in addition, the solution in this embodiment does not require additional interactive devices for setting the virtual wall, and does not need to be specific. Position setting tabs, etc., more intelligent.
  • FIG. 1 is a schematic flow chart of a method for constructing a virtual wall based on machine vision according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic view showing a distance between a virtual wall and a center of a photosensitive surface in Embodiment 1 of the present invention
  • FIG. 3 is a schematic diagram showing a positional relationship between another virtual wall and a mobile electronic device of FIG. 2 according to Embodiment 1 of the present invention
  • FIG. 4 is a schematic diagram showing another distance between a virtual wall and a center of a photosensitive surface in Embodiment 1 of the present invention.
  • Figure 5 is a plan view of the center of the photosensitive surface corresponding to Figure 4 and the virtual wall;
  • FIG. 6 is a schematic diagram of calculating a distance between a virtual wall and a removable electronic device in Embodiment 1 of the present invention.
  • FIG. 7 is a schematic diagram of calculating the width of the virtual wall according to Embodiment 1 of the present invention.
  • FIG. 8 is a schematic flow chart of a method for constructing a virtual wall based on machine vision according to Embodiment 2 of the present invention.
  • Figure 9 is a schematic view showing the calibration of the marking pattern in the second embodiment of the present invention.
  • FIG. 10 is a schematic flow chart of calculating each feature descriptor of a mark pattern/target image in Embodiment 2 of the present invention.
  • FIG. 11 is a schematic flow chart of a method for constructing a virtual wall based on machine vision according to Embodiment 3 of the present invention.
  • FIG. 12 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 4 of the present invention.
  • FIG. 13 is a schematic flowchart diagram of a map construction method according to Embodiment 5 of the present invention.
  • FIG. 14 is a schematic flowchart diagram of a map construction method according to Embodiment 6 of the present invention.
  • FIG. 16 is a schematic diagram of turning of a mobile electronic device in Embodiment 7 of the present invention.
  • FIG. 17 is a schematic structural diagram of a virtual machine building device based on machine vision according to Embodiment 8 of the present invention.
  • FIG. 18 is a schematic structural diagram of a mobile electronic device according to Embodiment 9 of the present invention.
  • FIG. 19 is a schematic structural diagram of a mobile electronic device according to Embodiment 10 of the present invention.
  • Embodiment 1 is a schematic flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 1 of the present invention, including the steps:
  • the camera disposed on the movable electronic device captures an image of the surrounding environment in a real-time manner at a preset frequency, and images the image captured at each moment. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
  • the image sensor comprises a PSD sensor, a CCD sensor or a CMOS sensor.
  • the mark pattern in the mark pattern library needs to be pre-stored in the memory of the removable electronic device, wherein one way is specifically, when the pre-stored mark instruction is received, the input picture (such as a vector diagram) is read and stored. It is used in the mark pattern library as a subsequent virtual wall recognition.
  • each feature pattern needs to define a characteristic line or a key point of the virtual wall, which can be implemented in two ways: one is to add characteristic line information or key point information to the pre-stored picture, and then import the movable electronic device. The other is to perform the operation of defining the feature line or key point on the imported picture in response to the defined feature line or key point instruction according to the definition operation of the user input.
  • the embodiment of the present invention may import the mark pattern by: acquiring an image directly above the movable electronic device at the current time in response to the calibration instruction, and storing the image in the mark pattern library as a new mark. pattern.
  • the matching of the images is performed by matching the feature vectors of the feature points.
  • the mark pattern is pre-processed and the feature points are extracted to obtain a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
  • Image feature extraction is the premise of image analysis and image recognition. It is the most effective way to simplify the expression of high-dimensional image data.
  • the corresponding key points may be preferably determined by the following two methods: one is to display a plurality of the feature points generated on the mark pattern, and is completed according to a user's selection instruction for a plurality of the feature points.
  • the key point definition of the mark pattern another specifically, after generating a plurality of feature points of the mark pattern, the system selects a plurality of the feature points by a preset algorithm to complete the mark.
  • step S3 the image matching algorithm is used to perform feature extraction on the target image to obtain feature points, and then the specific feature points are selected as key points for mapping the virtual wall.
  • the preset angle is an angle between the virtual wall to be constructed and the characteristic straight line, which is closely related to the selection of the key points.
  • the distance between the virtual wall to be constructed and the movable electronic device may be calculated by using laser focusing or phase focusing, and phase laser ranging, pulse laser ranging, and triangulation laser ranging may also be used.
  • the scheme adopts a triangulation method, and compared with the traditional triangulation laser ranging, the laser does not need to first transmit laser light to the target object and the reference surface, and then the target object is calculated by the reflection of the target object and the reflection image of the reference surface.
  • the distance from the reference plane so there is no need to construct a reference plane, and only the diffuse reflection of the object under natural light can be used for ranging, which has the advantages of simple structure, high precision, high speed and flexible use, and further reduces the production cost.
  • step S4 if the preset angle is equal to 0° or 180°, then the virtual wall to be constructed is in parallel with the feature line by default.
  • the distance between the virtual wall and the movable electronic device is calculated by the following formula:
  • a is the distance from the upper border of the virtual wall to the photosensitive surface
  • b is the distance between the imaging lens and the photosensitive surface
  • S is the distance between the characteristic straight line and the center point of the photosensitive surface
  • D is a distance between the virtual wall and a center point of the photosensitive surface
  • is the preset angle
  • a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301
  • b is the distance between the imaging lens 303 and the photosensitive surface 301
  • S is the characteristic line 304 and the photosensitive surface
  • the distance from the center point 302 of 301, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301.
  • 2 is a case where the movable electronic device is facing the virtual wall
  • FIG. 3 is a case where the movable electronic device is shifted to the right with respect to the virtual wall.
  • the movable electronic device is relatively In any direction of the virtual wall (including front, back, left and right offset), as long as the camera detects a certain number of matching feature points, it can accurately construct a reasonable key based on the position of the feature points.
  • the virtual wall of the location includes front, back, left and right offset
  • the distance between the virtual wall and the movable electronic device is calculated by the following formula:
  • a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301
  • b is the distance between the imaging lens 303 and the photosensitive surface 301
  • S is the characteristic line 304 and the photosensitive surface
  • D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301
  • is the preset angle; as shown in FIG. 4, there is a ceiling on the ceiling 500 of the room.
  • the distance D between the virtual wall 100 and the center point 302 of the photosensitive surface 301 is the distance between the virtual wall 100 and the movable electronic device.
  • the distance from the upper border of the virtual wall to the photosensitive surface refers to the distance from the ceiling of the room to the photosensitive surface, or the distance from the upper border of the door to the photosensitive surface.
  • the specific value can be preset in the system.
  • the width information of the virtual wall can be calculated by the following steps, specifically calculating the width of the virtual wall by using the following formula:
  • W is the width of the virtual wall 100
  • a is the distance from the upper border of the virtual wall 100 to the photosensitive surface 301
  • is the wide angle of the camera.
  • the location image of the virtual wall needs to be directly acquired, and the image is pre-processed and extracted by using a preset image matching algorithm, and then the matching image is performed on the real-time acquired image.
  • the image is selected.
  • the specific feature point is used as a key point, and the position of the virtual wall relative to the movable electronic device is calculated according to the key point, and the virtual wall is automatically constructed, so that the boundary line between the partitionable entry area and the forbidden entry area can be accurately constructed.
  • the dividing line can completely prohibit the movable electronic device from entering the forbidden entry area, and has the advantages of simple practicality and high reliability; in addition, the solution in this embodiment does not require additional interactive devices for setting the virtual wall, and there is no need to set the positioning at a specific location. Labels, etc., are more intelligent.
  • FIG. 8 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 2 of the present invention, including the steps of:
  • the embodiment of the present invention may import the mark pattern by: acquiring an image directly above the movable electronic device at the current time in response to the calibration instruction, and storing the image in the mark pattern library as a new mark. pattern.
  • the matching of the images is performed by matching the feature vectors of the feature points.
  • the mark pattern is pre-processed and the feature points are extracted to obtain a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
  • the redundant information input must be excluded, and the key information is extracted, which involves the feature extraction problem. For example, taking a door frame image directly above the removable electronic device, the extracted feature points may be located at the edge of the door frame.
  • the movable electronic device is placed directly below the upper frame of the door, and the calibration button can be pressed (the calibration button can be set on the mobile electronic device or on the remote controller).
  • the calibration button can be set on the mobile electronic device or on the remote controller.
  • click on the calibration option on the third interactive terminal such as mobile phone, tablet, PC, etc.
  • the picture 200 includes the left border 201 of the door, the door Right border 202, door upper border 203 and room top 204.
  • the feature extraction is performed on the image by a preset image matching algorithm, and several feature points (x1 to x6, y1 to y6) are obtained.
  • the condition of constructing the virtual wall may be considered as met.
  • the constructed virtual wall is parallel with the features formed by x2 and x3; when y1 and y2 are the key points, the constructed virtual wall is composed of y1 and y2.
  • the characteristic line is at a right angle of 90 degrees.
  • the image matching algorithm is a scale-invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature descriptor of the mark pattern/target image is obtained by the following steps:
  • step S26 since the local extremum points may not be extreme points in the true sense in the discrete space, the true pole points may fall in the gaps of the discrete points, so the position of the slots can be The interpolation check is performed, and then the coordinate position of the extreme point is obtained, thereby obtaining the coordinate position of the feature point.
  • S27 assign a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of the feature point;
  • step S27 by performing histogram statistics on the gradient direction of the points in the neighborhood of the feature points, the histogram statistics are selected in the direction with the larger specific gravity in the histogram, and the direction with the largest specific gravity in the histogram is selected as the main direction of the feature points.
  • the Scale-invariant feature transform uses the convolution of the original image and the Gaussian kernel to establish the scale space, and extracts the feature of the scale invariance on the Gaussian difference space pyramid. point.
  • the algorithm has certain affine invariance, visual invariance, rotation invariance and illumination invariance, so it has a wide range of applications in image feature improvement.
  • the scale-invariant feature transform algorithm uses a first-order Gaussian difference to only a Gaussian Laplacian kernel, which greatly reduces the amount of computation.
  • the Speeded-Up Robust Features is a scale-invariant feature transform algorithm.
  • the matching process is basically the same.
  • the accelerated robust feature algorithm uses the approximate Harr wavelet method to extract feature points.
  • a speckle feature detection method based on the Hessian determinant.
  • the approximate Ha rr wavelet value can be effectively calculated, which simplifies the construction of the second-order differential template and improves the efficiency of feature detection in scale space.
  • FIG. 11 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 3 of the present invention, including the steps of:
  • the camera disposed on the movable electronic device collects an image of the surrounding environment in a real-time manner at a preset frequency, and images the image captured at each moment. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
  • the steps S31 to S35 of the embodiment are substantially the same as the steps S21 to S25 shown in FIG. 8. For details, refer to the detailed description of the steps S21 to S25, and details are not described herein again.
  • the embodiment of the present invention adds a step of causing the removable electronic device to travel away from the virtual wall.
  • a forbidden entry area for example, prohibiting the sweeping robot from entering the toilet to prevent the ground area water or excessive water vapor from entering the machine, causing a short circuit, so it is necessary to construct a virtual wall and Set the appropriate avoidance strategy to prevent the robot from entering the forbidden entry area by mistake.
  • the avoidance strategy is specifically:
  • the avoidance strategy of this embodiment may also adopt other manners, and details are not described herein again.
  • the photosensitive surface forms the target image, it is necessary to correct the perspective distortion of the target image before comparing the target image with the pre-stored marking pattern in the marking pattern library, thereby constructing a more accurate virtual wall.
  • the traditional method mainly uses the following methods:
  • the mobile electronic device is directly placed directly under the pre-built virtual wall (directly under the door frame), that is, when the movable electronic device is at an angle of 90 degrees with the virtual wall, the camera obtains positive
  • the upper picture is used as a mark pattern, and feature mark extraction is performed on the mark pattern to obtain feature descriptors of each feature point, and the movable electronic device acquires features of the mark pattern in a wide angle range of the camera during traversing the room.
  • the matching picture is matched, if the matching feature point is greater than the preset threshold, the key points on the same line in the feature point may be selected, the position information of the virtual wall is calculated, and the virtual wall is automatically constructed as a subsequent allowed entry.
  • the boundary between the area and the forbidden area, or as a map for constructing the entire room, does not require a cumbersome import and export process, the construction process is more flexible, and has the advantages of simplicity and practicality; moreover, in addition, the solution in this embodiment does not require additional interactive equipment.
  • To set up the virtual wall there is no need to set the positioning label in a specific location, etc. High, when you need to cancel the virtual wall in a specific location, you only need to delete the mark pattern pre-stored into the removable electronic device, which is convenient and quick.
  • FIG. 12 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 4 of the present invention, including the steps of:
  • the camera disposed on the movable electronic device collects an image of the surrounding environment in a real-time manner at a preset frequency, and images the image captured at each moment. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
  • S45 Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature. Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and Constructing the virtual wall on a surface perpendicular to the photosensitive surface;
  • the steps S41 to S45 of the present embodiment are substantially the same as the steps S21 to S25 shown in FIG. 8. For details, refer to the detailed description of the steps S21 to S25, and details are not described herein again.
  • the embodiment of the present invention adds the step of moving the mobile electronic device through the virtual wall.
  • the movable electronic device may be controlled to pass through the preset path. Describe the virtual wall to enter another area.
  • the path may be set as a straight path passing through the virtual wall and perpendicular to the virtual wall, or may be set as any curved path through the virtual wall.
  • FIG. 13 is a schematic flowchart of a method for constructing a map according to Embodiment 5 of the present invention, including the steps of:
  • S51 Construct a coordinate system with an arbitrary position or a specific position in the to-be-positioned area as a coordinate origin, and calculate a displacement of the movable electronic device relative to the coordinate origin in real time during the process of the movable electronic device traversing the to-be-positioned area. And a direction to acquire coordinate values of the movable electronic device in the coordinate system in real time;
  • the steps S52 to S54 in this embodiment are substantially the same as the steps S11 to S13 in FIG. 1 .
  • the coordinate system is constructed by using an arbitrary position or a specific position in the area to be constructed as a reference point (coordinate origin), and then calculating the movable electronic device relative to the encoder by using an encoder disposed on the movable electronic device.
  • the distance and direction of the origin of the coordinate to obtain the coordinate value of the movable electronic device in the coordinate system.
  • the coordinate plane of the virtual wall in the coordinate system can be obtained.
  • the mobile electronic device can establish a simple structure of the room according to the coordinate plane of each virtual wall in the coordinate system, and form a 3D three-dimensional map for navigation and use of the movable electronic device, which has the advantages of simple and practical.
  • FIG. 14 is a schematic flowchart of a method for constructing a map according to Embodiment 6 of the present invention, where the at least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed in the to-be-positioned area.
  • each of the positioning tag information includes unique encoding information for distinguishing its absolute position, including the steps of:
  • the camera disposed on the movable electronic device collects an image of the surrounding environment in real time at a preset frequency, and collects each time. Projecting an image onto a photosensitive surface of an image sensor provided in the movable electronic device to form a target image;
  • S66 Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and Constructing the virtual wall on a surface perpendicular to the photosensitive surface;
  • S69 Perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
  • the steps S62-66 of the embodiment are basically the same as the steps S21 to S25 shown in FIG. 8. For details, refer to the detailed description of the steps S21 to S25, and details are not described herein again.
  • the embodiment also constructs a map by using the position of the obstacle and the positioning tag, specifically detecting the obstacle by the obstacle sensor, the laser sensor or the infrared sensor, and when the obstacle is detected, according to the current moment
  • the position of the movable electronic device acquires the coordinate value of the obstacle; in addition, different sensors are set according to the type of the positioning tag to obtain the position information of the positioning tag, for example, when the positioning tag is a color block label, the color sensor is set. Sensing, and when the positioning tag is an RFID tag, an RFID sensor is set for sensing.
  • a complete and detailed map can be constructed, which facilitates accurate navigation of the mobile electronic device, thereby facilitating the execution of subsequent work.
  • the map construction method further includes the steps of:
  • the perspective distortion is due to the relative proportion change of the near-far feature, and bending or deformation occurs, so that the distance of the movable electronic device from the center line of the virtual wall can be calculated according to the proportion of the number of pixels projected on the photosensitive surface.
  • the position of the movable electronic device to return to the center line of the virtual wall can be guided, thereby calibrating the position of the movable electronic device, facilitating subsequent rapid positioning and reforming the forward path.
  • the embodiment obtains the coordinate values of the positioning label, the obstacle or the virtual wall multiple times by the traversal of the movable device, and then uses a recursive algorithm to locate each positioning label, obstacle or virtual.
  • the coordinate values of the wall are corrected. The more the number of times the movable device traverses, the more accurate the calculated coordinate values of the positioning label, obstacle or virtual wall will be, until the error is reduced to negligible until the end.
  • the movable electronic device can be detected in a slipping state by specifying effective corrective measures to avoid subsequent errors:
  • the speed of the driven wheel of the movable electronic device is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
  • the driven wheel of the movable electronic device is detected at any time
  • the speed of the driving wheel is used as a reference speed, and the displacement and direction of the movable electronic device relative to the coordinate origin are calculated according to the reference speed; the theoretical speed is according to the active
  • the speed of the wheel is calculated.
  • the line speeds of the points on the movable electronic device are equal, and when the unequal state is detected at any time, the movable electronic device can be judged to be in a slip state at the current time; and a more complicated situation is
  • the mobile electronic device makes a turn along a central point, and the speeds at various points thereon are inconsistent.
  • the movable electronic device 300 when the movable electronic device 300 makes a left turn at 0 o'clock at any time, it is assumed that the speed of the left driving wheel K1 is 50 cm/s, The speed of the right driving wheel K2 is 100 cm/s, and according to the distance proportional relationship between each point and 0 point, for example, the distance s1 of the front driven wheel K3 to 0 point is 80 cm, and the distance s3 of the right driving wheel K2 to 0 point is 100 cm.
  • FIG. 17 is a schematic structural diagram of a virtual machine building device based on machine vision according to Embodiment 8 of the present invention.
  • the virtual wall building device is disposed on a mobile electronic device, and includes:
  • the camera 81 is configured to collect an image of the surrounding environment in real time at a preset frequency during the process of traversing the area to be located by the movable electronic device;
  • the image sensor 82 is configured to receive an image acquired at each moment on the photosensitive surface of the image sensor 72 to form a target image
  • a storage device 83 configured to pre-store a plurality of mark patterns
  • a controller 84 configured to acquire, according to a preset image matching algorithm, when the target image acquired at any time matches any of the marking patterns in the storage device 83, acquiring the target image on the photosensitive surface x key points; calculating a distance between the virtual wall and the movable electronic device based on the key points of the target image on the photosensitive surface, according to the distance between the virtual wall and the movable electronic device, Constructing the virtual wall with a predetermined straight line at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then the line is parallel to the characteristic Constructing the virtual wall on a surface perpendicular to the photosensitive surface; the key points of the target image on the photosensitive surface are all located on a characteristic line; x ⁇ 2.
  • the controller 84 is configured to: first acquire, by using the image matching algorithm, a plurality of feature points of the target image at a current time and a feature descriptor corresponding to each of the feature points, and then calculate the target by calculating a feature point of each feature descriptor of the image and each feature descriptor of the mark pattern, and obtaining a feature point having a matching relationship between the target image and the mark pattern, when the acquired matching relationship is obtained
  • the controller 84 is configured to: first acquire, by using the image matching algorithm, a plurality of feature points of the target image at a current time and a feature descriptor corresponding to each of the feature points, and then calculate the target by calculating a feature point of each feature descriptor of the image and each feature descriptor of the mark pattern, and obtaining a feature point having a matching relationship between the target image and the mark pattern, when the acquired matching relationship is obtained
  • the number of the feature points is greater than the preset threshold, determining that the target image matches any of the mark patterns in the mark pattern
  • controller 84 imports the mark pattern by:
  • an image directly above the removable electronic device at the current time is acquired and stored in the mark pattern library as a new mark pattern.
  • the matching of the images is performed by matching the feature vectors of the feature points.
  • the mark pattern is pre-processed and the feature points are extracted to obtain a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
  • the image matching algorithm is a scale invariant feature transform algorithm or an accelerated robust feature algorithm, and the controller 84 obtains each feature descriptor of the mark pattern/target image by the following steps:
  • the scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Performing a check to remove an unstable extreme point in the scale space of the mark image/target image, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
  • the intra-block gradient histogram is calculated by performing area segmentation on the surrounding image of the feature point, thereby generating a feature descriptor of the feature point.
  • the camera 81 is provided with an imaging lens (or imaging lens) for imaging focusing, so that the reflective object forms a target image on the photosensitive surface of the image sensor 82.
  • the distance between the virtual wall and the mobile electronic device is calculated by a triangulation method.
  • the distance between the virtual wall and the movable electronic device is calculated by the following formula:
  • a is the distance from the upper border of the virtual wall to the photosensitive surface
  • b is the distance between the imaging lens and the photosensitive surface
  • S is the distance between the characteristic straight line and the center point of the photosensitive surface
  • D is a distance between the virtual wall and a center point of the photosensitive surface
  • is the preset angle
  • a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301
  • b is the distance between the imaging lens 303 and the photosensitive surface 301
  • S is the characteristic line 304 and the photosensitive surface
  • the distance from the center point 302 of 301, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301.
  • 2 is a case where the movable electronic device is facing the virtual wall
  • FIG. 3 is a case where the movable electronic device is shifted to the right with respect to the virtual wall.
  • the movable electronic device is relatively In any direction of the virtual wall (including front, back, left and right offset), as long as the camera detects a certain number of matching feature points, it can accurately construct a reasonable key based on the position of the feature points.
  • the virtual wall of the location includes front, back, left and right offset
  • the distance between the virtual wall and the movable electronic device is calculated by the following formula:
  • a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301
  • b is the distance between the imaging lens 303 and the photosensitive surface 301
  • S is the characteristic line 304 and the photosensitive surface
  • D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301
  • is the preset angle; as shown in FIG. 4, there is a ceiling on the ceiling 500 of the room.
  • the distance D between the virtual wall 100 and the center point 302 of the photosensitive surface 301 is the distance between the virtual wall 100 and the movable electronic device.
  • the distance between the virtual wall 100 and the removable electronic device 300 can be defined as The distance from the center point 305 of the mobile electronic 300 to the virtual wall 100; specifically, when the removable electronic device 300 faces the virtual wall 100, as shown in FIG. 7, the portable electronic device 300 is assumed
  • the distance between the virtual wall 100 and the removable electronic device 300 may be defined as the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301 and the movable electronic device 300.
  • the sum of the distances between the center point 305 and the center point 302 of the photosensitive surface 301, that is, L D+D', where L is the distance between the virtual wall 100 and the removable electronic device 300, and D is the virtual The distance of the wall 100 from the center point 302 of the photosensitive surface 301, D', is the distance between the center point 305 of the movable electronic device 300 and the center point 302 of the photosensitive surface 301. It is to be understood that the above formula is applicable to the case where the movable electronic device is in a regular shape, and is not described herein.
  • the distance from the upper border of the virtual wall to the photosensitive surface refers to the distance from the ceiling of the room to the photosensitive surface, or the distance from the upper border of the door to the photosensitive surface.
  • the specific value can be preset in the system.
  • the width information of the virtual wall can be calculated by the following steps, specifically calculating the width of the virtual wall by using the following formula:
  • W is the width of the virtual wall 100
  • a is the distance from the upper border of the virtual wall 100 to the photosensitive surface 301
  • is the wide angle of the camera 81.
  • the image sensor 82 includes a PSD sensor, a CCD sensor, or a CMOS sensor.
  • the controller 84 is further configured to: when the distance between the virtual wall and the mobile electronic device is less than a preset distance, the controller 84 is further configured to bypass the preset The policy moves the mobile electronic device such that the distance of the mobile electronic device from the virtual wall increases.
  • controller 84 is further configured to control the movable electronic device to pass through the virtual wall in a preset path after constructing the virtual wall.
  • the target image is compared with the pre-stored mark pattern in the mark pattern library.
  • the controller 84 is further configured to perform a correction of the perspective deformation of the target image.
  • FIG. 18 is a schematic structural diagram of a mobile electronic device according to Embodiment 9 of the present invention, including:
  • the virtual wall construction device 91 configured to construct a virtual wall
  • the controller 84 is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
  • the encoder 92 is configured to calculate, in real time, the displacement and direction of the movable electronic device relative to the coordinate origin in the process of traversing the to-be-positioned area by the mobile electronic device;
  • the controller 84 is configured to receive a displacement and a direction of the movable electronic device sent by the encoder 92 with respect to the coordinate origin, and acquire coordinate values of the mobile electronic device in the coordinate system at an arbitrary time;
  • the controller 84 is further configured to perform real-time map construction on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
  • the coordinate plane of the virtual wall is calculated according to the coordinate value of the movable electronic device in the coordinate system and the distance between the virtual wall and the movable electronic device.
  • the mobile electronic device includes a driving wheel and a driven wheel
  • the controller 84 is further configured to detect the movable time at any time during the traveling of the movable electronic device along an arbitrary straight line.
  • the speed of the driving wheel of the electronic device does not coincide with the speed of the driven wheel
  • the smaller value of the speed of the driving wheel and the speed of the driven wheel is used as a reference speed
  • the movable electronic device is calculated according to the reference speed.
  • the speed of the driven wheel of the movable electronic device is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
  • the speed of the driving wheel is used as a reference speed
  • the theoretical speed is calculated according to a speed of the driving wheel.
  • Embodiment 10 of the present invention is a schematic structural diagram of a mobile electronic device according to Embodiment 10 of the present invention, including:
  • the virtual wall construction device 101 configured to construct a map
  • the controller is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
  • the encoder 102 is configured to calculate, in real time, the displacement and direction of the movable electronic device relative to the coordinate origin in the process of traversing the to-be-positioned area by the mobile electronic device;
  • the controller 84 is configured to receive a displacement and a direction of the movable electronic device sent by the encoder 102 with respect to the coordinate origin, and acquire coordinate values of the mobile electronic device in the coordinate system at an arbitrary time;
  • the controller 84 is further configured to perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
  • the controller 84 when the obstacle is sensed by the collision sensor 103, the controller 84 sets the current position of the movable electronic device based on the moving direction and the moving distance of the movable electronic device with respect to the starting point.
  • the coordinate value is used as the coordinate value of the obstacle position; when the obstacle is detected by the laser sensor/infrared sensor 103, the controller 84 calculates the obstacle according to the laser/infrared distance calculation principle.
  • the position of the mobile electronic device is based on the coordinate value of the obstacle.
  • At least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed at a specific position of the to-be-positioned area, and each of the positioning tag information includes The unique encoding information of the absolute position of the controller; the controller 84 performs real-time map construction on the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall, including:
  • Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
  • the controller 84 is further configured to calculate, according to the perspective deformation of the target image, a distance of the mobile electronic device from the center line of the virtual wall; according to a distance of the mobile electronic device from a center line of the virtual wall; And causing the mobile electronic device to return to a center line of the virtual wall along a trajectory parallel to the virtual wall.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

Disclosed are a virtual wall construction method and device based on machine vision, a map construction method, and a portable electronic device, wherein the virtual wall construction method based on machine vision performs a matching operation on images acquired in real time; when matching is successful, selecting specific characteristic points on the images to act as key points, calculating the position of a virtual wall relative to the portable electronic device according to the key points, and automatically constructing the virtual wall, such that a boundary line dividing an accessible region and an entry-prohibited region may be accurately constructed, and an obvious boundary line such as the aforementioned may completely prohibit the portable electronic device from entering the entry-prohibited region; thus the present method has simple, practical and reliable advantages. Furthermore, the solution in the present embodiment configures the virtual wall without the need for additional interactive devices and also without the need for setting location tags and the like in specific locations, as the degree of intelligence is higher.

Description

基于机器视觉的虚拟墙构建方法及装置、地图构建方法、可移动电子设备Virtual wall construction method and device based on machine vision, map construction method, mobile electronic device 技术领域Technical field
本发明涉及即时定位与地图构建领域,尤其涉及一种基于机器视觉的虚拟墙构建方法及装置、地图构建方法、可移动电子设备。The invention relates to the field of real-time positioning and map construction, in particular to a virtual wall construction method and device based on machine vision, a map construction method and a movable electronic device.
背景技术Background technique
移动装置的定位和地图构建是机器人领域的热点研究问题。对于已知环境中的移动装置自主定位和已知机器人位置的地图创建已经有了实用的解决方法。然而,在很多环境中移动装置不能利用全局定位系统进行定位,而且事先获取移动装置工作环境的地图很困难,甚至是不可能的。这时移动装置需要在自身位置不确定的条件下,在完全未知环境中构建地图,同时利用地图进行自主定位和导航。这就是所谓的即时定位与地图构建(SLAM,simultaneous localization and mapping)。The positioning and map construction of mobile devices is a hot research topic in the field of robotics. There has been a practical solution for map creation of mobile devices in a known environment with autonomous positioning and known robot positions. However, in many environments mobile devices cannot be located using a global positioning system, and it is difficult or even impossible to obtain a map of the working environment of the mobile device in advance. At this time, the mobile device needs to construct a map in a completely unknown environment under the condition that its position is uncertain, and at the same time utilize the map for autonomous positioning and navigation. This is called so-called simultaneous localization and mapping (SLAM).
在即时定位与地图构建中,移动装置利用自身携带的传感器识别未知环境中的特征标志(如RFID标签和色块标签),然后根据特征标志上携带的信息以识别可进入区域和禁止进入区域,从而根据用户的个性化需求引导移动装置进入指定区域工作。现有的这种引导方式存在以下缺陷:不能精确识别可进入区域和禁止进入区域,容易发生误识别和识别不准确而导致移动装置进入禁止进入区域,有可能会造成移动装置的损害。In real-time location and map construction, the mobile device uses the sensors carried by itself to identify feature marks (such as RFID tags and color block tags) in the unknown environment, and then recognizes the accessible area and the forbidden entry area according to the information carried on the feature mark. Thereby, the mobile device is guided to enter the designated area according to the personalized needs of the user. The existing guidance method has the following defects: the inaccessible area and the forbidden entry area cannot be accurately identified, and misidentification and inaccurate identification are likely to occur, and the mobile device enters the forbidden entry area, which may cause damage to the mobile device.
发明内容Summary of the invention
本发明实施例的目的是提供一种基于机器视觉的虚拟墙构建方法、地图构建方法及可移动电子设备,能有效解决现有技术容易发生误识别和识别不准确而导致移动装置进入禁止进入区域的问题。The object of the embodiments of the present invention is to provide a virtual wall construction method based on machine vision, a map construction method, and a mobile electronic device, which can effectively solve the problem that the prior art is prone to misidentification and inaccurate recognition, and the mobile device enters the forbidden entry area. The problem.
本发明实施例提供了一种基于机器视觉的虚拟墙构建方法,包括步骤:Embodiments of the present invention provide a virtual wall construction method based on machine vision, including the steps of:
在所述可移动电子设备遍历所述待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;During the traversing of the to-be-positioned area by the mobile electronic device, the image of the surrounding environment is collected in real time by a camera disposed on the movable electronic device, and the image captured at each moment is projected. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;其中,所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2;Obtaining x key points of the target image on the photosensitive surface when the target image acquired at any time matches any of the marking patterns in the marking pattern library according to a preset image matching algorithm; The key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2;
基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙。Calculating a distance between the virtual wall and the movable electronic device based on a key point of the target image on the photosensitive surface, according to a distance between the virtual wall and the movable electronic device, Forming the virtual wall on an angle that is perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel to the characteristic line and the photosensitive surface The virtual wall is constructed on a vertical plane.
作为上述实施例的改进,所述方法还包括步骤:As a modification of the above embodiment, the method further comprises the steps of:
响应于标定指令,获取当前时刻所述可移动电子设备正上方的图像,并存储至所述标记图案库中作为新的标记图案;And acquiring an image directly above the movable electronic device at the current moment in response to the calibration instruction, and storing the image in the mark pattern library as a new mark pattern;
通过所述图像匹配算法获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。And acquiring, by the image matching algorithm, a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
作为上述实施例的改进,所述根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点具体为:As a modification of the above embodiment, according to a preset image matching algorithm, when the target image acquired at any time matches any of the mark patterns in the mark pattern library, the target image is acquired in the light-sensitive The x key points on the surface are:
通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;Obtaining, by the image matching algorithm, a plurality of feature points of the target image at the current moment and a feature descriptor corresponding to each of the feature points;
通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;Obtaining a feature point of the matching relationship between the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when acquiring When the number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点。According to the positional relationship of the feature points having the matching relationship on the target image, the feature points in which x are on the same straight line are taken as key points.
作为上述实施例的改进,所述图像匹配算法为尺度不变特征变换算法或加速稳健特征算法,所述标记图案/目标图像的每一特征描述子通过以下步骤获取:As a modification of the above embodiment, the image matching algorithm is a scale invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature descriptor of the mark pattern/target image is obtained by the following steps:
通过高斯模糊建立标记图像/目标图像的尺度空间,通过高斯微分函数识别所述标记图像/目标图像的尺度空间中的极值点,对所述标记图像/目标图像的尺度空间中的极值点进行校验,去除所述标记图像/目标图像 的尺度空间中的不稳定极值点,从而获得所述标记图像/目标图像的特征点及所述特征点的尺度和位置;The scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Perform verification to remove the marker image/target image An unstable extreme point in the scale space, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
根据所述特征点的邻域像素的梯度方向分布特性,为每一所述特征点赋予方向;And assigning a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of the feature point;
根据所述特征点的尺度、位置和方向,通过对所述特征点的周围图像进行区域分块,计算块内梯度直方图,从而生成所述特征点的特征描述子。According to the scale, position and direction of the feature point, the intra-block gradient histogram is calculated by performing area segmentation on the surrounding image of the feature point, thereby generating a feature descriptor of the feature point.
作为上述实施例的改进,通过摄像头采集到的图像通过成像透镜投影至所述图像传感器的光敏面;所述虚拟墙与所述可移动电子设备的距离通过三角测距法计算得到。As a modification of the above embodiment, the image acquired by the camera is projected to the photosensitive surface of the image sensor through the imaging lens; the distance between the virtual wall and the movable electronic device is calculated by a triangulation method.
作为上述实施例的改进,所述基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离具体为:As a modification of the above embodiment, the calculating the distance between the virtual wall and the movable electronic device based on the key point of the target image on the photosensitive surface is specifically:
通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:The distance between the virtual wall and the removable electronic device is calculated by the following formula:
通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:The distance between the virtual wall and the removable electronic device is calculated by the following formula:
D=a/b*S*|cosθ|D=a/b*S*|cosθ|
其中,a为所述虚拟墙的上边框到所述光敏面的距离,b为所述成像透镜和所述光敏面的距离,S为所述特征直线和所述光敏面的中心点的距离,D为所述虚拟墙和所述光敏面的中心点的距离,θ为所述预设夹角。Where a is the distance from the upper border of the virtual wall to the photosensitive surface, b is the distance between the imaging lens and the photosensitive surface, and S is the distance between the characteristic straight line and the center point of the photosensitive surface, D is a distance between the virtual wall and a center point of the photosensitive surface, and θ is the preset angle.
作为上述实施例的改进,所述图像传感器包括PSD传感器、CCD传感器或CMOS传感器。As a modification of the above embodiment, the image sensor includes a PSD sensor, a CCD sensor, or a CMOS sensor.
作为上述实施例的改进,通过以下公式计算所述虚拟墙的宽度:As a modification of the above embodiment, the width of the virtual wall is calculated by the following formula:
Figure PCTCN2017116015-appb-000001
Figure PCTCN2017116015-appb-000001
其中,W为所述虚拟墙的宽度,a为所述虚拟墙的上边框到所述光敏面的距离,λ为所述摄像头的广角。Where W is the width of the virtual wall, a is the distance from the upper border of the virtual wall to the photosensitive surface, and λ is the wide angle of the camera.
作为上述实施例的改进,所述方法还包括步骤:As a modification of the above embodiment, the method further comprises the steps of:
当所述虚拟墙与所述可移动电子设备的距离小于预设的距离时,通过预设的避开策略移动所述可移动电子设备以使得所述可移动电子设备与所述虚拟墙的距离增大。When the distance between the virtual wall and the mobile electronic device is less than a preset distance, moving the mobile electronic device by a preset avoidance strategy to make the distance between the movable electronic device and the virtual wall Increase.
作为上述实施例的改进,所述方法还包括步骤:As a modification of the above embodiment, the method further comprises the steps of:
在构建所述虚拟墙后,控制所述可移动电子设备以预设的路径穿过所述虚拟墙。After constructing the virtual wall, the movable electronic device is controlled to pass through the virtual wall in a preset path.
作为上述实施例的改进,将采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像后还包括步骤:As an improvement of the above embodiment, after the captured image is projected onto the photosensitive surface of the image sensor provided in the movable electronic device to form a target image, the method further includes the following steps:
对所述目标图像进行透镜变形的矫正。Correction of lens deformation is performed on the target image.
本发明实施例还对应提供了一种地图构建方法,包括步骤:The embodiment of the invention further provides a map construction method, which comprises the steps of:
以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系,在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向,从而实时获取所述可移动电子设备在所述坐标系中的坐标值;Constructing a coordinate system with any position or specific position in the to-be-positioned area as a coordinate origin, and calculating a displacement of the movable electronic device relative to the coordinate origin in a real-time process in which the movable electronic device traverses the to-be-positioned area And a direction to acquire coordinate values of the movable electronic device in the coordinate system in real time;
采用如上述任一项所述的基于机器视觉的虚拟墙构建方法构建地图;Constructing a map using a machine vision-based virtual wall construction method as described in any of the above;
根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的坐标平面,对所述待定位区域进行实时地图构建。Real-time map construction is performed on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
作为上述实施例的改进,所述根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建包括:As a modification of the above embodiment, the real-time map construction of the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall includes:
基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算并记录所述可移动电子设备每一次检测到障碍物时的障碍物位置的坐标值;Calculating and recording a coordinate value of an obstacle position when the movable electronic device detects an obstacle each time based on a moving direction and a moving distance of the movable electronic device with respect to the starting point;
基于所述虚拟墙的坐标平面和每一所述障碍物位置的坐标值,对所述待定位区域进行实时地图构建。Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
作为上述实施例的改进,所述待定位区域上设有至少两个定位标签,每一个定位标签对应设置在所述待定位区域的特定位置上,每一所述定位标签信息包括用于区别其绝对位置的唯一编码信息;则所述根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建还包括:As a modification of the above embodiment, at least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed at a specific position of the to-be-positioned area, and each of the positioning tag information includes The uniquely encoded information of the absolute position; the real-time map construction of the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall further includes:
在遍历过程中,基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算所述可移动电子设备每一次获取到的定位标签信息时的定位标签的位置的坐标值,并记录定位标签信息及对应的坐标值;Calculating, according to the moving direction and the moving distance of the movable electronic device with respect to the starting point, a coordinate value of a position of the positioning tag when the positioning tag information acquired by the movable electronic device is acquired, and Recording positioning tag information and corresponding coordinate values;
基于所述虚拟墙的坐标平面、每一所述障碍物位置的坐标值以及每一所述定位标签的信息及其坐标值,对 所述待定位区域进行实时地图构建。And based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof, The to-be-positioned area performs real-time map construction.
作为上述实施例的改进,所述方法还包括步骤:As a modification of the above embodiment, the method further comprises the steps of:
根据所述目标图像的透视变形,计算所述可移动电子设备偏离所述虚拟墙中线的距离;Calculating, according to a perspective deformation of the target image, a distance of the movable electronic device from a center line of the virtual wall;
根据所述可移动电子设备偏离所述虚拟墙的中线的距离,使所述可移动电子设备沿着与所述虚拟墙平行的轨迹返回所述虚拟墙的中线上。The movable electronic device is returned to a center line of the virtual wall along a trajectory parallel to the virtual wall according to a distance of the movable electronic device from a center line of the virtual wall.
作为上述实施例的改进,所述可移动电子设备包括主动轮和从动轮,所述方法还包括步骤:As a modification of the above embodiment, the removable electronic device includes a driving wheel and a driven wheel, and the method further includes the steps of:
在所述可移动电子设备沿任意直线行进过程中,当任意时刻检测到所述可移动电子设备的主动轮的速度与从动轮的速度不一致时,以所述主动轮的速度和所述从动轮的速度中的较小值作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the traveling of the movable electronic device along an arbitrary straight line, when the speed of the driving wheel of the movable electronic device is detected to be inconsistent with the speed of the driven wheel at any time, the speed of the driving wheel and the driven wheel The smaller of the speeds is used as the reference speed, and the displacement and direction of the movable electronic device relative to the coordinate origin are calculated according to the reference speed;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度小于理论速度时,以所述从动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the turning of the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be less than the theoretical speed at any time, the speed of the driven wheel is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度大于所述理论速度时,以所述主动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;所述理论速度根据所述主动轮的速度计算得到。In the process of turning the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be greater than the theoretical speed at any time, the speed of the driving wheel is used as a reference speed And calculating, according to the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin; the theoretical speed is calculated according to a speed of the driving wheel.
本发明实施例还对应提供了一种基于机器视觉的虚拟墙构建装置,所述基于机器视觉的虚拟墙构建装置设于可移动电子设备,包括:The embodiment of the present invention further provides a virtual machine building device based on machine vision. The virtual machine building device based on machine vision is disposed on the mobile electronic device, and includes:
摄像头,用于在所述可移动电子设备遍历待定位区域的过程中,以预设的频率实时采集周围环境的图像;a camera for collecting an image of the surrounding environment in real time at a preset frequency during the traversing of the area to be located by the movable electronic device;
图像传感器,用于接收每一时刻采集到的图像在所述图像传感器的光敏面上投影形成目标图像;An image sensor for receiving an image acquired at each moment on a photosensitive surface of the image sensor to form a target image;
存储设备,用于预存多个标记图案;a storage device for pre-storing a plurality of mark patterns;
控制器,用于根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙;所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2。a controller, configured to acquire, according to a preset image matching algorithm, an image of the target image on the photosensitive surface when the target image acquired at any time matches any of the marking patterns in the mark pattern library a key point; calculating a distance between the virtual wall and the movable electronic device based on a key point of the target image on the photosensitive surface, according to a distance between the virtual wall and the movable electronic device, Constructing the virtual wall with a characteristic straight line at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the characteristic line and The virtual wall is constructed on a surface perpendicular to the photosensitive surface; the key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2.
作为上述实施例的改进,所述控制器还用于响应于标定指令,通过所述摄像头获取当前时刻所述可移动电子设备正上方的图像,并存储至所述标记图案库中作为新的标记图案;通过所述图像匹配算法获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。As a modification of the above embodiment, the controller is further configured to acquire, by the camera, an image directly above the movable electronic device by the camera in response to the calibration instruction, and store the image in the mark pattern library as a new mark. a pattern; acquiring, by the image matching algorithm, a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
作为上述实施例的改进,根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,所述控制器获取所述目标图像在所述光敏面上的x个关键点具体为:As a modification of the above embodiment, according to a preset image matching algorithm, when the target image acquired at any time matches any of the mark patterns in the mark pattern library, the controller acquires the target image in the The x key points on the photosensitive surface are as follows:
通过所述图像匹配算法获取所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;Obtaining, by the image matching algorithm, a plurality of feature points of the target image and a feature descriptor corresponding to each of the feature points;
通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;Obtaining a feature point of the matching relationship between the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when acquiring When the number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
根据所述目标图像上具有匹配关系的特征点的位置关系,以其中ax个位于同一直线上的特征点作为关键点。According to the positional relationship of the feature points having the matching relationship on the target image, the feature points in which a x are located on the same straight line are taken as key points.
作为上述实施例的改进,所述图像匹配算法为尺度不变特征变换算法或加速稳健特征算法,所述标记图案/目标图像的每一特征描述子通过控制器采用以下步骤获取:As an improvement of the above embodiment, the image matching algorithm is a scale-invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature descriptor of the mark pattern/target image is obtained by the controller by using the following steps:
通过高斯模糊建立标记图像/目标图像的尺度空间,通过高斯微分函数识别所述标记图像/目标图像的尺度空间中的极值点,对所述标记图像/目标图像的尺度空间中的极值点进行校验,去除所述标记图像/目标图像的尺度空间中的不稳定极值点,从而获得所述标记图像/目标图像的特征点及所述特征点的尺度和位置;The scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Performing a check to remove an unstable extreme point in the scale space of the mark image/target image, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
根据所述特征点的邻域像素的梯度方向分布特性,为每一所述特征点赋予方向;And assigning a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of the feature point;
根据所述特征点的尺度、位置和方向,通过对所述特征点的周围图像进行区域分块,计算块内梯度直方图,从而生成所述特征点的特征描述子。 According to the scale, position and direction of the feature point, the intra-block gradient histogram is calculated by performing area segmentation on the surrounding image of the feature point, thereby generating a feature descriptor of the feature point.
作为上述实施例的改进,所述摄像头还包括成像透镜,通过摄像头采集到的图像通过成像透镜投影至所述图像传感器的光敏面;所述虚拟墙与所述可移动电子设备的距离通过三角测距法计算得到。As a modification of the above embodiment, the camera further includes an imaging lens, and an image captured by the camera is projected to the photosensitive surface of the image sensor through the imaging lens; the distance between the virtual wall and the movable electronic device is triangulated Calculated by the distance method.
作为上述实施例的改进,所述控制器基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离具体为:As a modification of the above embodiment, the controller calculates the distance between the virtual wall and the movable electronic device based on the key point of the target image on the photosensitive surface:
通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:The distance between the virtual wall and the removable electronic device is calculated by the following formula:
通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:The distance between the virtual wall and the removable electronic device is calculated by the following formula:
D=a/b*S*|cosθ|D=a/b*S*|cosθ|
其中,a为所述虚拟墙的上边框到所述光敏面的距离,b为所述成像透镜和所述光敏面的距离,S为所述特征直线和所述光敏面的中心点的距离,D为所述虚拟墙和所述光敏面的中心点的距离,θ为所述预设夹角。Where a is the distance from the upper border of the virtual wall to the photosensitive surface, b is the distance between the imaging lens and the photosensitive surface, and S is the distance between the characteristic straight line and the center point of the photosensitive surface, D is a distance between the virtual wall and a center point of the photosensitive surface, and θ is the preset angle.
作为上述实施例的改进,所述控制器基于以下公式计算所述虚拟墙的宽度:As a modification of the above embodiment, the controller calculates the width of the virtual wall based on the following formula:
Figure PCTCN2017116015-appb-000002
Figure PCTCN2017116015-appb-000002
其中,W为所述虚拟墙的宽度,a为所述虚拟墙的上边框到所述光敏面的距离,λ为所述摄像头的广角。Where W is the width of the virtual wall, a is the distance from the upper border of the virtual wall to the photosensitive surface, and λ is the wide angle of the camera.
作为上述实施例的改进,所述图像传感器包括PSD传感器、CCD传感器或CMOS传感器。As a modification of the above embodiment, the image sensor includes a PSD sensor, a CCD sensor, or a CMOS sensor.
作为上述实施例的改进,当所述虚拟墙与所述可移动电子设备的距离小于预设的距离时,所述控制器还用于通过预设的避开策略移动所述可移动电子设备以使得所述可移动电子设备与所述虚拟墙的距离增大。As a modification of the foregoing embodiment, when the distance between the virtual wall and the mobile electronic device is less than a preset distance, the controller is further configured to move the mobile electronic device by using a preset avoidance policy. The distance of the mobile electronic device from the virtual wall is increased.
作为上述实施例的改进,所述控制器还用于在构建所述虚拟墙后,控制所述可移动电子设备以预设的路径穿过所述虚拟墙。As a modification of the above embodiment, the controller is further configured to control the movable electronic device to pass through the virtual wall in a preset path after constructing the virtual wall.
作为上述实施例的改进,将采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像后,所述控制器还用于对所述目标图像进行透视变形的矫正。As an improvement of the above embodiment, after the captured image is projected onto the photosensitive surface of the image sensor provided in the movable electronic device to form a target image, the controller is further configured to perform perspective distortion on the target image. Correction.
本发明实施例还对应提供了一种可移动电子设备,包括:The embodiment of the invention further provides a removable electronic device, including:
如上述任一项所述的基于机器视觉的虚拟墙构建装置,用于构建虚拟墙;A machine vision-based virtual wall building device according to any of the preceding claims, for constructing a virtual wall;
所述控制器还用于以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系;The controller is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
编码器,用于在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向;An encoder, configured to calculate, in real time, a displacement and a direction of the movable electronic device relative to the coordinate origin in a process in which the movable electronic device traverses the to-be-positioned area;
所述控制器还用于接收所述编码器发送的所述可移动电子设备相对所述坐标原点的位移和方向,获取任意时刻所述可移动电子设备在所述坐标系中的坐标值;The controller is further configured to receive a displacement and a direction of the movable electronic device sent by the encoder with respect to the coordinate origin, and acquire coordinate values of the movable electronic device in the coordinate system at any time;
所述控制器还用于根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的坐标平面,对所述待定位区域进行实时地图构建。The controller is further configured to perform real-time map construction on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
作为上述实施例的改进,还包括碰撞传感器、激光传感器或红外传感器,当利用碰撞传感器感测到障碍物时,所述控制器基于所述可移动电子设备相对所述起始点的移动方向和移动距离,将所述可移动电子设备当前位置的坐标值作为所述障碍物位置的坐标值;As a modification of the above embodiment, further comprising a collision sensor, a laser sensor or an infrared sensor, the controller is based on a moving direction and movement of the movable electronic device relative to the starting point when an obstacle is sensed by the collision sensor a distance, a coordinate value of a current position of the movable electronic device as a coordinate value of the obstacle position;
当利用激光传感器/红外传感器来探测到障碍物时,所述控制器根据激光/红外距离计算原理计算出障碍物相对当前所述可移动电子设备的位置,从而根据当前时刻所述可移动电子设备相对所述起始点的移动方向和移动距离,计算得到当前时刻所述障碍物的坐标值;When the obstacle is detected by the laser sensor/infrared sensor, the controller calculates the position of the obstacle relative to the currently movable electronic device according to the laser/infrared distance calculation principle, so that the movable electronic device according to the current moment Calculating a coordinate value of the obstacle at the current time relative to a moving direction and a moving distance of the starting point;
所述控制器用于基于所述虚拟墙的坐标平面和每一所述障碍物位置的坐标值,对所述待定位区域进行实时地图构建。The controller is configured to perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
作为上述实施例的改进,所述待定位区域上设有至少两个定位标签,每一个定位标签对应设置在所述待定位区域的特定位置上,每一所述定位标签信息包括用于区别其绝对位置的唯一编码信息;所述控制器根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建包括:As a modification of the above embodiment, at least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed at a specific position of the to-be-positioned area, and each of the positioning tag information includes The unique coding information of the absolute position; the real-time map construction of the to-be-positioned area by the controller according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall includes:
在遍历过程中,基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算所述可移动电子设备每一次获取到的定位标签信息时的定位标签的位置的坐标值,并记录定位标签信息及对应的坐标值;Calculating, according to the moving direction and the moving distance of the movable electronic device with respect to the starting point, a coordinate value of a position of the positioning tag when the positioning tag information acquired by the movable electronic device is acquired, and Recording positioning tag information and corresponding coordinate values;
基于所述虚拟墙的坐标平面、每一所述障碍物位置的坐标值以及每一所述定位标签的信息及其坐标值,对所述待定位区域进行实时地图构建。 Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
作为上述实施例的改进,所述控制器还用于根据所述目标图像的透视变形,计算所述可移动电子设备偏离所述虚拟墙中线的距离;根据所述可移动电子设备偏离所述虚拟墙的中线的距离,使所述可移动电子设备沿着与所述虚拟墙平行的轨迹返回所述虚拟墙的中线上。As a modification of the above embodiment, the controller is further configured to calculate, according to the perspective deformation of the target image, a distance of the movable electronic device from the center line of the virtual wall; according to the movable electronic device deviating from the virtual The distance from the centerline of the wall causes the moveable electronic device to return to the centerline of the virtual wall along a trajectory parallel to the virtual wall.
作为上述实施例的改进,所述可移动电子设备包括主动轮和从动轮,所述控制器还用于,在所述可移动电子设备沿任意直线行进过程中,当任意时刻检测到所述可移动电子设备的主动轮的速度与从动轮的速度不一致时,以所述主动轮的速度和所述从动轮的速度中的较小值作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;As a modification of the above embodiment, the movable electronic device includes a driving wheel and a driven wheel, and the controller is further configured to detect the detachable time when the movable electronic device travels along any straight line When the speed of the driving wheel of the mobile electronic device is inconsistent with the speed of the driven wheel, the smaller value of the speed of the driving wheel and the speed of the driven wheel is used as a reference speed, and the movable electronic is calculated according to the reference speed. The displacement and direction of the device relative to the origin of the coordinate;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度小于理论速度时,以所述从动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the turning of the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be less than the theoretical speed at any time, the speed of the driven wheel is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度大于所述理论速度时,以所述主动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;所述理论速度根据所述主动轮的速度计算得到。In the process of turning the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be greater than the theoretical speed at any time, the speed of the driving wheel is used as a reference speed And calculating, according to the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin; the theoretical speed is calculated according to a speed of the driving wheel.
与现有技术相比,本发明实施例提供了一种基于机器视觉的虚拟墙构建方法及装置、地图构建方法、可移动电子设备,通过对实时获取的图像进行匹配运算,当匹配成功时,选取该图像上的特定特征点作为关键点,根据该关键点计算虚拟墙相对所述可移动电子设备的位置,自动构建虚拟墙,即可准确构建划分可进入区域和禁止进入区域的分界线,这种明显的分界线可完全禁止可移动电子设备进入禁止进入区域,具有简单实用、可靠性强的优点;此外,本实施例中方案无需额外的交互设备进行虚拟墙的设置,也无需在特定位置设置定位标签等,智能程度更高。Compared with the prior art, the embodiment of the present invention provides a virtual wall construction method and device based on machine vision, a map construction method, and a mobile electronic device. When a matching operation is performed on an image acquired in real time, when the matching is successful, Selecting a specific feature point on the image as a key point, calculating a position of the virtual wall relative to the movable electronic device according to the key point, and automatically constructing a virtual wall, thereby accurately constructing a dividing line dividing the accessible area and the forbidden entering area, The obvious dividing line can completely prohibit the movable electronic device from entering the forbidden entry area, and has the advantages of simple practicality and high reliability; in addition, the solution in this embodiment does not require additional interactive devices for setting the virtual wall, and does not need to be specific. Position setting tabs, etc., more intelligent.
附图说明DRAWINGS
图1是本发明实施例1提供的一种基于机器视觉的虚拟墙构建方法的流程示意图;1 is a schematic flow chart of a method for constructing a virtual wall based on machine vision according to Embodiment 1 of the present invention;
图2是本发明实施例1中计算虚拟墙和光敏面的中心之间的距离示意图;2 is a schematic view showing a distance between a virtual wall and a center of a photosensitive surface in Embodiment 1 of the present invention;
图3是本发明实施例1中相对图2的另一种虚拟墙与可移动电子设备之间的位置关系示意图;3 is a schematic diagram showing a positional relationship between another virtual wall and a mobile electronic device of FIG. 2 according to Embodiment 1 of the present invention;
图4是本发明实施例1中另一种计算虚拟墙和光敏面的中心之间的距离示意图;4 is a schematic diagram showing another distance between a virtual wall and a center of a photosensitive surface in Embodiment 1 of the present invention;
图5是与图4相应的光敏面的中心和虚拟墙的俯视图;Figure 5 is a plan view of the center of the photosensitive surface corresponding to Figure 4 and the virtual wall;
图6是本发明实施例1中计算虚拟墙和可移动电子设备之间的距离示意图;6 is a schematic diagram of calculating a distance between a virtual wall and a removable electronic device in Embodiment 1 of the present invention;
图7是本发明实施例1提供的计算所述虚拟墙宽度的示意图;FIG. 7 is a schematic diagram of calculating the width of the virtual wall according to Embodiment 1 of the present invention; FIG.
图8是本发明实施例2提供的一种基于机器视觉的虚拟墙构建方法的流程示意图;8 is a schematic flow chart of a method for constructing a virtual wall based on machine vision according to Embodiment 2 of the present invention;
图9是本发明实施例2中标记图案的标定示意图;Figure 9 is a schematic view showing the calibration of the marking pattern in the second embodiment of the present invention;
图10是本发明实施例2中计算标记图案/目标图像的每一特征描述子的流程示意图;10 is a schematic flow chart of calculating each feature descriptor of a mark pattern/target image in Embodiment 2 of the present invention;
图11是本发明实施例3提供的一种基于机器视觉的虚拟墙构建方法的流程示意图;11 is a schematic flow chart of a method for constructing a virtual wall based on machine vision according to Embodiment 3 of the present invention;
图12是本发明实施例4提供的一种基于机器视觉的虚拟墙构建方法的流程;12 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 4 of the present invention;
图13是本发明实施例5提供的一种地图构建方法的流程示意图;FIG. 13 is a schematic flowchart diagram of a map construction method according to Embodiment 5 of the present invention; FIG.
图14是本发明实施例6提供的一种地图构建方法的流程示意图;14 is a schematic flowchart diagram of a map construction method according to Embodiment 6 of the present invention;
图15是本发明实施例7提供的一种地图构建方法的流程示意图;15 is a schematic flowchart of a map construction method according to Embodiment 7 of the present invention;
图16是本发明实施例7中可移动电子设备转弯的示意图;16 is a schematic diagram of turning of a mobile electronic device in Embodiment 7 of the present invention;
图17是本发明实施例8提供的一种基于机器视觉的虚拟墙构建装置的结构示意图;17 is a schematic structural diagram of a virtual machine building device based on machine vision according to Embodiment 8 of the present invention;
图18是本发明实施例9提供的一种可移动电子设备的结构示意图;18 is a schematic structural diagram of a mobile electronic device according to Embodiment 9 of the present invention;
图19是本发明实施例10提供的一种可移动电子设备的结构示意图。FIG. 19 is a schematic structural diagram of a mobile electronic device according to Embodiment 10 of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
参见图1,是本发明实施例1提供的一种基于机器视觉的虚拟墙构建方法的流程示意图,包括步骤:1 is a schematic flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 1 of the present invention, including the steps:
S11、在所述可移动电子设备遍历待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;S11. During the traversing of the to-be-positioned area, the camera disposed on the movable electronic device captures an image of the surrounding environment in a real-time manner at a preset frequency, and images the image captured at each moment. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
在该步骤中,通过自然光照下,物体表面产生漫反射,反射光经成像透镜聚焦,从而在所述图像传感器的光敏面上形成投影的目标图像。与传统的激光三角测距相比,无需通过激光器先发射激光再入射到目标物体上, 也无需构建一个基准面,仅需自然光下物体(如门框)的漫反射即可进行测距,提高测距精度的同时降低成本。In this step, diffuse reflection is generated on the surface of the object by natural illumination, and the reflected light is focused by an imaging lens to form a projected target image on the photosensitive surface of the image sensor. Compared with the traditional laser triangulation, it is not necessary to use the laser to first emit laser light and then enter the target object. There is no need to construct a datum surface, and only the diffuse reflection of an object under natural light (such as a door frame) can be used for ranging, thereby improving the accuracy of ranging and reducing the cost.
其中,所述图像传感器包括PSD传感器、CCD传感器或CMOS传感器。Wherein, the image sensor comprises a PSD sensor, a CCD sensor or a CMOS sensor.
S12、根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;其中,所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2;S12. Acquire, according to a preset image matching algorithm, when the target image acquired at any time matches any of the marking patterns in the mark pattern library, obtain x key points of the target image on the photosensitive surface. Wherein the key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2;
标记图案库中的标记图案需预先存储入所述可移动电子设备的存储器中,其中一种方式具体为,当接收到预存标记指令,读取输入的图片(例如矢量图),并将其存储入所述标记图案库中作为后续虚拟墙识别使用。另外,每一标记图案上需定义虚拟墙的特征直线或关键点,可通过两种方式实现:一种为在预存的图片上加入特征直线信息或关键点信息,再导入所述可移动电子设备中;另一种为响应于定义特征直线或关键点指令,根据用户输入的定义操作,对已导入的图片进行特征直线或关键点定义的操作。The mark pattern in the mark pattern library needs to be pre-stored in the memory of the removable electronic device, wherein one way is specifically, when the pre-stored mark instruction is received, the input picture (such as a vector diagram) is read and stored. It is used in the mark pattern library as a subsequent virtual wall recognition. In addition, each feature pattern needs to define a characteristic line or a key point of the virtual wall, which can be implemented in two ways: one is to add characteristic line information or key point information to the pre-stored picture, and then import the movable electronic device. The other is to perform the operation of defining the feature line or key point on the imported picture in response to the defined feature line or key point instruction according to the definition operation of the user input.
优选地,本发明实施例可通过以下方式导入标记图案,具体为:响应于标定指令,获取当前时刻所述可移动电子设备正上方的图像,并存储至所述标记图案库中作为新的标记图案。Preferably, the embodiment of the present invention may import the mark pattern by: acquiring an image directly above the movable electronic device at the current time in response to the calibration instruction, and storing the image in the mark pattern library as a new mark. pattern.
需要说明的是,图像的匹配时通过特征点的特征向量的匹配进行的。当获取到新的标记图案时,需先对标记图案进行预处理和特征点提取后获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。图像特征提取是图像分析与图像识别的前提,它是将高维的图像数据进行简化表达最有效的方式。It should be noted that the matching of the images is performed by matching the feature vectors of the feature points. When a new mark pattern is acquired, the mark pattern is pre-processed and the feature points are extracted to obtain a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points. Image feature extraction is the premise of image analysis and image recognition. It is the most effective way to simplify the expression of high-dimensional image data.
基于上述标定过程,对应的关键点可优选为通过以下两种方式确定:一种为在所述标记图案上显示生成的若干所述特征点,根据用户对若干所述特征点的选择指令,完成对所述标记图案的关键点定义;另一种具体为,在生成所述标记图案的若干个特征点后,系统通过预设的算法对若干个所述特征点进行选择,完成对所述标记图案的关键点的定义。Based on the above calibration process, the corresponding key points may be preferably determined by the following two methods: one is to display a plurality of the feature points generated on the mark pattern, and is completed according to a user's selection instruction for a plurality of the feature points. The key point definition of the mark pattern; another specifically, after generating a plurality of feature points of the mark pattern, the system selects a plurality of the feature points by a preset algorithm to complete the mark The definition of the key points of the pattern.
S13、基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙。S13. Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and The virtual wall is constructed on a surface perpendicular to the photosensitive surface.
在步骤S3中,先利用所述图像匹配算法对目标图像进行特征提取获得特征点后,再选取特定特征点作为关键点进行虚拟墙的映射。需要说明的是,所述预设夹角为待构建虚拟墙和所述特征直线之间的夹角,其与所述关键点的选取密切相关。In step S3, the image matching algorithm is used to perform feature extraction on the target image to obtain feature points, and then the specific feature points are selected as key points for mapping the virtual wall. It should be noted that the preset angle is an angle between the virtual wall to be constructed and the characteristic straight line, which is closely related to the selection of the key points.
需要说明的是,计算待构建虚拟墙距离所述可移动电子设备的距离可采用激光对焦或相位对焦的方式,也可采用相位式激光测距、脉冲式激光测距和三角法激光测距。优选地,本方案采用三角测距法,与传统三角法激光测距相比,无需通过激光器先发射激光到目标物体和基准面上,再通过目标物体的反射和基准面的反射图像计算目标物体和基准面的距离,因此也无需构建一个基准面,仅需自然光下物体的漫反射即可进行测距,具有结构简单、精度高、速度快和使用灵活的优点,而且进一步降低生产成本。It should be noted that the distance between the virtual wall to be constructed and the movable electronic device may be calculated by using laser focusing or phase focusing, and phase laser ranging, pulse laser ranging, and triangulation laser ranging may also be used. Preferably, the scheme adopts a triangulation method, and compared with the traditional triangulation laser ranging, the laser does not need to first transmit laser light to the target object and the reference surface, and then the target object is calculated by the reflection of the target object and the reflection image of the reference surface. The distance from the reference plane, so there is no need to construct a reference plane, and only the diffuse reflection of the object under natural light can be used for ranging, which has the advantages of simple structure, high precision, high speed and flexible use, and further reduces the production cost.
在步骤S4中,若所述预设夹角等于0°或180°时,则默认所述待构建虚拟墙与特征直线平行。In step S4, if the preset angle is equal to 0° or 180°, then the virtual wall to be constructed is in parallel with the feature line by default.
根据三角测距原理,通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:According to the principle of triangulation, the distance between the virtual wall and the movable electronic device is calculated by the following formula:
D=a/b*S*|cosθ|D=a/b*S*|cosθ|
其中,a为所述虚拟墙的上边框到所述光敏面的距离,b为所述成像透镜和所述光敏面的距离,S为所述特征直线和所述光敏面的中心点的距离,D为所述虚拟墙和所述光敏面的中心点的距离,θ为所述预设夹角。Where a is the distance from the upper border of the virtual wall to the photosensitive surface, b is the distance between the imaging lens and the photosensitive surface, and S is the distance between the characteristic straight line and the center point of the photosensitive surface, D is a distance between the virtual wall and a center point of the photosensitive surface, and θ is the preset angle.
如图2所示,当θ=0°或180°时,|cos 0°|=|cos 180°|=1,即待构建虚拟墙和所述特征直线平行时,可通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:As shown in FIG. 2, when θ=0° or 180°, |cos 0°|=|cos 180°|=1, that is, when the virtual wall to be constructed and the characteristic line are parallel, the following formula can be calculated. The distance between the virtual wall and the removable electronic device:
D=a/b*SD=a/b*S
其中,a为所述虚拟墙100的上边框400到所述光敏面301的距离,b为所述成像透镜303和所述光敏面301的距离,S为所述特征直线304和所述光敏面301的中心点302的距离,D为所述虚拟墙100和所述光敏面301的中心点302的距离。其中,图2为所述可移动电子设备正对于虚拟墙的情况,而图3为所述可移动电子设备相对于虚拟墙向右偏移的情况,可以理解的是,在可移动电子设备相对于虚拟墙的任何方向(包括正对、背对、左向偏移和右向偏移),只要摄像头检测到特定数量的匹配特征点,均可基于特征点的位置选取合理的关键点构建准确位置的虚拟墙。Where a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301, b is the distance between the imaging lens 303 and the photosensitive surface 301, and S is the characteristic line 304 and the photosensitive surface The distance from the center point 302 of 301, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301. 2 is a case where the movable electronic device is facing the virtual wall, and FIG. 3 is a case where the movable electronic device is shifted to the right with respect to the virtual wall. It can be understood that the movable electronic device is relatively In any direction of the virtual wall (including front, back, left and right offset), as long as the camera detects a certain number of matching feature points, it can accurately construct a reasonable key based on the position of the feature points. The virtual wall of the location.
如图4所示,当所述预设夹角不等于0°或180°时,通过以下公式计算所述虚拟墙与所述可移动电子设备的距离: As shown in FIG. 4, when the preset angle is not equal to 0° or 180°, the distance between the virtual wall and the movable electronic device is calculated by the following formula:
D=a/b*S*|cosθ|D=a/b*S*|cosθ|
其中,a为所述虚拟墙100的上边框400到所述光敏面301的距离,b为所述成像透镜303和所述光敏面301的距离,S为所述特征直线304和所述光敏面301的中心点302的距离,D为所述虚拟墙100和所述光敏面301的中心点302的距离,θ为所述预设夹角;如图4所示,房间的天花板500上存在一条映射直线402,其通过成像透镜303在所述光敏面301上投影生成所述特征直线304;可以理解的h=a/b*S为光敏面301的中心点302与所述映射直线402所在的平面401的距离,结合图5可知,D=h*|cosθ|。Where a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301, b is the distance between the imaging lens 303 and the photosensitive surface 301, and S is the characteristic line 304 and the photosensitive surface The distance from the center point 302 of 301, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301, and θ is the preset angle; as shown in FIG. 4, there is a ceiling on the ceiling 500 of the room. A mapping line 402 is projected onto the photosensitive surface 301 by the imaging lens 303 to generate the characteristic line 304; it is understood that h=a/b*S is the center point 302 of the photosensitive surface 301 and the mapping line 402 is located The distance of the plane 401, as shown in Fig. 5, is D = h * | cos θ |.
需要说明的是,在本发明实施例中,所述虚拟墙100和所述光敏面301的中心点302的距离D作为所述虚拟墙100与所述可移动电子设备的距离。而在另一优选实施例中,如图7所示,假设所述可移动电子设备300为规则的圆形,可定义所述虚拟墙100与所述可移动电子设备300的距离为所述可移动电子300的中心点305到所述虚拟墙100的距离;具体的,当所述可移动电子设备300正对所述虚拟墙100时,所述虚拟墙100与所述可移动电子设备300的距离为所述虚拟墙100和所述光敏面301的中心点302的距离与所述可移动电子设备300的中心点305和所述光敏面301的中心点302的距离的和,即L=D+D’,其中,L所述虚拟墙100与所述可移动电子设备300的距离,D为所述虚拟墙100和所述光敏面301的中心点302的距离,D’为所述可移动电子设备300的中心点305和所述光敏面301的中心点302的距离。可以理解的,上述公式除了适用于所述可移动电子设备为圆形的情况外,还适用于所述可移动电子设备为其他规则形状的情况,在此不再赘述。It should be noted that, in the embodiment of the present invention, the distance D between the virtual wall 100 and the center point 302 of the photosensitive surface 301 is the distance between the virtual wall 100 and the movable electronic device. In another preferred embodiment, as shown in FIG. 7, assuming that the removable electronic device 300 is a regular circle, the distance between the virtual wall 100 and the removable electronic device 300 can be defined as The distance from the center point 305 of the mobile electronic 300 to the virtual wall 100; specifically, when the removable electronic device 300 faces the virtual wall 100, the virtual wall 100 and the removable electronic device 300 The distance is the sum of the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301 and the distance between the center point 305 of the movable electronic device 300 and the center point 302 of the photosensitive surface 301, that is, L=D +D', wherein L is the distance between the virtual wall 100 and the movable electronic device 300, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301, and D' is the movable The distance between the center point 305 of the electronic device 300 and the center point 302 of the photosensitive surface 301. It is to be understood that the above formula is applicable to the case where the movable electronic device is in a regular shape, and is not described herein.
在本发明实施例中,所述虚拟墙的上边框到所述光敏面的距离指代房间的天花板到所述光敏面的距离,或指代房门的上边框到所述光敏面的距离,其具体数值可在系统中进行预先设置。In the embodiment of the present invention, the distance from the upper border of the virtual wall to the photosensitive surface refers to the distance from the ceiling of the room to the photosensitive surface, or the distance from the upper border of the door to the photosensitive surface. The specific value can be preset in the system.
除了可计算虚拟墙的位置信息外,还可通过以下步骤计算虚拟墙的宽度信息,具体为结合图7通过以下公式计算所述虚拟墙的宽度:In addition to calculating the position information of the virtual wall, the width information of the virtual wall can be calculated by the following steps, specifically calculating the width of the virtual wall by using the following formula:
Figure PCTCN2017116015-appb-000003
Figure PCTCN2017116015-appb-000003
其中,W为所述虚拟墙100的宽度,a为所述虚拟墙100的上边框到所述光敏面301的距离,λ为所述摄像头的广角。Where W is the width of the virtual wall 100, a is the distance from the upper border of the virtual wall 100 to the photosensitive surface 301, and λ is the wide angle of the camera.
而本实施例通过直接获取需要构建虚拟墙的位置图像,采用预设图像匹配算法对该图片进行预处理和特征提取后,再对实时获取的图片进行匹配运算,当匹配成功时,选取该图片上的特定特征点作为关键点,根据该关键点计算虚拟墙相对所述可移动电子设备的位置,自动构建虚拟墙,即可准确构建划分可进入区域和禁止进入区域的分界线,这种明显的分界线可完全禁止可移动电子设备进入禁止进入区域,具有简单实用、可靠性强的优点;此外,本实施例中方案无需额外的交互设备进行虚拟墙的设置,也无需在特定位置设置定位标签等,智能程度更高。In this embodiment, the location image of the virtual wall needs to be directly acquired, and the image is pre-processed and extracted by using a preset image matching algorithm, and then the matching image is performed on the real-time acquired image. When the matching is successful, the image is selected. The specific feature point is used as a key point, and the position of the virtual wall relative to the movable electronic device is calculated according to the key point, and the virtual wall is automatically constructed, so that the boundary line between the partitionable entry area and the forbidden entry area can be accurately constructed. The dividing line can completely prohibit the movable electronic device from entering the forbidden entry area, and has the advantages of simple practicality and high reliability; in addition, the solution in this embodiment does not require additional interactive devices for setting the virtual wall, and there is no need to set the positioning at a specific location. Labels, etc., are more intelligent.
参见图8,为本发明实施例2提供的一种基于机器视觉的虚拟墙构建方法的流程图,包括步骤:FIG. 8 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 2 of the present invention, including the steps of:
S21、在所述可移动电子设备遍历待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;S21, in the process of traversing the to-be-positioned area of the mobile electronic device, capturing, by using a camera disposed on the movable electronic device, an image of a surrounding environment in real time at a preset frequency, and projecting an image captured at each moment Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
S22、通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;S22. Obtain, by the image matching algorithm, a plurality of feature points of the target image at the current moment and a feature descriptor corresponding to each of the feature points;
S23、通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;S23. Obtain a feature point of each feature descriptor of the target image and each feature descriptor of the mark pattern, and acquire a feature point that has a matching relationship between the target image and the mark pattern. When the obtained number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
优选地,本发明实施例可通过以下方式导入标记图案,具体为:响应于标定指令,获取当前时刻所述可移动电子设备正上方的图像,并存储至所述标记图案库中作为新的标记图案。Preferably, the embodiment of the present invention may import the mark pattern by: acquiring an image directly above the movable electronic device at the current time in response to the calibration instruction, and storing the image in the mark pattern library as a new mark. pattern.
需要说明的是,图像的匹配时通过特征点的特征向量的匹配进行的。当获取到新的标记图案时,需先对标记图案进行预处理和特征点提取后获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。It should be noted that the matching of the images is performed by matching the feature vectors of the feature points. When a new mark pattern is acquired, the mark pattern is pre-processed and the feature points are extracted to obtain a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
S24、根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点;x≥2;S24, according to the positional relationship of the feature points having the matching relationship on the target image, where the feature points on the same straight line are taken as the key points; x≥2;
根据图像识别的生物特性,人们的视线总是集中在图像的主要特征上,也就是集中在图像轮廓曲度最大或轮廓方向突然改变的地方,这些地方的信息量最大。由此可见,图像识别过程中,必须排除输入的多余信息,抽出关键的信息,这就涉及到特征提取问题。例如,摄取可移动电子设备正上方的门框图像,提取到的特征点可位于门框的边缘。 According to the biological characteristics of image recognition, people's line of sight is always concentrated on the main features of the image, that is, where the contour of the image is the largest or the direction of the outline changes abruptly, and the amount of information in these places is the largest. It can be seen that in the image recognition process, the redundant information input must be excluded, and the key information is extracted, which involves the feature extraction problem. For example, taking a door frame image directly above the removable electronic device, the extracted feature points may be located at the edge of the door frame.
例如,在标记图案的标定过程中,先将可移动电子设备置于房门上边框的正下方,可按下标定按钮(该标定按钮可设于可移动电子设备上,也可设于遥控器)或点击第三交互终端(例如手机、平板电脑和PC等)上的标定选项,然后通过摄像头摄取当前时刻的图片,如图9所示,该图片200内包括房门左边框201、房门右边框202、房门上边框203和房间顶部204。通过预设的图像匹配算法对该图片进行特征提取,可获得若干个特征点(x1~x6、y1~y6)。则在可移动电子设备进行遍历过程中,只要获取到包括该门框的图片,通过预设的图像匹配算法计算到匹配特征点的数量大于预设的阈值时,则可认为符合构建虚拟墙的条件。可以理解的,当以x2和x3作为关键点时,则构建的虚拟墙与x2和x3构成的特征直线平行;当以y1和y2作为关键点时,则构建的虚拟墙与y1和y2构成的特征直线呈90度直角。For example, in the calibration process of the marking pattern, the movable electronic device is placed directly below the upper frame of the door, and the calibration button can be pressed (the calibration button can be set on the mobile electronic device or on the remote controller). Or click on the calibration option on the third interactive terminal (such as mobile phone, tablet, PC, etc.), and then take the picture of the current moment through the camera, as shown in FIG. 9, the picture 200 includes the left border 201 of the door, the door Right border 202, door upper border 203 and room top 204. The feature extraction is performed on the image by a preset image matching algorithm, and several feature points (x1 to x6, y1 to y6) are obtained. In the traversing process of the mobile electronic device, if the image including the door frame is obtained, and the number of matching feature points is calculated by the preset image matching algorithm to be greater than a preset threshold, the condition of constructing the virtual wall may be considered as met. . It can be understood that when x2 and x3 are the key points, the constructed virtual wall is parallel with the features formed by x2 and x3; when y1 and y2 are the key points, the constructed virtual wall is composed of y1 and y2. The characteristic line is at a right angle of 90 degrees.
需要说明的是,当提取标记图案的特征点的数量小于某一预设的数量阈值时,则会导致后续识别不成功,无法在特定位置构建虚拟墙。因此,当特征点数量过少时,可提示标定不成功,以提醒用户重新标定或采用其他方式构建虚拟墙。It should be noted that when the number of feature points for extracting the mark pattern is less than a certain preset number threshold, subsequent recognition may be unsuccessful, and the virtual wall may not be constructed at a specific position. Therefore, when the number of feature points is too small, the calibration may be unsuccessful to remind the user to recalibrate or construct the virtual wall in other ways.
S25、基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙。S25. Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and The virtual wall is constructed on a surface perpendicular to the photosensitive surface.
其中,如图10所示,所述图像匹配算法为尺度不变特征变换算法或加速稳健特征算法,所述标记图案/目标图像的每一特征描述子通过以下步骤获取:As shown in FIG. 10, the image matching algorithm is a scale-invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature descriptor of the mark pattern/target image is obtained by the following steps:
S26、通过高斯模糊建立标记图像/目标图像的尺度空间,通过高斯微分函数识别所述标记图像/目标图像的尺度空间中的极值点,对所述标记图像/目标图像的尺度空间中的极值点进行校验,去除所述标记图像/目标图像的尺度空间中的不稳定极值点,从而获得所述标记图像/目标图像的特征点及所述特征点的尺度和位置;S26, establishing a scale space of the marker image/target image by Gaussian blur, and identifying an extreme point in the scale space of the marker image/target image by a Gaussian differential function, and a pole in the scale space of the marker image/target image The value point is verified to remove the unstable extreme point in the scale space of the mark image/target image, thereby obtaining the feature point of the mark image/target image and the scale and position of the feature point;
在步骤S26中,因为在离散的空间中,局部极值点可能并不是真正意义上的极值点,真正的极植点可以落在了离散点的缝隙中,因此可通过对这些缝隙位置进行插值校验,然后再求极值点的坐标位置,从而获取特征点的坐标位置。In step S26, since the local extremum points may not be extreme points in the true sense in the discrete space, the true pole points may fall in the gaps of the discrete points, so the position of the slots can be The interpolation check is performed, and then the coordinate position of the extreme point is obtained, thereby obtaining the coordinate position of the feature point.
S27、根据所述特征点的邻域像素的梯度方向分布特性,为每一所述特征点赋予方向;S27: assign a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of the feature point;
在步骤S27中,通过对特征点邻域内的点的梯度方向进行直方图统计,选取直方图中比重较大的方向进行直方图统计,选取直方图中比重最大的方向为特征点的主方向。In step S27, by performing histogram statistics on the gradient direction of the points in the neighborhood of the feature points, the histogram statistics are selected in the direction with the larger specific gravity in the histogram, and the direction with the largest specific gravity in the histogram is selected as the main direction of the feature points.
S28、根据所述特征点的尺度、位置和方向,通过对所述特征点的周围图像进行区域分块,计算块内梯度直方图,从而生成所述特征点的特征描述子。S28. Calculate a gradient histogram within the block by performing area segmentation on the surrounding image of the feature point according to the scale, position, and direction of the feature point, thereby generating a feature descriptor of the feature point.
在该实施例中,所述尺度不变特征变换算法(Scale-invariant feature transform,SIFT),利用原始图像与高斯核的卷积建立尺度空间,并在高斯差分空间金字塔上提取尺度不变性的特征点。该算法具有一定的仿射不变性、视觉不变性、旋转不变性和光照不变性,所以在图像特征提高方面具有广泛应用。此外,所述尺度不变特征变换算法用一阶高斯差分来仅是高斯的拉普拉斯核,大大减少了运算量。In this embodiment, the Scale-invariant feature transform (SIFT) uses the convolution of the original image and the Gaussian kernel to establish the scale space, and extracts the feature of the scale invariance on the Gaussian difference space pyramid. point. The algorithm has certain affine invariance, visual invariance, rotation invariance and illumination invariance, so it has a wide range of applications in image feature improvement. In addition, the scale-invariant feature transform algorithm uses a first-order Gaussian difference to only a Gaussian Laplacian kernel, which greatly reduces the amount of computation.
而加速稳健特征算法(Speeded-Up Robust Features,SURF)作为尺度不变特征变换算法,其匹配过程大体相同,区别点在于加速稳健特征算法使用了近似Harr小波方法来提取特征点,这种方法就是基于Hessian行列式的斑点特征检测方法。通过在不同的尺度上利用积分图像可以有效地计算出近似Ha rr小波值,简化了二阶微分模板的构建,搞高了尺度空间的特征检测的效率。The Speeded-Up Robust Features (SURF) is a scale-invariant feature transform algorithm. The matching process is basically the same. The difference is that the accelerated robust feature algorithm uses the approximate Harr wavelet method to extract feature points. A speckle feature detection method based on the Hessian determinant. By using the integral image on different scales, the approximate Ha rr wavelet value can be effectively calculated, which simplifies the construction of the second-order differential template and improves the efficiency of feature detection in scale space.
参见图11,为本发明实施例3提供的一种基于机器视觉的虚拟墙构建方法的流程图,包括步骤:FIG. 11 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 3 of the present invention, including the steps of:
S31、在所述可移动电子设备遍历待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;S31. During the traversing of the to-be-positioned area, the camera disposed on the movable electronic device collects an image of the surrounding environment in a real-time manner at a preset frequency, and images the image captured at each moment. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
S32、通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;S32. Obtain, by the image matching algorithm, a plurality of feature points of the target image at the current moment and a feature descriptor corresponding to each of the feature points;
S33、通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;S33, obtaining a feature point of the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when When the obtained number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
S34、根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点;x≥2; S34, according to the positional relationship of the feature points having the matching relationship on the target image, where the feature points on the same straight line are taken as the key points; x≥2;
S35、基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙;S35. Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and Constructing the virtual wall on a surface perpendicular to the photosensitive surface;
S36、当所述虚拟墙与所述可移动电子设备的距离小于预设的距离时,通过预设的避开策略移动所述可移动电子设备以使得所述可移动电子设备与所述虚拟墙的距离增大。S36. When the distance between the virtual wall and the mobile electronic device is less than a preset distance, move the mobile electronic device by using a preset avoidance policy to cause the mobile electronic device to be connected to the virtual wall. The distance increases.
本实施例的步骤S31~S35与图8所示的步骤S21~S25基本一致,工作过程可参考步骤S21~S25的具体描述,在此不再赘述。The steps S31 to S35 of the embodiment are substantially the same as the steps S21 to S25 shown in FIG. 8. For details, refer to the detailed description of the steps S21 to S25, and details are not described herein again.
在实施例2的基础上,本发明实施例增加了使可移动电子设备避开虚拟墙行进的步骤。在现实的应用场景中,为了机器的保护或其他原因,需设置禁止进入区域,例如禁止扫地机器人进入卫生间以防止地面积水或过多水蒸气进入机器内造成短路现象,因此需要构建虚拟墙和设置相应的避开策略以防止机器人误进入禁止进入区域。优选地,避开策略具体为:On the basis of Embodiment 2, the embodiment of the present invention adds a step of causing the removable electronic device to travel away from the virtual wall. In the actual application scenario, for the protection of the machine or other reasons, it is necessary to set a forbidden entry area, for example, prohibiting the sweeping robot from entering the toilet to prevent the ground area water or excessive water vapor from entering the machine, causing a short circuit, so it is necessary to construct a virtual wall and Set the appropriate avoidance strategy to prevent the robot from entering the forbidden entry area by mistake. Preferably, the avoidance strategy is specifically:
调整所述可移动电子设备的行进方向,使所述可移动电子设备沿着远离所述虚拟墙的方向移动。Adjusting a direction of travel of the mobile electronic device to move the movable electronic device in a direction away from the virtual wall.
可以理解的,除了上述公开的避开策略外,本实施例的避开策略还可以采用其他方式,在此不再赘述。It can be understood that, in addition to the above-mentioned avoidance strategy, the avoidance strategy of this embodiment may also adopt other manners, and details are not described herein again.
优选地,由于在光敏面成像的过程中存在远近特征的相对比例发生变化,发生了弯曲或变形,因此在将所述摄取到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像后,将所述目标图像与标记图案库中预存的标记图案进行比对之前还需要对所述目标图像进行透视变形的矫正,从而构建更为准确的虚拟墙。Preferably, since there is a change in the relative proportion of the near-far feature during the imaging of the photosensitive surface, bending or deformation occurs, so that the captured image is projected onto the image sensor provided in the movable electronic device. After the photosensitive surface forms the target image, it is necessary to correct the perspective distortion of the target image before comparing the target image with the pre-stored marking pattern in the marking pattern library, thereby constructing a more accurate virtual wall.
在可移动电子设备识别虚拟墙的问题上,传统的方法主要是利用以下方式:In the case of mobile electronic devices recognizing virtual walls, the traditional method mainly uses the following methods:
通过可移动电子设备遍历整个房间区域的过程中构建地图,将构建的地图进行栅格化,将进行栅格化的地图文件上传至电脑中,通过电脑在所述地图文件上设置虚拟墙,然后将画好虚拟墙的栅格地图文件上传至可移动电子设备。这种方法的不足之处在于,每到一个新的环境中进行地图构建,需重新导出地图文件、上传地图文件、绘制虚拟墙和导入地图文件,过程繁琐;另一方面,还需借助额外的交互设备进行设置,并不利于智能化的发展。Build a map through the process of traversing the entire room area by the mobile electronic device, rasterize the constructed map, upload the rasterized map file to the computer, set a virtual wall on the map file through the computer, and then Upload the raster map file of the virtual wall to the removable electronic device. The downside of this approach is that each time a map is built in a new environment, it is cumbersome to re-export map files, upload map files, draw virtual walls, and import map files. On the other hand, additional work is required. The setting of interactive devices is not conducive to the development of intelligence.
而本实施例通过直接将所述可移动电子设备置于预构建虚拟墙的正下方(门框的正下方),即当可移动电子设备与所述虚拟墙呈90度角时,通过摄像头获取正上方的图片作为标记图案,对该标记图案进行特征点提取获得各个特征点的特征描述子,则可移动电子设备在遍历房间的过程中,在摄像头的广角范围内获取到与上述标记图案的特征点相匹配的图片时,如果匹配的特征点大于预设的阈值,则可选取特征点中位于同一直线上的关键点,计算虚拟墙的位置信息,并自动构建虚拟墙,作为后续的允许进入区域和禁止进入区域的分界线,或者作为构建整个房间的地图使用,无需繁琐的导入导出过程,构建过程更灵活,具有简单实用的优点;此外,此外,本实施例中方案无需额外的交互设备进行虚拟墙的设置,也无需在特定位置设置定位标签等,智能程度更高,当需取消特定位置的虚拟墙时,仅需将预存入可移动电子设备的标记图案删除即可,方便快捷。In this embodiment, the mobile electronic device is directly placed directly under the pre-built virtual wall (directly under the door frame), that is, when the movable electronic device is at an angle of 90 degrees with the virtual wall, the camera obtains positive The upper picture is used as a mark pattern, and feature mark extraction is performed on the mark pattern to obtain feature descriptors of each feature point, and the movable electronic device acquires features of the mark pattern in a wide angle range of the camera during traversing the room. When the matching picture is matched, if the matching feature point is greater than the preset threshold, the key points on the same line in the feature point may be selected, the position information of the virtual wall is calculated, and the virtual wall is automatically constructed as a subsequent allowed entry. The boundary between the area and the forbidden area, or as a map for constructing the entire room, does not require a cumbersome import and export process, the construction process is more flexible, and has the advantages of simplicity and practicality; moreover, in addition, the solution in this embodiment does not require additional interactive equipment. To set up the virtual wall, there is no need to set the positioning label in a specific location, etc. High, when you need to cancel the virtual wall in a specific location, you only need to delete the mark pattern pre-stored into the removable electronic device, which is convenient and quick.
参见图12,为本发明实施例4提供的一种基于机器视觉的虚拟墙构建方法的流程,包括步骤:12 is a flowchart of a method for constructing a virtual wall based on machine vision according to Embodiment 4 of the present invention, including the steps of:
S41、在所述可移动电子设备遍历待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;S41. In the process of traversing the to-be-positioned area, the camera disposed on the movable electronic device collects an image of the surrounding environment in a real-time manner at a preset frequency, and images the image captured at each moment. Forming a target image to a photosensitive surface of an image sensor provided in the movable electronic device;
S42、通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;S42. Obtain, by the image matching algorithm, a plurality of feature points of the target image at the current moment and a feature descriptor corresponding to each of the feature points;
S43、通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;S43, obtaining a feature point of the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when When the obtained number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
S44、根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点;x≥2;S44, according to the positional relationship of the feature points having the matching relationship on the target image, wherein the feature points on the same straight line are taken as the key points; x≥2;
S45、基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙; S45. Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature. Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and Constructing the virtual wall on a surface perpendicular to the photosensitive surface;
S46、在构建所述虚拟墙后,控制所述可移动电子设备以预设的路径穿过所述虚拟墙。S46. After constructing the virtual wall, control the mobile electronic device to pass through the virtual wall in a preset path.
本实施例的步骤S41~S45与图8所示的步骤S21~S25基本一致,工作过程可参考步骤S21~S25的具体描述,在此不再赘述。The steps S41 to S45 of the present embodiment are substantially the same as the steps S21 to S25 shown in FIG. 8. For details, refer to the detailed description of the steps S21 to S25, and details are not described herein again.
在实施例2的基础上,本发明实施例增加了使可移动电子设备穿过虚拟墙行进的步骤。在实际的应用场景中,完成对特定区域的清洁等工作后,需进入另一区域继续工作,则在构建所述虚拟墙后,可控制所述可移动电子设备以预设的路径穿过所述虚拟墙以进入另一区域。优选地,所述路径可设置为穿过所述虚拟墙并与所述虚拟墙相垂直的直线路径,也可设置为任一穿过虚拟墙的曲线路径。On the basis of Embodiment 2, the embodiment of the present invention adds the step of moving the mobile electronic device through the virtual wall. In an actual application scenario, after completing work such as cleaning a specific area, and continuing to work in another area, after constructing the virtual wall, the movable electronic device may be controlled to pass through the preset path. Describe the virtual wall to enter another area. Preferably, the path may be set as a straight path passing through the virtual wall and perpendicular to the virtual wall, or may be set as any curved path through the virtual wall.
可以理解的,除了上述公开的路径外,本实施例的路径还可以设置为其他形式,在此不再赘述。It can be understood that the path of the embodiment may be set to other forms in addition to the paths disclosed in the foregoing, and details are not described herein again.
参见图13,为本发明实施例5提供的一种地图构建方法的流程示意图,包括步骤:FIG. 13 is a schematic flowchart of a method for constructing a map according to Embodiment 5 of the present invention, including the steps of:
S51、以待定位区域中的任意位置或特定位置作为坐标原点构建坐标系,在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向,从而实时获取所述可移动电子设备在所述坐标系中的坐标值;S51. Construct a coordinate system with an arbitrary position or a specific position in the to-be-positioned area as a coordinate origin, and calculate a displacement of the movable electronic device relative to the coordinate origin in real time during the process of the movable electronic device traversing the to-be-positioned area. And a direction to acquire coordinate values of the movable electronic device in the coordinate system in real time;
S52、在所述可移动电子设备遍历所述待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;S52, in the process of traversing the to-be-positioned area of the mobile electronic device, collecting, by using a camera disposed on the movable electronic device, an image of a surrounding environment in real time at a preset frequency, and collecting each time Projecting an image onto a photosensitive surface of an image sensor provided in the movable electronic device to form a target image;
S53、根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;其中,所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2;S53. Acquire, according to a preset image matching algorithm, when the target image acquired at any time matches any of the mark patterns in the mark pattern library, obtain x key points of the target image on the photosensitive surface. Wherein the key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2;
S54、基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙;S54. Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and Constructing the virtual wall on a surface perpendicular to the photosensitive surface;
S55、根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的坐标平面,对所述待定位区域进行实时地图构建。S55. Perform real-time map construction on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
本实施例的步骤S52~S54与图1所示的步骤S11~S13基本一致,工作过程可参考步骤S11~S13的具体描述,在此不再赘述。The steps S52 to S54 in this embodiment are substantially the same as the steps S11 to S13 in FIG. 1 . For details, refer to the detailed description of the steps S11 to S13, and details are not described herein again.
在本实施例中,通过以待构建区域内的任意位置或特定位置作为基准点(坐标原点)构建坐标系,再通过设置于可移动电子设备上的编码器实施计算可移动电子设备相对于该坐标原点的距离和方向,从而获取该可移动电子设备在该坐标系中的坐标值。通过上述基于机器视觉的虚拟墙构建方法,当计算得到虚拟墙相对于可移动电子设备的位置信息时,即可获取该虚拟墙在坐标系中的坐标平面。可移动电子设备可根据各个虚拟墙在坐标系中的坐标平面,建立房间的简单架构,构成3D的立体地图,供可移动电子设备导航使用,具有简单实用的优点。In this embodiment, the coordinate system is constructed by using an arbitrary position or a specific position in the area to be constructed as a reference point (coordinate origin), and then calculating the movable electronic device relative to the encoder by using an encoder disposed on the movable electronic device. The distance and direction of the origin of the coordinate to obtain the coordinate value of the movable electronic device in the coordinate system. Through the above-mentioned machine vision-based virtual wall construction method, when the position information of the virtual wall relative to the movable electronic device is calculated, the coordinate plane of the virtual wall in the coordinate system can be obtained. The mobile electronic device can establish a simple structure of the room according to the coordinate plane of each virtual wall in the coordinate system, and form a 3D three-dimensional map for navigation and use of the movable electronic device, which has the advantages of simple and practical.
优选地,除了利用虚拟墙构建地图,还可利用所述可移动电子设备在遍历过程中遇到的障碍物和定位标签进行地图构建。参见图14,为本发明实施例6提供的一种地图构建方法的流程示意图,适用于所述待定位区域上设有至少两个定位标签,每一个定位标签对应设置在所述待定位区域的特定位置上,每一所述定位标签信息包括用于区别其绝对位置的唯一编码信息,包括步骤:Preferably, in addition to constructing the map using the virtual wall, the map can be constructed using obstacles and positioning tags encountered by the mobile electronic device during the traversal process. FIG. 14 is a schematic flowchart of a method for constructing a map according to Embodiment 6 of the present invention, where the at least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed in the to-be-positioned area. At a specific location, each of the positioning tag information includes unique encoding information for distinguishing its absolute position, including the steps of:
S61、以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系,在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向,从而实时获取所述可移动电子设备在所述坐标系中的坐标值;S61. Construct a coordinate system with any position or a specific position in the to-be-positioned area as a coordinate origin, and calculate the movable electronic device relative to the coordinate origin in real time during the process of the movable electronic device traversing the to-be-positioned area. Displacement and direction to obtain coordinate values of the movable electronic device in the coordinate system in real time;
S62、在所述可移动电子设备遍历所述待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;S62. In the process of traversing the to-be-positioned area, the camera disposed on the movable electronic device collects an image of the surrounding environment in real time at a preset frequency, and collects each time. Projecting an image onto a photosensitive surface of an image sensor provided in the movable electronic device to form a target image;
S63、通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;S63. Obtain, by the image matching algorithm, a plurality of feature points of the target image at a current time and a feature descriptor corresponding to each of the feature points;
S64、通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配; S64. Obtain a feature point of each feature descriptor of the target image and each feature descriptor of the mark pattern, and obtain a feature point that has a matching relationship between the target image and the mark pattern. When the obtained number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
S65、根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点;x≥2;S65, according to the positional relationship of the feature points having the matching relationship on the target image, wherein the feature points on the same straight line are taken as key points; x≥2;
S66、基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙;S66. Calculate, according to a key point of the target image on the photosensitive surface, a distance between the virtual wall and the movable electronic device, according to a distance between the virtual wall and the movable electronic device, and a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and Constructing the virtual wall on a surface perpendicular to the photosensitive surface;
S67、基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算并记录所述可移动电子设备每一次检测到障碍物时的障碍物位置的坐标值;S67. Calculate and record a coordinate value of an obstacle position when the movable electronic device detects an obstacle each time the movable electronic device detects an obstacle based on a moving direction and a moving distance of the movable electronic device with respect to the starting point;
S68、在遍历过程中,基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算所述可移动电子设备每一次获取到的定位标签信息时的定位标签的位置的坐标值,并记录定位标签信息及对应的坐标值;S68. Calculating, according to the moving direction and the moving distance of the movable electronic device with respect to the starting point, a coordinate value of a position of the positioning tag when the positioning tag information acquired by the movable electronic device is acquired in the traversing process. And recording the positioning label information and the corresponding coordinate values;
S69、基于所述虚拟墙的坐标平面、每一所述障碍物位置的坐标值以及每一所述定位标签的信息及其坐标值,对所述待定位区域进行实时地图构建。S69: Perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
本实施例的步骤S62~66与图8所示的步骤S21~S25基本一致,工作过程可参考步骤S21~S25的具体描述,在此不再赘述。The steps S62-66 of the embodiment are basically the same as the steps S21 to S25 shown in FIG. 8. For details, refer to the detailed description of the steps S21 to S25, and details are not described herein again.
相比于实施例5,本实施例还通过障碍物和定位标签的位置进行地图构建,具体为通过障碍物传感器、激光传感器或红外传感器探测障碍物,当探测到障碍物时,根据当前时刻所述可移动电子设备的位置获取障碍物的坐标值;另外,根据定位标签的类型设置不同的感应器以获取定位标签的位置信息,例如,当定位标签为色块标签时,则设置颜色传感器进行感应,而当定位标签为RFID标签时,则设置RFID传感器进行感应。本实施例通过定位标签、障碍物的坐标值以及虚拟墙的坐标平面,可构建完整的、细节化的地图,利于可移动电子设备的精确导航,从而有助于后续工作的执行。Compared with the embodiment 5, the embodiment also constructs a map by using the position of the obstacle and the positioning tag, specifically detecting the obstacle by the obstacle sensor, the laser sensor or the infrared sensor, and when the obstacle is detected, according to the current moment The position of the movable electronic device acquires the coordinate value of the obstacle; in addition, different sensors are set according to the type of the positioning tag to obtain the position information of the positioning tag, for example, when the positioning tag is a color block label, the color sensor is set. Sensing, and when the positioning tag is an RFID tag, an RFID sensor is set for sensing. In this embodiment, by locating the coordinates of the label, the obstacle, and the coordinate plane of the virtual wall, a complete and detailed map can be constructed, which facilitates accurate navigation of the mobile electronic device, thereby facilitating the execution of subsequent work.
对于机器人而言,一种常见的应用需求为,当机器人偏离房门的中线时,需要引导机器人返回房门的中线位置才继续行进。在另一优选实施例中,在实施例6的基础上,如图15所示,所述地图构建方法还包括步骤:For robots, a common application requirement is that when the robot deviates from the centerline of the door, it is necessary to guide the robot back to the centerline position of the door before proceeding. In another preferred embodiment, based on Embodiment 6, as shown in FIG. 15, the map construction method further includes the steps of:
S71、根据所述目标图像的透视变形,计算所述可移动电子设备偏离所述虚拟墙中线的距离;S71. Calculate, according to a perspective deformation of the target image, a distance of the movable electronic device from a center line of the virtual wall;
透视变形是由于远近特征的相对比例变化,发生了弯曲或变形,因此可以根据远近在光敏面上投影的像素数量的比例计算所述可移动电子设备偏离所述虚拟墙中线的距离。The perspective distortion is due to the relative proportion change of the near-far feature, and bending or deformation occurs, so that the distance of the movable electronic device from the center line of the virtual wall can be calculated according to the proportion of the number of pixels projected on the photosensitive surface.
S72、根据所述可移动电子设备偏离所述虚拟墙的中线的距离,使所述可移动电子设备沿着与所述虚拟墙平行的轨迹返回所述虚拟墙的中线上。S72. Return the movable electronic device to a center line of the virtual wall along a trajectory parallel to the virtual wall according to a distance of the movable electronic device from a center line of the virtual wall.
通过该步骤,即可引导可移动电子设备返回至所述虚拟墙中线的位置,从而校准该可移动电子设备的位置,利于后续快速的定位以及重新制定前进路径。Through this step, the position of the movable electronic device to return to the center line of the virtual wall can be guided, thereby calibrating the position of the movable electronic device, facilitating subsequent rapid positioning and reforming the forward path.
另外,由于编码器的精度等原因,编码器记录的可移动电子设备的相对距离和方向会存在不可避免的误差,从而导致构建的地图不精确。因此,本实施例在构建地图后,通过可移动设备多次遍历的方式多次获取定位标签、障碍物或者虚拟墙的坐标值,然后采用递推等算法对每个定位标签、障碍物或者虚拟墙的坐标值进行纠正,可移动设备遍历次数越多,计算出的定位标签、障碍物或者虚拟墙的坐标值就会越准确,直到最后几乎将误差减小到可忽略不计。In addition, due to the accuracy of the encoder and the like, there is an inevitable error in the relative distance and direction of the movable electronic device recorded by the encoder, resulting in inaccurate map construction. Therefore, after constructing the map, the embodiment obtains the coordinate values of the positioning label, the obstacle or the virtual wall multiple times by the traversal of the movable device, and then uses a recursive algorithm to locate each positioning label, obstacle or virtual. The coordinate values of the wall are corrected. The more the number of times the movable device traverses, the more accurate the calculated coordinate values of the positioning label, obstacle or virtual wall will be, until the error is reduced to negligible until the end.
需要进一步说明的是,在使用轮子行进的可移动电子设备中,存在一种很常见的打滑的现象。例如,当遇到障碍物时,位于前部的从动轮已经不再转动,而后部的主动轮仍然处于转动状态,这时编码器仍然记录该可移动电子设备处于移动状态,并根据驱动轮的转动实时计算该可移动电子设备的相对位移和相对距离,这就会产生行进路径的严重误差,从而导致后续探测到的定位标签、障碍物或者虚拟墙的坐标值均存在误差,不能构建准确的地图,从而不能精确导航。优选地,可通过以下方式检测可移动电子设备是否处于打滑状态,从而指定有效的纠正措施,避免后续误差的产生:It should be further noted that there is a very common phenomenon of slippage in mobile electronic devices that use wheels to travel. For example, when an obstacle is encountered, the driven wheel at the front is no longer rotated, and the driving wheel at the rear is still in a rotating state, at which time the encoder still records that the movable electronic device is in motion and according to the driving wheel Rotating the relative displacement and relative distance of the movable electronic device in real time, which will cause serious errors in the travel path, resulting in errors in the coordinate values of the subsequently detected positioning tags, obstacles or virtual walls, and cannot be accurately constructed. Maps, so you can't navigate precisely. Preferably, the movable electronic device can be detected in a slipping state by specifying effective corrective measures to avoid subsequent errors:
在所述可移动电子设备沿任意直线行进过程中,当任意时刻检测到所述可移动电子设备的主动轮的速度与从动轮的速度不一致时,以所述主动轮的速度和所述从动轮的速度中的较小值作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the traveling of the movable electronic device along an arbitrary straight line, when the speed of the driving wheel of the movable electronic device is detected to be inconsistent with the speed of the driven wheel at any time, the speed of the driving wheel and the driven wheel The smaller of the speeds is used as the reference speed, and the displacement and direction of the movable electronic device relative to the coordinate origin are calculated according to the reference speed;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度小于理论速度时,以所述从动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the turning of the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be less than the theoretical speed at any time, the speed of the driven wheel is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮 的速度大于所述理论速度时,以所述主动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;所述理论速度根据所述主动轮的速度计算得到。对于直行状态,所述可移动电子设备上各点的线速度均相等,而任意时刻检测到不相等的状态时,可判断当前时刻所述可移动电子设备处于打滑状态;而较为复杂的情况是所述可移动电子设备沿着一个中心点进行转弯,其上各点的速度是不一致的。以所述可移动电子设备为圆形物体为例,如图16所示,当所述可移动电子设备300任意时刻以0点进行左转弯时,假设左驱动轮K1的速度为50cm/s,右驱动轮K2的速度为100cm/s,则根据各点和0点的距离比例关系,例如前端从动轮K3到0点的距离s1为80cm,右驱动轮K2到0点的距离s3为100cm,则可知从动轮K3的理论速度和可知右驱动轮K2的速度比为80/100=4/5;因此,在正常行驶状态下,前端的从动轮K3的理论速度应为80cm/s,则在当前时刻下该从动轮K3的实际速度和理论速度80cm/s不一致时,则可判断当前时刻所述可移动电子设备300处于打滑状态。During the turning of the movable electronic device at an arbitrary center point, the driven wheel of the movable electronic device is detected at any time When the speed is greater than the theoretical speed, the speed of the driving wheel is used as a reference speed, and the displacement and direction of the movable electronic device relative to the coordinate origin are calculated according to the reference speed; the theoretical speed is according to the active The speed of the wheel is calculated. For the straight-through state, the line speeds of the points on the movable electronic device are equal, and when the unequal state is detected at any time, the movable electronic device can be judged to be in a slip state at the current time; and a more complicated situation is The mobile electronic device makes a turn along a central point, and the speeds at various points thereon are inconsistent. Taking the movable electronic device as a circular object as an example, as shown in FIG. 16, when the movable electronic device 300 makes a left turn at 0 o'clock at any time, it is assumed that the speed of the left driving wheel K1 is 50 cm/s, The speed of the right driving wheel K2 is 100 cm/s, and according to the distance proportional relationship between each point and 0 point, for example, the distance s1 of the front driven wheel K3 to 0 point is 80 cm, and the distance s3 of the right driving wheel K2 to 0 point is 100 cm. It can be seen that the theoretical speed of the driven wheel K3 and the speed ratio of the right driving wheel K2 are 80/100=4/5; therefore, in the normal running state, the theoretical speed of the driven wheel K3 at the front end should be 80 cm/s, then When the actual speed of the driven wheel K3 does not match the theoretical speed of 80 cm/s at the current time, it can be determined that the mobile electronic device 300 is in the slip state at the current time.
参见图17,为本发明实施例8提供的一种基于机器视觉的虚拟墙构建装置的结构示意图,所述虚拟墙构建装置设于可移动电子设备,包括:17 is a schematic structural diagram of a virtual machine building device based on machine vision according to Embodiment 8 of the present invention. The virtual wall building device is disposed on a mobile electronic device, and includes:
摄像头81,用于在所述可移动电子设备遍历待定位区域的过程中,以预设的频率实时采集周围环境的图像;The camera 81 is configured to collect an image of the surrounding environment in real time at a preset frequency during the process of traversing the area to be located by the movable electronic device;
图像传感器82,用于接收每一时刻采集到的图像在所述图像传感器72的光敏面上投影形成目标图像;The image sensor 82 is configured to receive an image acquired at each moment on the photosensitive surface of the image sensor 72 to form a target image;
存储设备83,用于预存多个标记图案;a storage device 83, configured to pre-store a plurality of mark patterns;
控制器84,用于根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述存储设备83中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙;所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2。a controller 84, configured to acquire, according to a preset image matching algorithm, when the target image acquired at any time matches any of the marking patterns in the storage device 83, acquiring the target image on the photosensitive surface x key points; calculating a distance between the virtual wall and the movable electronic device based on the key points of the target image on the photosensitive surface, according to the distance between the virtual wall and the movable electronic device, Constructing the virtual wall with a predetermined straight line at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then the line is parallel to the characteristic Constructing the virtual wall on a surface perpendicular to the photosensitive surface; the key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2.
优选地,所述控制器84具体用于:先通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子,然后通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配,再根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点;x≥2。Preferably, the controller 84 is configured to: first acquire, by using the image matching algorithm, a plurality of feature points of the target image at a current time and a feature descriptor corresponding to each of the feature points, and then calculate the target by calculating a feature point of each feature descriptor of the image and each feature descriptor of the mark pattern, and obtaining a feature point having a matching relationship between the target image and the mark pattern, when the acquired matching relationship is obtained When the number of the feature points is greater than the preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library, and then according to the positional relationship of the feature points having the matching relationship on the target image, x feature points on the same line are used as key points; x≥2.
其中,所述控制器84通过以下方式导入标记图案:Wherein, the controller 84 imports the mark pattern by:
响应于标定指令,获取当前时刻所述可移动电子设备正上方的图像,并存储至所述标记图案库中作为新的标记图案。In response to the calibration instruction, an image directly above the removable electronic device at the current time is acquired and stored in the mark pattern library as a new mark pattern.
需要说明的是,图像的匹配时通过特征点的特征向量的匹配进行的。当获取到新的标记图案时,需先对标记图案进行预处理和特征点提取后获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。It should be noted that the matching of the images is performed by matching the feature vectors of the feature points. When a new mark pattern is acquired, the mark pattern is pre-processed and the feature points are extracted to obtain a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
其中,所述图像匹配算法为尺度不变特征变换算法或加速稳健特征算法,所述控制器84通过以下步骤获取标记图案/目标图像的每一特征描述子:The image matching algorithm is a scale invariant feature transform algorithm or an accelerated robust feature algorithm, and the controller 84 obtains each feature descriptor of the mark pattern/target image by the following steps:
通过高斯模糊建立标记图像/目标图像的尺度空间,通过高斯微分函数识别所述标记图像/目标图像的尺度空间中的极值点,对所述标记图像/目标图像的尺度空间中的极值点进行校验,去除所述标记图像/目标图像的尺度空间中的不稳定极值点,从而获得所述标记图像/目标图像的特征点及所述特征点的尺度和位置;The scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Performing a check to remove an unstable extreme point in the scale space of the mark image/target image, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
根据所述特征点的邻域像素的梯度方向分布特性,为每一所述特征点赋予方向;And assigning a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of the feature point;
根据所述特征点的尺度、位置和方向,通过对所述特征点的周围图像进行区域分块,计算块内梯度直方图,从而生成所述特征点的特征描述子。According to the scale, position and direction of the feature point, the intra-block gradient histogram is calculated by performing area segmentation on the surrounding image of the feature point, thereby generating a feature descriptor of the feature point.
关于本实施例的虚拟墙构建装置的工作原理和过程,可参考上述实施例1和实施例2的描述,在此不再赘述。For the working principle and process of the virtual wall building device of this embodiment, reference may be made to the descriptions of Embodiment 1 and Embodiment 2, and details are not described herein again.
其中,所述摄像头81上设置有成像透镜(或成像透镜),用于成像聚焦,从而反射物体在所述图像传感器82的光敏面上形成目标图像。Wherein, the camera 81 is provided with an imaging lens (or imaging lens) for imaging focusing, so that the reflective object forms a target image on the photosensitive surface of the image sensor 82.
在本实施例中,所述虚拟墙与所述移动电子设备的距离通过三角测距法计算得到,In this embodiment, the distance between the virtual wall and the mobile electronic device is calculated by a triangulation method.
根据三角测距原理,通过以下公式计算所述虚拟墙与所述可移动电子设备的距离: According to the principle of triangulation, the distance between the virtual wall and the movable electronic device is calculated by the following formula:
D=a/b*S*|cosθ|D=a/b*S*|cosθ|
其中,a为所述虚拟墙的上边框到所述光敏面的距离,b为所述成像透镜和所述光敏面的距离,S为所述特征直线和所述光敏面的中心点的距离,D为所述虚拟墙和所述光敏面的中心点的距离,θ为所述预设夹角。Where a is the distance from the upper border of the virtual wall to the photosensitive surface, b is the distance between the imaging lens and the photosensitive surface, and S is the distance between the characteristic straight line and the center point of the photosensitive surface, D is a distance between the virtual wall and a center point of the photosensitive surface, and θ is the preset angle.
如图2所示,当θ=0°或180°时,|cos 0°|=|cos 180°|=1,即待构建虚拟墙和所述特征直线平行时,可通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:As shown in FIG. 2, when θ=0° or 180°, |cos 0°|=|cos 180°|=1, that is, when the virtual wall to be constructed and the characteristic line are parallel, the following formula can be calculated. The distance between the virtual wall and the removable electronic device:
D=a/b*SD=a/b*S
其中,a为所述虚拟墙100的上边框400到所述光敏面301的距离,b为所述成像透镜303和所述光敏面301的距离,S为所述特征直线304和所述光敏面301的中心点302的距离,D为所述虚拟墙100和所述光敏面301的中心点302的距离。其中,图2为所述可移动电子设备正对于虚拟墙的情况,而图3为所述可移动电子设备相对于虚拟墙向右偏移的情况,可以理解的是,在可移动电子设备相对于虚拟墙的任何方向(包括正对、背对、左向偏移和右向偏移),只要摄像头检测到特定数量的匹配特征点,均可基于特征点的位置选取合理的关键点构建准确位置的虚拟墙。Where a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301, b is the distance between the imaging lens 303 and the photosensitive surface 301, and S is the characteristic line 304 and the photosensitive surface The distance from the center point 302 of 301, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301. 2 is a case where the movable electronic device is facing the virtual wall, and FIG. 3 is a case where the movable electronic device is shifted to the right with respect to the virtual wall. It can be understood that the movable electronic device is relatively In any direction of the virtual wall (including front, back, left and right offset), as long as the camera detects a certain number of matching feature points, it can accurately construct a reasonable key based on the position of the feature points. The virtual wall of the location.
如图4所示,当所述预设夹角不等于0°或180°时,通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:As shown in FIG. 4, when the preset angle is not equal to 0° or 180°, the distance between the virtual wall and the movable electronic device is calculated by the following formula:
D=a/b*S*|cosθ|D=a/b*S*|cosθ|
其中,a为所述虚拟墙100的上边框400到所述光敏面301的距离,b为所述成像透镜303和所述光敏面301的距离,S为所述特征直线304和所述光敏面301的中心点302的距离,D为所述虚拟墙100和所述光敏面301的中心点302的距离,θ为所述预设夹角;如图4所示,房间的天花板500上存在一条映射直线402,其通过成像透镜303在所述光敏面301上投影生成所述特征直线304;可以理解的h=a/b*S为光敏面301的中心点302与所述映射直线402所在的平面401的距离,结合图5可知,D=h*|cosθ|。Where a is the distance from the upper frame 400 of the virtual wall 100 to the photosensitive surface 301, b is the distance between the imaging lens 303 and the photosensitive surface 301, and S is the characteristic line 304 and the photosensitive surface The distance from the center point 302 of 301, D is the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301, and θ is the preset angle; as shown in FIG. 4, there is a ceiling on the ceiling 500 of the room. A mapping line 402 is projected onto the photosensitive surface 301 by the imaging lens 303 to generate the characteristic line 304; it is understood that h=a/b*S is the center point 302 of the photosensitive surface 301 and the mapping line 402 is located The distance of the plane 401, as shown in Fig. 5, is D = h * | cos θ |.
需要说明的是,在本发明实施例中,所述虚拟墙100和所述光敏面301的中心点302的距离D作为所述虚拟墙100与所述可移动电子设备的距离。而在另一优选实施例中,如图7所示,假设所述可移动电子设备300为规则的圆形,可定义所述虚拟墙100与所述可移动电子设备300的距离为所述可移动电子300的中心点305到所述虚拟墙100的距离;具体的,当所述可移动电子设备300正对所述虚拟墙100时,如图7所示,假设所述可移动电子设备300为规则的圆形,可定义所述虚拟墙100与所述可移动电子设备300的距离为所述虚拟墙100和所述光敏面301的中心点302的距离与所述可移动电子设备300的中心点305和所述光敏面301的中心点302的距离的和,即L=D+D’,其中,L所述虚拟墙100与所述可移动电子设备300的距离,D为所述虚拟墙100和所述光敏面301的中心点302的距离,D’为所述可移动电子设备300的中心点305和所述光敏面301的中心点302的距离。可以理解的,上述公式除了适用于所述可移动电子设备为圆形的情况外,还适用于所述可移动电子设备为其他规则形状的情况,在此不再赘述。It should be noted that, in the embodiment of the present invention, the distance D between the virtual wall 100 and the center point 302 of the photosensitive surface 301 is the distance between the virtual wall 100 and the movable electronic device. In another preferred embodiment, as shown in FIG. 7, assuming that the removable electronic device 300 is a regular circle, the distance between the virtual wall 100 and the removable electronic device 300 can be defined as The distance from the center point 305 of the mobile electronic 300 to the virtual wall 100; specifically, when the removable electronic device 300 faces the virtual wall 100, as shown in FIG. 7, the portable electronic device 300 is assumed For a regular circle, the distance between the virtual wall 100 and the removable electronic device 300 may be defined as the distance between the virtual wall 100 and the center point 302 of the photosensitive surface 301 and the movable electronic device 300. The sum of the distances between the center point 305 and the center point 302 of the photosensitive surface 301, that is, L=D+D', where L is the distance between the virtual wall 100 and the removable electronic device 300, and D is the virtual The distance of the wall 100 from the center point 302 of the photosensitive surface 301, D', is the distance between the center point 305 of the movable electronic device 300 and the center point 302 of the photosensitive surface 301. It is to be understood that the above formula is applicable to the case where the movable electronic device is in a regular shape, and is not described herein.
在本发明实施例中,所述虚拟墙的上边框到所述光敏面的距离指代房间的天花板到所述光敏面的距离,或指代房门的上边框到所述光敏面的距离,其具体数值可在系统中进行预先设置。In the embodiment of the present invention, the distance from the upper border of the virtual wall to the photosensitive surface refers to the distance from the ceiling of the room to the photosensitive surface, or the distance from the upper border of the door to the photosensitive surface. The specific value can be preset in the system.
除了可计算虚拟墙的位置信息外,还可通过以下步骤计算虚拟墙的宽度信息,具体为结合图7通过以下公式计算所述虚拟墙的宽度:In addition to calculating the position information of the virtual wall, the width information of the virtual wall can be calculated by the following steps, specifically calculating the width of the virtual wall by using the following formula:
Figure PCTCN2017116015-appb-000004
Figure PCTCN2017116015-appb-000004
其中,W为所述虚拟墙100的宽度,a为所述虚拟墙100的上边框到所述光敏面301的距离,λ为所述摄像头81的广角。Where W is the width of the virtual wall 100, a is the distance from the upper border of the virtual wall 100 to the photosensitive surface 301, and λ is the wide angle of the camera 81.
所述图像传感器82包括PSD传感器、CCD传感器或CMOS传感器。The image sensor 82 includes a PSD sensor, a CCD sensor, or a CMOS sensor.
在另一优选实施例中,所述控制器84还用于当所述虚拟墙与所述移动电子设备的距离小于预设的距离时,所述控制器84还用于通过预设的避开策略移动所述移动电子设备以使得所述移动电子设备与所述虚拟墙的距离增大。In another preferred embodiment, the controller 84 is further configured to: when the distance between the virtual wall and the mobile electronic device is less than a preset distance, the controller 84 is further configured to bypass the preset The policy moves the mobile electronic device such that the distance of the mobile electronic device from the virtual wall increases.
在另一优选实施例中,所述控制器84还用于在构建所述虚拟墙后,控制所述可移动电子设备以预设的路径穿过所述虚拟墙。In another preferred embodiment, the controller 84 is further configured to control the movable electronic device to pass through the virtual wall in a preset path after constructing the virtual wall.
优选地,将所述摄取到图片投影至设于所述可移动电子设备中的图像传感器82的光敏面形成目标图像后,将所述目标图像与标记图案库中预存的标记图案进行比对之前,所述控制器84还用于对所述目标图像进行透视变形的矫正。 Preferably, after the ingested picture is projected onto the photosensitive surface of the image sensor 82 provided in the movable electronic device to form a target image, the target image is compared with the pre-stored mark pattern in the mark pattern library. The controller 84 is further configured to perform a correction of the perspective deformation of the target image.
参见图18,为本发明实施例9提供的一种可移动电子设备的结构示意图,包括:FIG. 18 is a schematic structural diagram of a mobile electronic device according to Embodiment 9 of the present invention, including:
上述任一项所述的虚拟墙构建装置91,用于构建虚拟墙;The virtual wall construction device 91 according to any one of the preceding claims, configured to construct a virtual wall;
其中,所述控制器84还用于以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系;The controller 84 is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
编码器92,用于在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向;The encoder 92 is configured to calculate, in real time, the displacement and direction of the movable electronic device relative to the coordinate origin in the process of traversing the to-be-positioned area by the mobile electronic device;
所述控制器84用于接收所述编码器92发送的所述可移动电子设备相对所述坐标原点的位移和方向,获取任意时刻所述移动电子设备在所述坐标系中的坐标值;The controller 84 is configured to receive a displacement and a direction of the movable electronic device sent by the encoder 92 with respect to the coordinate origin, and acquire coordinate values of the mobile electronic device in the coordinate system at an arbitrary time;
所述控制器84还用于根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的坐标平面,对所述待定位区域进行实时地图构建。The controller 84 is further configured to perform real-time map construction on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
本实施例的可移动电子设备进行实时地图构建的工作原理和过程,可参考上述实施例5的描述,在此不再赘述。The working principle and process of the real-time map construction of the mobile electronic device in this embodiment can be referred to the description of the foregoing embodiment 5, and details are not described herein again.
需要说明的是,所述虚拟墙的坐标平面根据所述可移动电子设备在所述坐标系中的坐标值,以及所述虚拟墙与所述可移动电子设备的距离计算得到。It should be noted that the coordinate plane of the virtual wall is calculated according to the coordinate value of the movable electronic device in the coordinate system and the distance between the virtual wall and the movable electronic device.
在该实施例中,所述移动电子设备包括主动轮和从动轮,所述控制器84还用于,在所述可移动电子设备沿任意直线行进过程中,当任意时刻检测到所述可移动电子设备的主动轮的速度与从动轮的速度不一致时,以所述主动轮的速度和所述从动轮的速度中的较小值作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;In this embodiment, the mobile electronic device includes a driving wheel and a driven wheel, and the controller 84 is further configured to detect the movable time at any time during the traveling of the movable electronic device along an arbitrary straight line. When the speed of the driving wheel of the electronic device does not coincide with the speed of the driven wheel, the smaller value of the speed of the driving wheel and the speed of the driven wheel is used as a reference speed, and the movable electronic device is calculated according to the reference speed. The displacement and direction relative to the origin of the coordinate;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度小于理论速度时,以所述从动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the turning of the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be less than the theoretical speed at any time, the speed of the driven wheel is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度大于所述理论速度时,以所述主动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;所述理论速度根据所述主动轮的速度计算得到。In the process of turning the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be greater than the theoretical speed at any time, the speed of the driving wheel is used as a reference speed And calculating, according to the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin; the theoretical speed is calculated according to a speed of the driving wheel.
参见图19,为本发明实施例10提供的一种可移动电子设备的结构示意图,包括:19 is a schematic structural diagram of a mobile electronic device according to Embodiment 10 of the present invention, including:
上述任一项所述的虚拟墙构建装置101,用于构建地图;The virtual wall construction device 101 according to any one of the preceding claims, configured to construct a map;
其中,所述控制器还用于以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系;The controller is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
编码器102,用于在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向;The encoder 102 is configured to calculate, in real time, the displacement and direction of the movable electronic device relative to the coordinate origin in the process of traversing the to-be-positioned area by the mobile electronic device;
所述控制器84用于接收所述编码器102发送的所述可移动电子设备相对所述坐标原点的位移和方向,获取任意时刻所述移动电子设备在所述坐标系中的坐标值;The controller 84 is configured to receive a displacement and a direction of the movable electronic device sent by the encoder 102 with respect to the coordinate origin, and acquire coordinate values of the mobile electronic device in the coordinate system at an arbitrary time;
碰撞传感器/激光传感器/红外传感器103,用于探测障碍物;Collision sensor / laser sensor / infrared sensor 103 for detecting obstacles;
所述控制器84还用于基于所述虚拟墙的坐标平面和每一所述障碍物位置的坐标值,对所述待定位区域进行实时地图构建。The controller 84 is further configured to perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
关于本实施例的可移动电子设备进行实时地图构建的工作原理和过程,可参考上述实施例6的描述,在此不再赘述。For the working principle and process of the real-time map construction of the mobile electronic device of the present embodiment, reference may be made to the description of the foregoing embodiment 6, and details are not described herein again.
在该实施例中,利用碰撞传感器103感测到障碍物时,所述控制器84基于所述可移动电子设备相对所述起始点的移动方向和移动距离,将所述可移动电子设备当前位置的坐标值作为所述障碍物位置的坐标值;当利用激光传感器/红外传感器103来探测到障碍物时,所述控制器84根据激光/红外距离计算原理计算出障碍物相对当前时刻所述可移动电子设备的位置,从而根据当所述障碍物的坐标值。In this embodiment, when the obstacle is sensed by the collision sensor 103, the controller 84 sets the current position of the movable electronic device based on the moving direction and the moving distance of the movable electronic device with respect to the starting point. The coordinate value is used as the coordinate value of the obstacle position; when the obstacle is detected by the laser sensor/infrared sensor 103, the controller 84 calculates the obstacle according to the laser/infrared distance calculation principle. The position of the mobile electronic device is based on the coordinate value of the obstacle.
在另一优选实施例中,所述待定位区域上设有至少两个定位标签,每一个定位标签对应设置在所述待定位区域的特定位置上,每一所述定位标签信息包括用于区别其绝对位置的唯一编码信息;所述控制器84根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建包括:In another preferred embodiment, at least two positioning tags are disposed on the to-be-positioned area, and each positioning tag is correspondingly disposed at a specific position of the to-be-positioned area, and each of the positioning tag information includes The unique encoding information of the absolute position of the controller; the controller 84 performs real-time map construction on the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall, including:
在遍历过程中,基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算所述可移动电子设备每一次获取到的定位标签信息时的定位标签的位置的坐标值,并记录定位标签信息及对应的坐标值; Calculating, according to the moving direction and the moving distance of the movable electronic device with respect to the starting point, a coordinate value of a position of the positioning tag when the positioning tag information acquired by the movable electronic device is acquired, and Recording positioning tag information and corresponding coordinate values;
基于所述虚拟墙的坐标平面、每一所述障碍物位置的坐标值以及每一所述定位标签的信息及其坐标值,对所述待定位区域进行实时地图构建。Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
优选地,所述控制器84还用于根据所述目标图像的透视变形,计算所述移动电子设备偏离所述虚拟墙中线的距离;根据所述移动电子设备偏离所述虚拟墙的中线的距离,使所述移动电子设备沿着与所述虚拟墙平行的轨迹返回所述虚拟墙的中线上。Preferably, the controller 84 is further configured to calculate, according to the perspective deformation of the target image, a distance of the mobile electronic device from the center line of the virtual wall; according to a distance of the mobile electronic device from a center line of the virtual wall; And causing the mobile electronic device to return to a center line of the virtual wall along a trajectory parallel to the virtual wall.
需要说明的是,在本说明书中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this specification, the terms "including", "comprising", or any other variations thereof are intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a And also includes other elements not explicitly listed, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising", without limiting the invention, does not exclude the presence of additional elements in the process, method, article, or device.
最后,还需要说明的是,上述一系列处理不仅包括以这里所述的顺序按时间序列执行的处理,而且包括并行或分别地、而不是按时间顺序执行的处理。通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明可借助软件加必需的硬件平台的方式来实现,当然也可以全部通过软件来实施。基于这样的理解,本发明的技术方案对背景技术做出贡献的全部或者部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。Finally, it should also be noted that the series of processes described above include not only processes that are performed in time series in the order described herein, but also processes that are performed in parallel or separately, rather than in chronological order. Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary hardware platform, and of course, all can be implemented by software. Based on such understanding, all or part of the technical solution of the present invention contributing to the background art may be embodied in the form of a software product, which may be stored in a storage medium such as a ROM/RAM, a magnetic disk, an optical disk, or the like. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention or in some portions of the embodiments.
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。 The above is a preferred embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It is the scope of protection of the present invention.

Claims (32)

  1. 一种基于机器视觉的虚拟墙构建方法,其特征在于,包括步骤:A virtual wall construction method based on machine vision, comprising the steps of:
    在所述可移动电子设备遍历待定位区域的过程中,通过设置于所述可移动电子设备上的摄像头以预设的频率实时采集周围环境的图像,将每一时刻采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像;In the process of traversing the area to be located, the camera disposed on the movable electronic device captures an image of the surrounding environment in real time at a preset frequency, and projects the image acquired at each moment to the device. Forming a target image on a photosensitive surface of the image sensor in the movable electronic device;
    根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;其中,所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2;Obtaining x key points of the target image on the photosensitive surface when the target image acquired at any time matches any of the marking patterns in the marking pattern library according to a preset image matching algorithm; The key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2;
    基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙。Calculating a distance between the virtual wall and the movable electronic device based on a key point of the target image on the photosensitive surface, according to a distance between the virtual wall and the movable electronic device, Forming the virtual wall on an angle that is perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel to the characteristic line and the photosensitive surface The virtual wall is constructed on a vertical plane.
  2. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述方法还包括步骤:The method according to claim 1, wherein the method further comprises the steps of:
    响应于标定指令,获取当前时刻所述可移动电子设备正上方的图像,并存储至所述标记图案库中作为新的标记图案;And acquiring an image directly above the movable electronic device at the current moment in response to the calibration instruction, and storing the image in the mark pattern library as a new mark pattern;
    通过所述图像匹配算法获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。And acquiring, by the image matching algorithm, a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
  3. 如权利要求2所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点具体为:The machine vision-based virtual wall construction method according to claim 2, wherein the target image acquired at any time and any of the mark patterns in the mark pattern library according to a preset image matching algorithm When matching, the x key points of the target image on the photosensitive surface are specifically:
    通过所述图像匹配算法获取当前时刻所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;Obtaining, by the image matching algorithm, a plurality of feature points of the target image at the current moment and a feature descriptor corresponding to each of the feature points;
    通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;Obtaining a feature point of the matching relationship between the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when acquiring When the number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
    根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点。According to the positional relationship of the feature points having the matching relationship on the target image, the feature points in which x are on the same straight line are taken as key points.
  4. 如权利要求3所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述图像匹配算法为尺度不变特征变换算法或加速稳健特征算法,所述标记图案/目标图像的每一特征描述子通过以下步骤获取:The machine vision-based virtual wall construction method according to claim 3, wherein the image matching algorithm is a scale-invariant feature transform algorithm or an accelerated robust feature algorithm, and each feature description of the mark pattern/target image is The child gets it by the following steps:
    通过高斯模糊建立标记图像/目标图像的尺度空间,通过高斯微分函数识别所述标记图像/目标图像的尺度空间中的极值点,对所述标记图像/目标图像的尺度空间中的极值点进行校验,去除所述标记图像/目标图像的尺度空间中的不稳定极值点,从而获得所述标记图像/目标图像的特征点及所述特征点的尺度和位置;The scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Performing a check to remove an unstable extreme point in the scale space of the mark image/target image, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
    根据所述标记图像/目标图像中每一所述特征点的邻域像素的梯度方向分布特性,为每一所述特征点赋予方向;And assigning a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of each of the feature points in the mark image/target image;
    根据所述标记图像/目标图像中每一所述特征点的尺度、位置和方向,通过对所述特征点的周围图像进行区域分块,计算块内梯度直方图,从而生成所述特征点的特征描述子。Calculating an intra-block gradient histogram by performing area segmentation on a surrounding image of the feature point according to a scale, a position, and a direction of each of the feature points in the mark image/target image, thereby generating the feature point Feature descriptor.
  5. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,通过摄像头采集到的图像通过成像透镜投影至所述图像传感器的光敏面;所述虚拟墙与所述可移动电子设备的距离通过三角测距法计算得到。The method of constructing a virtual machine based on a machine vision according to claim 1, wherein an image captured by the camera is projected through an imaging lens to a photosensitive surface of the image sensor; the virtual wall and the movable electronic device The distance is calculated by the triangulation method.
  6. 如权利要求5所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离具体为: The machine vision-based virtual wall construction method according to claim 5, wherein the calculating the distance between the virtual wall and the movable electronic device based on the key point of the target image on the photosensitive surface is specifically :
    通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:The distance between the virtual wall and the removable electronic device is calculated by the following formula:
    D=a/b*S*|cosθ|D=a/b*S*|cosθ|
    其中,a为所述虚拟墙的上边框到所述光敏面的距离,b为所述成像透镜和所述光敏面的距离,S为所述特征直线和所述光敏面的中心点的距离,D为所述虚拟墙和所述光敏面的中心点的距离,θ为所述预设夹角。Where a is the distance from the upper border of the virtual wall to the photosensitive surface, b is the distance between the imaging lens and the photosensitive surface, and S is the distance between the characteristic straight line and the center point of the photosensitive surface, D is a distance between the virtual wall and a center point of the photosensitive surface, and θ is the preset angle.
  7. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述图像传感器包括PSD传感器、CCD传感器或CMOS传感器。The machine vision-based virtual wall construction method according to claim 1, wherein the image sensor comprises a PSD sensor, a CCD sensor or a CMOS sensor.
  8. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,通过以下公式计算所述虚拟墙的宽度:The machine vision-based virtual wall construction method according to claim 1, wherein the width of the virtual wall is calculated by the following formula:
    Figure PCTCN2017116015-appb-100001
    Figure PCTCN2017116015-appb-100001
    其中,W为所述虚拟墙的宽度,a为所述虚拟墙的上边框到所述光敏面的距离,λ为所述摄像头的广角。Where W is the width of the virtual wall, a is the distance from the upper border of the virtual wall to the photosensitive surface, and λ is the wide angle of the camera.
  9. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述方法还包括步骤:The method according to claim 1, wherein the method further comprises the steps of:
    当所述虚拟墙与所述可移动电子设备的距离小于预设的距离时,通过预设的避开策略移动所述可移动电子设备以使得所述可移动电子设备与所述虚拟墙的距离增大。When the distance between the virtual wall and the mobile electronic device is less than a preset distance, moving the mobile electronic device by a preset avoidance strategy to make the distance between the movable electronic device and the virtual wall Increase.
  10. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述方法还包括步骤:The method according to claim 1, wherein the method further comprises the steps of:
    在构建所述虚拟墙后,控制所述可移动电子设备以预设的路径穿过所述虚拟墙。After constructing the virtual wall, the movable electronic device is controlled to pass through the virtual wall in a preset path.
  11. 如权利要求1所述的基于机器视觉的虚拟墙构建方法,其特征在于,将采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像后还包括步骤:The method for constructing a virtual machine based on a machine vision according to claim 1, wherein the step of projecting the captured image onto the photosensitive surface of the image sensor provided in the movable electronic device to form the target image further comprises the steps of:
    对所述目标图像进行透镜变形的矫正。Correction of lens deformation is performed on the target image.
  12. 一种地图构建方法,其特征在于,包括步骤A map construction method, comprising the steps
    以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系,在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向,从而实时获取所述可移动电子设备在所述坐标系中的坐标值;Constructing a coordinate system with any position or specific position in the to-be-positioned area as a coordinate origin, and calculating a displacement of the movable electronic device relative to the coordinate origin in a real-time process in which the movable electronic device traverses the to-be-positioned area And a direction to acquire coordinate values of the movable electronic device in the coordinate system in real time;
    采用如权利要求1至10任一项所述的基于机器视觉的虚拟墙构建方法构建地图;Constructing a map using the machine vision-based virtual wall construction method according to any one of claims 1 to 10;
    根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的坐标平面,对所述待定位区域进行实时地图构建。Real-time map construction is performed on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
  13. 如权利要求12所述的地图构建方法,其特征在于,所述根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建包括:The map construction method according to claim 12, wherein the real-time map is performed on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a position of the virtual wall The build includes:
    基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算并记录所述可移动电子设备每一次检测到障碍物时的障碍物位置的坐标值;Calculating and recording a coordinate value of an obstacle position when the movable electronic device detects an obstacle each time based on a moving direction and a moving distance of the movable electronic device with respect to the starting point;
    基于所述虚拟墙的坐标平面和每一所述障碍物位置的坐标值,对所述待定位区域进行实时地图构建。Real-time map construction is performed on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
  14. 如权利要求13所述的地图构建方法,其特征在于,所述待定位区域上设有至少两个定位标签,每一个定位标签对应设置在所述待定位区域的特定位置上,每一所述定位标签信息包括用于区别其绝对位置的唯一编码信息;则所述根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建还包括:The map construction method according to claim 13, wherein at least two positioning tags are disposed on the to-be-positioned area, and each of the positioning tags is correspondingly disposed at a specific position of the to-be-positioned area, each of the The positioning tag information includes unique encoding information for distinguishing its absolute position; then the real-time operation of the to-be-positioned area according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall Map construction also includes:
    在遍历过程中,基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算所述可移动电子设备每一次获取到的定位标签信息时的定位标签的位置的坐标值,并记录定位标签信息及对应的坐标值;Calculating, according to the moving direction and the moving distance of the movable electronic device with respect to the starting point, a coordinate value of a position of the positioning tag when the positioning tag information acquired by the movable electronic device is acquired, and Recording positioning tag information and corresponding coordinate values;
    基于所述虚拟墙的坐标平面、每一所述障碍物位置的坐标值以及每一所述定位标签的信息及其坐 标值,对所述待定位区域进行实时地图构建。Determining a coordinate plane based on the virtual wall, coordinate values of each of the obstacle positions, and information about each of the positioning tags A real-time map is constructed for the to-be-positioned area.
  15. 如权利要求12所述的地图构建方法,其特征在于,所述方法还包括步骤:The map construction method according to claim 12, wherein the method further comprises the steps of:
    根据所述目标图像的透视变形,计算所述可移动电子设备偏离所述虚拟墙中线的距离;Calculating, according to a perspective deformation of the target image, a distance of the movable electronic device from a center line of the virtual wall;
    根据所述可移动电子设备偏离所述虚拟墙的中线的距离,使所述可移动电子设备沿着与所述虚拟墙平行的轨迹返回所述虚拟墙的中线上。The movable electronic device is returned to a center line of the virtual wall along a trajectory parallel to the virtual wall according to a distance of the movable electronic device from a center line of the virtual wall.
  16. 如权利要求12所述的地图构建方法,其特征在于,所述可移动电子设备包括主动轮和从动轮,所述方法还包括步骤:The map construction method according to claim 12, wherein the removable electronic device comprises a driving wheel and a driven wheel, and the method further comprises the steps of:
    在所述可移动电子设备沿任意直线行进过程中,当任意时刻检测到所述可移动电子设备的主动轮的速度与从动轮的速度不一致时,以所述主动轮的速度和所述从动轮的速度中的较小值作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the traveling of the movable electronic device along an arbitrary straight line, when the speed of the driving wheel of the movable electronic device is detected to be inconsistent with the speed of the driven wheel at any time, the speed of the driving wheel and the driven wheel The smaller of the speeds is used as the reference speed, and the displacement and direction of the movable electronic device relative to the coordinate origin are calculated according to the reference speed;
    在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度小于理论速度时,以所述从动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the turning of the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be less than the theoretical speed at any time, the speed of the driven wheel is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
    在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度大于所述理论速度时,以所述主动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;所述理论速度根据所述主动轮的速度计算得到。In the process of turning the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be greater than the theoretical speed at any time, the speed of the driving wheel is used as a reference speed And calculating, according to the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin; the theoretical speed is calculated according to a speed of the driving wheel.
  17. 一种基于机器视觉的虚拟墙构建装置基于机器视觉的虚拟墙构建装置,其特征在于,所述基于机器视觉的虚拟墙构建装置设于可移动电子设备,包括:A machine-based virtual wall building device based on machine vision is characterized in that the machine vision-based virtual wall building device is disposed on the mobile electronic device, and includes:
    摄像头,用于在所述可移动电子设备遍历待定位区域的过程中,以预设的频率实时采集周围环境的图像;a camera for collecting an image of the surrounding environment in real time at a preset frequency during the traversing of the area to be located by the movable electronic device;
    图像传感器,用于接收每一时刻采集到的图像在所述图像传感器的光敏面上投影形成目标图像;An image sensor for receiving an image acquired at each moment on a photosensitive surface of the image sensor to form a target image;
    存储设备,用于预存多个标记图案;a storage device for pre-storing a plurality of mark patterns;
    控制器,用于根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述存储设备中任一标记图案相匹配时,获取所述目标图像在所述光敏面上的x个关键点;基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离,根据所述虚拟墙与所述可移动电子设备的距离,在与所述特征直线呈预设夹角且与所述光敏面相垂直的面上构建所述虚拟墙;其中,当所述预设夹角等于0°或180°时,则在与所述特征直线平行且与所述光敏面相垂直的面上构建所述虚拟墙;所述目标图像在所述光敏面上的关键点均位于一特征直线上;x≥2。a controller, configured to acquire, according to a preset image matching algorithm, the x key of the target image on the photosensitive surface when the target image acquired at any time matches any of the marking patterns in the storage device Pointing a distance between the virtual wall and the movable electronic device based on a key point of the target image on the photosensitive surface, according to a distance between the virtual wall and the movable electronic device, in a straight line with the feature Constructing the virtual wall at a predetermined angle and perpendicular to the photosensitive surface; wherein, when the predetermined angle is equal to 0° or 180°, then parallel with the feature line and The virtual wall is constructed on a surface perpendicular to the photosensitive surface; the key points of the target image on the photosensitive surface are all located on a characteristic line; x≥2.
  18. 如权利要求17所述的基于机器视觉的虚拟墙构建装置,其特征在于,所述控制器还用于响应于标定指令,控制所述摄像头获取当前时刻所述可移动电子设备正上方的图像,并存储至所述存储设备中作为新的标记图案;通过所述图像匹配算法获取所述标记图案的若干个特征点以及每一所述特征点对应的特征描述子。The machine vision-based virtual wall construction apparatus according to claim 17, wherein the controller is further configured to: in response to the calibration instruction, control the camera to acquire an image directly above the movable electronic device at a current time, And storing in the storage device as a new mark pattern; acquiring, by the image matching algorithm, a plurality of feature points of the mark pattern and a feature descriptor corresponding to each of the feature points.
  19. 如权利要求18所述的基于机器视觉的虚拟墙构建装置,其特征在于,根据预设的图像匹配算法,当任意时刻获取到的目标图像与所述标记图案库中的任一标记图案相匹配时,所述控制器获取所述目标图像在所述光敏面上的x个关键点具体为:The machine vision-based virtual wall construction apparatus according to claim 18, wherein the target image acquired at any time matches any of the mark patterns in the mark pattern library according to a preset image matching algorithm The controller obtains x key points of the target image on the photosensitive surface, specifically:
    通过所述图像匹配算法获取所述目标图像的若干个特征点以及每一所述特征点对应的特征描述子;Obtaining, by the image matching algorithm, a plurality of feature points of the target image and a feature descriptor corresponding to each of the feature points;
    通过计算所述目标图像的每一特征描述子和所述标记图案的每一特征描述子的欧几里得距离,获取所述目标图像与所述标记图案具有匹配关系的特征点,当获取到的具有匹配关系的特征点的数量大于预设的阈值时,则判断所述目标图像与所述标记图案库中的任一标记图案匹配;Obtaining a feature point of the matching relationship between the target image and the mark pattern by calculating a Euclidean distance of each feature descriptor of the target image and each feature descriptor of the mark pattern, when acquiring When the number of feature points having a matching relationship is greater than a preset threshold, determining that the target image matches any of the mark patterns in the mark pattern library;
    根据所述目标图像上具有匹配关系的特征点的位置关系,以其中x个位于同一直线上的特征点作为关键点。According to the positional relationship of the feature points having the matching relationship on the target image, the feature points in which x are on the same straight line are taken as key points.
  20. 如权利要求19所述的基于机器视觉的虚拟墙构建装置,其特征在于,所述图像匹配算法为 尺度不变特征变换算法或加速稳健特征算法,所述标记图案/目标图像的每一特征描述子通过控制器采用以下步骤获取:A machine vision-based virtual wall construction apparatus according to claim 19, wherein said image matching algorithm is The scale invariant feature transform algorithm or the accelerated robust feature algorithm, each feature descriptor of the mark pattern/target image is obtained by the controller by using the following steps:
    通过高斯模糊建立标记图像/目标图像的尺度空间,通过高斯微分函数识别所述标记图像/目标图像的尺度空间中的极值点,对所述标记图像/目标图像的尺度空间中的极值点进行校验,去除所述标记图像/目标图像的尺度空间中的不稳定极值点,从而获得所述标记图像/目标图像的特征点及所述特征点的尺度和位置;The scale space of the marker image/target image is established by Gaussian blur, and the extreme point in the scale space of the marker image/target image is identified by a Gaussian differential function, and the extreme point in the scale space of the marker image/target image Performing a check to remove an unstable extreme point in the scale space of the mark image/target image, thereby obtaining a feature point of the mark image/target image and a scale and a position of the feature point;
    根据所述标记图像/目标图像中每一所述特征点的邻域像素的梯度方向分布特性,为每一所述特征点赋予方向;And assigning a direction to each of the feature points according to a gradient direction distribution characteristic of a neighboring pixel of each of the feature points in the mark image/target image;
    根据所述标记图像/目标图像中每一所述特征点的尺度、位置和方向,通过对所述特征点的周围图像进行区域分块,计算块内梯度直方图,从而生成所述特征点的特征描述子。Calculating an intra-block gradient histogram by performing area segmentation on a surrounding image of the feature point according to a scale, a position, and a direction of each of the feature points in the mark image/target image, thereby generating the feature point Feature descriptor.
  21. 如权利要求17所述的基于机器视觉的虚拟墙构建装置,其特征在于,所述摄像头还包括成像透镜,通过摄像头采集到的图像通过成像透镜投影至所述图像传感器的光敏面;所述虚拟墙与所述可移动电子设备的距离通过三角测距法计算得到。The machine vision-based virtual wall construction apparatus according to claim 17, wherein the camera further comprises an imaging lens, and an image captured by the camera is projected through an imaging lens to a photosensitive surface of the image sensor; The distance between the wall and the movable electronic device is calculated by a triangulation method.
  22. 如权利要求21所述的基于机器视觉的虚拟墙构建装置,其特征在于,所述控制器基于所述目标图像在所述光敏面上的关键点计算虚拟墙与所述可移动电子设备的距离具体为:The machine vision-based virtual wall construction apparatus according to claim 21, wherein the controller calculates a distance between the virtual wall and the movable electronic device based on a key point of the target image on the photosensitive surface Specifically:
    通过以下公式计算所述虚拟墙与所述可移动电子设备的距离:The distance between the virtual wall and the removable electronic device is calculated by the following formula:
    D=a/b*S*|cosθ|D=a/b*S*|cosθ|
    其中,a为所述虚拟墙的上边框到所述光敏面的距离,b为所述成像透镜和所述光敏面的距离,S为所述特征直线和所述光敏面的中心点的距离,D为所述虚拟墙和所述光敏面的中心点的距离,θ为所述预设夹角。Where a is the distance from the upper border of the virtual wall to the photosensitive surface, b is the distance between the imaging lens and the photosensitive surface, and S is the distance between the characteristic straight line and the center point of the photosensitive surface, D is a distance between the virtual wall and a center point of the photosensitive surface, and θ is the preset angle.
  23. 如权利要求22所述的基于机器视觉的虚拟墙构建装置,其特征在于,所述控制器基于以下公式计算所述虚拟墙的宽度:A machine vision-based virtual wall construction apparatus according to claim 22, wherein said controller calculates the width of said virtual wall based on the following formula:
    Figure PCTCN2017116015-appb-100002
    Figure PCTCN2017116015-appb-100002
    其中,W为所述虚拟墙的宽度,a为所述虚拟墙的上边框到所述光敏面的距离,λ为所述摄像头的广角。Where W is the width of the virtual wall, a is the distance from the upper border of the virtual wall to the photosensitive surface, and λ is the wide angle of the camera.
  24. 如权利要求17所述的基于机器视觉的虚拟墙构建装置,其特征在于,所述图像传感器包括PSD传感器、CCD传感器或CMOS传感器。A machine vision-based virtual wall construction apparatus according to claim 17, wherein said image sensor comprises a PSD sensor, a CCD sensor or a CMOS sensor.
  25. 如权利要求17所述的基于机器视觉的虚拟墙构建装置,其特征在于,当所述虚拟墙与所述可移动电子设备的距离小于预设的距离时,所述控制器还用于通过预设的避开策略移动所述可移动电子设备以使得所述可移动电子设备与所述虚拟墙的距离增大。The machine vision-based virtual wall construction apparatus according to claim 17, wherein when the distance between the virtual wall and the movable electronic device is less than a preset distance, the controller is further configured to pass the pre- The avoidance strategy moves the mobile electronic device such that the distance of the removable electronic device from the virtual wall increases.
  26. 如权利要求17所述的基于机器视觉的虚拟墙构建方法,其特征在于,所述控制器还用于在构建所述虚拟墙后,控制所述可移动电子设备以预设的路径穿过所述虚拟墙。The machine vision-based virtual wall construction method according to claim 17, wherein the controller is further configured to control the movable electronic device to pass through the preset path after constructing the virtual wall. Describe the virtual wall.
  27. 如权利要求17所述的基于机器视觉的虚拟墙构建装置,其特征在于,将采集到的图像投影至设于所述可移动电子设备中的图像传感器的光敏面形成目标图像后,所述控制器还用于对所述目标图像进行透视变形的矫正。The machine vision-based virtual wall construction device according to claim 17, wherein after the captured image is projected onto a photosensitive surface of an image sensor provided in the movable electronic device to form a target image, the control The device is also used to correct the perspective distortion of the target image.
  28. 一种可移动电子设备,其特征在于,包括:A mobile electronic device, comprising:
    如权利要求要求17至27任一项所述的基于机器视觉的虚拟墙构建装置,用于构建虚拟墙;A machine vision-based virtual wall building device according to any one of claims 17 to 27, for constructing a virtual wall;
    所述控制器还用于以所述待定位区域中的任意位置或特定位置作为坐标原点构建坐标系;The controller is further configured to construct a coordinate system by using any position or a specific position in the to-be-positioned area as a coordinate origin;
    编码器,用于在可移动电子设备遍历所述待定位区域的过程中,实时计算所述可移动电子设备相对所述坐标原点的位移和方向;An encoder, configured to calculate, in real time, a displacement and a direction of the movable electronic device relative to the coordinate origin in a process in which the movable electronic device traverses the to-be-positioned area;
    所述控制器还用于接收所述编码器发送的所述可移动电子设备相对所述坐标原点的位移和方向,获取任意时刻所述可移动电子设备在所述坐标系中的坐标值; The controller is further configured to receive a displacement and a direction of the movable electronic device sent by the encoder with respect to the coordinate origin, and acquire coordinate values of the movable electronic device in the coordinate system at any time;
    所述控制器还用于根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的坐标平面,对所述待定位区域进行实时地图构建。The controller is further configured to perform real-time map construction on the to-be-positioned area according to coordinate values of the movable electronic device in the coordinate system and a coordinate plane of the virtual wall.
  29. 如权利要求28所述的一种可移动电子设备,其特征在于,还包括碰撞传感器、激光传感器或红外传感器,当利用碰撞传感器感测到障碍物时,所述控制器基于所述可移动电子设备相对所述起始点的移动方向和移动距离,将所述可移动电子设备当前位置的坐标值作为所述障碍物位置的坐标值;A mobile electronic device according to claim 28, further comprising a collision sensor, a laser sensor or an infrared sensor, said controller being based on said movable electron when an obstacle is sensed by the collision sensor a moving direction and a moving distance of the device relative to the starting point, and a coordinate value of a current position of the movable electronic device as a coordinate value of the obstacle position;
    当利用激光传感器/红外传感器来探测到障碍物时,所述控制器根据激光/红外距离计算原理计算出障碍物相对当前所述可移动电子设备的位置,从而根据当前时刻所述可移动电子设备相对所述起始点的移动方向和移动距离,计算得到当前时刻所述障碍物的坐标值;When the obstacle is detected by the laser sensor/infrared sensor, the controller calculates the position of the obstacle relative to the currently movable electronic device according to the laser/infrared distance calculation principle, so that the movable electronic device according to the current moment Calculating a coordinate value of the obstacle at the current time relative to a moving direction and a moving distance of the starting point;
    所述控制器用于基于所述虚拟墙的坐标平面和每一所述障碍物位置的坐标值,对所述待定位区域进行实时地图构建。The controller is configured to perform real-time map construction on the to-be-positioned area based on a coordinate plane of the virtual wall and coordinate values of each of the obstacle positions.
  30. 如权利要求29所述的一种可移动电子设备,其特征在于,所述待定位区域上设有至少两个定位标签,每一个定位标签对应设置在所述待定位区域的特定位置上,每一所述定位标签信息包括用于区别其绝对位置的唯一编码信息;所述控制器根据所述可移动电子设备在所述坐标系中的坐标值以及所述虚拟墙的位置,对所述待定位区域进行实时地图构建包括:The mobile electronic device according to claim 29, wherein at least two positioning tags are disposed on the to-be-positioned area, and each of the positioning tags is correspondingly disposed at a specific position of the to-be-positioned area, and each The positioning tag information includes unique encoding information for distinguishing its absolute position; the controller determines the to-be-determined according to the coordinate value of the movable electronic device in the coordinate system and the position of the virtual wall Real-time map construction for bit areas includes:
    在遍历过程中,基于所述可移动电子设备相对所述起始点的移动方向和移动距离,计算所述可移动电子设备每一次获取到的定位标签信息时的定位标签的位置的坐标值,并记录定位标签信息及对应的坐标值;Calculating, according to the moving direction and the moving distance of the movable electronic device with respect to the starting point, a coordinate value of a position of the positioning tag when the positioning tag information acquired by the movable electronic device is acquired, and Recording positioning tag information and corresponding coordinate values;
    基于所述虚拟墙的坐标平面、每一所述障碍物位置的坐标值以及每一所述定位标签的信息及其坐标值构建地图。A map is constructed based on a coordinate plane of the virtual wall, coordinate values of each of the obstacle positions, and information of each of the positioning tags and coordinate values thereof.
  31. 如权利要求28所述的一种可移动电子设备,其特征在于,所述控制器还用于根据所述目标图像的透视变形,计算所述可移动电子设备偏离所述虚拟墙中线的距离;根据所述可移动电子设备偏离所述虚拟墙的中线的距离,使所述可移动电子设备沿着与所述虚拟墙平行的轨迹返回所述虚拟墙的中线上。The mobile electronic device according to claim 28, wherein the controller is further configured to calculate a distance of the movable electronic device from the center line of the virtual wall according to a perspective deformation of the target image; The movable electronic device is returned to a center line of the virtual wall along a trajectory parallel to the virtual wall according to a distance of the movable electronic device from a center line of the virtual wall.
  32. 如权利要求28所述的一种可移动电子设备,其特征在于,所述可移动电子设备包括主动轮和从动轮,所述控制器还用于,在所述可移动电子设备沿任意直线行进过程中,当任意时刻检测到所述可移动电子设备的主动轮的速度与从动轮的速度不一致时,以所述主动轮的速度和所述从动轮的速度中的较小值作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;A removable electronic device according to claim 28, wherein said movable electronic device comprises a driving wheel and a driven wheel, and said controller is further for traveling along said straight line at said movable electronic device During the process, when the speed of the driving wheel of the movable electronic device is detected to be inconsistent with the speed of the driven wheel at any time, the smaller of the speed of the driving wheel and the speed of the driven wheel is used as the reference speed. Calculating a displacement and a direction of the movable electronic device relative to the coordinate origin according to the reference speed;
    在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度小于理论速度时,以所述从动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;During the turning of the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be less than the theoretical speed at any time, the speed of the driven wheel is used as a reference speed, according to Calculating, by the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin;
    在所述可移动电子设备以任意中心点进行转弯的过程中,当任意时刻检测到所述可移动电子设备的从动轮的速度大于所述理论速度时,以所述主动轮的速度作为参考速度,根据所述参考速度计算所述可移动电子设备相对所述坐标原点的位移和方向;所述理论速度根据所述主动轮的速度计算得到。 In the process of turning the movable electronic device at an arbitrary center point, when the speed of the driven wheel of the movable electronic device is detected to be greater than the theoretical speed at any time, the speed of the driving wheel is used as a reference speed And calculating, according to the reference speed, a displacement and a direction of the movable electronic device relative to the coordinate origin; the theoretical speed is calculated according to a speed of the driving wheel.
PCT/CN2017/116015 2017-12-13 2017-12-13 Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device WO2019113859A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/116015 WO2019113859A1 (en) 2017-12-13 2017-12-13 Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device
CN201780017028.8A CN109313822B (en) 2017-12-13 2017-12-13 Virtual wall construction method and device based on machine vision, map construction method and movable electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/116015 WO2019113859A1 (en) 2017-12-13 2017-12-13 Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device

Publications (1)

Publication Number Publication Date
WO2019113859A1 true WO2019113859A1 (en) 2019-06-20

Family

ID=65207680

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/116015 WO2019113859A1 (en) 2017-12-13 2017-12-13 Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device

Country Status (2)

Country Link
CN (1) CN109313822B (en)
WO (1) WO2019113859A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112596508B (en) * 2019-08-29 2022-04-12 美智纵横科技有限责任公司 Control method and device of sensor and storage medium
CN111070212B (en) * 2020-01-06 2021-06-01 中联恒通机械有限公司 Vehicle-mounted manipulator control system and method
CN113673603B (en) * 2021-08-23 2024-07-02 北京搜狗科技发展有限公司 Element point matching method and related device
CN114343507A (en) * 2022-01-28 2022-04-15 深圳市优必选科技股份有限公司 Map data generation method and device and sweeping robot
CN114549861A (en) * 2022-02-25 2022-05-27 中科芯集成电路有限公司 Target matching method based on feature point and convolution optimization calculation and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882313A (en) * 2010-07-14 2010-11-10 中国人民解放军国防科学技术大学 Calibration method of correlation between single line laser radar and CCD (Charge Coupled Device) camera
CN204240979U (en) * 2014-08-15 2015-04-01 上海思岚科技有限公司 Micro-optical scanning distance measuring equipment, system and optical ranging system
CN105136434A (en) * 2015-08-12 2015-12-09 中北大学 Device for testing two-dimensional motion rule for plane mechanism
US20170307759A1 (en) * 2016-04-26 2017-10-26 Cepton Technologies, Inc. Multi-Range Three-Dimensional Imaging Systems

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7571511B2 (en) * 2002-01-03 2009-08-11 Irobot Corporation Autonomous floor-cleaning robot
CN103631262B (en) * 2012-08-29 2017-07-04 科沃斯机器人股份有限公司 The self-movement robot domain of walk limits system and its method for limiting
KR102124509B1 (en) * 2013-06-13 2020-06-19 삼성전자주식회사 Cleaning robot and method for controlling the same
CN106774294A (en) * 2015-11-20 2017-05-31 沈阳新松机器人自动化股份有限公司 A kind of mobile robot virtual wall method for designing
CN107063117A (en) * 2017-03-15 2017-08-18 上海大学 Underwater laser synchronous scanning range of triangle imaging system and method based on optical field imaging
CN107063242A (en) * 2017-03-24 2017-08-18 上海思岚科技有限公司 Have the positioning navigation device and robot of virtual wall function
CN106843230B (en) * 2017-03-24 2019-11-19 上海思岚科技有限公司 Virtual wall system and its implementation applied to mobile device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882313A (en) * 2010-07-14 2010-11-10 中国人民解放军国防科学技术大学 Calibration method of correlation between single line laser radar and CCD (Charge Coupled Device) camera
CN204240979U (en) * 2014-08-15 2015-04-01 上海思岚科技有限公司 Micro-optical scanning distance measuring equipment, system and optical ranging system
CN105136434A (en) * 2015-08-12 2015-12-09 中北大学 Device for testing two-dimensional motion rule for plane mechanism
US20170307759A1 (en) * 2016-04-26 2017-10-26 Cepton Technologies, Inc. Multi-Range Three-Dimensional Imaging Systems

Also Published As

Publication number Publication date
CN109313822A (en) 2019-02-05
CN109313822B (en) 2020-04-10

Similar Documents

Publication Publication Date Title
WO2019113859A1 (en) Machine vision-based virtual wall construction method and device, map construction method, and portable electronic device
US12094226B2 (en) Simultaneous localization and mapping method, device, system and storage medium
CN109074083B (en) Movement control method, mobile robot, and computer storage medium
US10939791B2 (en) Mobile robot and mobile robot control method
Goncalves et al. A visual front-end for simultaneous localization and mapping
JP6237326B2 (en) Posture estimation apparatus, posture estimation method, and computer program for posture estimation
WO2024138851A1 (en) Deep learning perception-based multi-level semantic map construction method and apparatus
JP2010267231A (en) Device and method for estimating positional orientation
US11348276B2 (en) Mobile robot control method
WO2019136613A1 (en) Indoor locating method and device for robot
CN108481327A (en) A kind of positioning device, localization method and the robot of enhancing vision
Maier et al. Vision-based humanoid navigation using self-supervised obstacle detection
CN108303094A (en) The Position Fixing Navigation System and its positioning navigation method of array are merged based on multiple vision sensor
CN111964680B (en) Real-time positioning method of inspection robot
CN208289901U (en) A kind of positioning device and robot enhancing vision
CN108544494A (en) A kind of positioning device, method and robot based on inertia and visual signature
KR101456172B1 (en) Localization of a mobile robot device, method and mobile robot
Alcantarilla et al. How to localize humanoids with a single camera?
Yamamoto et al. Optical sensing for robot perception and localization
WO2019113860A1 (en) Color block tag-based virtual wall construction method and apparatus, mapping method, mobile electronic device
Carrera et al. Lightweight SLAM and Navigation with a Multi-Camera Rig.
Maier et al. Appearance-based traversability classification in monocular images using iterative ground plane estimation
Shipitko et al. Linear features observation model for autonomous vehicle localization
CN117490688A (en) AGV navigation method for camera-IMU-two-dimensional code fusion workshop
Strasdat et al. Multi-cue localization for soccer playing humanoid robots

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17934542

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17934542

Country of ref document: EP

Kind code of ref document: A1