WO2019113968A1 - Image content-based structured light projection method , depth detection method and structured light projection apparatus - Google Patents

Image content-based structured light projection method , depth detection method and structured light projection apparatus Download PDF

Info

Publication number
WO2019113968A1
WO2019113968A1 PCT/CN2017/116586 CN2017116586W WO2019113968A1 WO 2019113968 A1 WO2019113968 A1 WO 2019113968A1 CN 2017116586 W CN2017116586 W CN 2017116586W WO 2019113968 A1 WO2019113968 A1 WO 2019113968A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
structured light
highlight
light
projected
Prior art date
Application number
PCT/CN2017/116586
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/116586 priority Critical patent/WO2019113968A1/en
Priority to CN201780034793.0A priority patent/CN109661683B/en
Publication of WO2019113968A1 publication Critical patent/WO2019113968A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/529Depth or shape recovery from texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • G06T7/586Depth or shape recovery from multiple images from multiple light sources, e.g. photometric stereo

Definitions

  • the present application relates to the field of image processing and machine vision technology, and in particular, to a projected structured light method and a depth detecting method based on image content.
  • Vision is the most direct and important way of human observation and cognitive world. We live in a three-dimensional world. Human vision can not only sense the brightness, color, texture information, motion of the surface of the object, but also its shape, space and spatial position (depth, distance). How to make machine vision obtain high-precision 3D depth information in real time and improve the intelligence level of the machine is the difficulty of current machine vision system research.
  • Depth sensing technology and devices In the industrial field, high-resolution, high-precision 3D depth information has a wide range of applications in automotive-assisted safe driving, high-speed machine tool processing, industrial modeling, 3D printing, medical imaging, and IoT 3D visual perception. demand. In the field of consumer electronics, deep sensing technology and devices help to improve the intelligence level and interaction capabilities of electronic products, and bring new human-computer interaction experience to users, enabling innovative applications in smart TVs, smart phones, home appliances, tablet PCs, etc. .
  • Depth sensing technology can be roughly divided into passive and active.
  • Traditional binocular stereo vision ranging is a passive ranging method, which is greatly affected by ambient light and complicated in stereo matching process.
  • Active ranging methods mainly include structured optical coding and ToF.
  • the active visual mode based on the structured optical coding can acquire the image depth information more accurately.
  • the principle of detecting the depth image by projecting the structured light is as shown in FIG. 1.
  • the structured light projection module 110 projects the structured light and is reflected by the lens. 120 is incident, the CCD photosensitive element 130 detects the reflected light, taking the n-th ray 101 of the structured light as an example.
  • the light exit angle a1 is known
  • the distance d between the reference plane and the lens 120 is known
  • the CCD photosensitive element 130 The incident point x of the light reflected by the reference plane is detected, and the incident point x' of the reflected light of the measured object is obtained, so that the incident angle a2 of the reflected light of the measured object entering the lens 120 can be obtained, so that the distance d' of the measured object can be calculated.
  • the above is the basic principle of measuring the depth of the object by the structured light projection, and analyzing the structured light ID (number) of the light bar or the scatter point, and knowing the ID to know the incident angle, the surface of the object corresponding to the reflected light can be calculated according to the triangular principle.
  • the depth (distance) is actually different depending on the structural light used, the lens, the photosensitive element, and the like.
  • the stripe structure light is projected to have a certain width, and the stripe width should be as narrow as possible to capture a finer depth variation. But the thing is that the stripes are denser and denser and harder to distinguish.
  • the general practice is to project multiple frames, from coarse to fine, such as Greencode.
  • the detection period is greatly extended and the accuracy is not accurate to the pixel level.
  • There are also some methods of scanning the object to be inspected with the gradient stripe but it is highly susceptible to external light interference. When there is other background light interference, the analysis of the above ID is easily disturbed, and the depth of the solution is problematic. Since the structured light is often disturbed by the background light, the matching effect of the structured light is greatly reduced.
  • the purpose of the present application is to provide an image content-based projection structure light method, a depth detection method, and a structure light projection device that reduce background light interference.
  • the present application provides a projected structured light method based on image content, including:
  • the image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
  • Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
  • the method for projecting structured light based on image content in the present application first acquires an image of an object that is not affected by external light, and after obtaining an image of the object, obtaining an edge of the object and a non-edge region of the object, projecting a corresponding first grayscale gradient strip and The second grayscale gradient strip.
  • This method very fine structured light can be obtained, which is based on image content, is not affected by external light, and the calculation of structured light is not difficult, the number of projected frames is not much, and the interference against external light is also good.
  • the present application also provides a depth detecting method using the image structure-based projected structured light method, including:
  • the image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
  • Projecting the first structured light including respectively projecting a first grayscale gradient strip to the non-edge region of the object, and projecting a second grayscale gradient strip to the edge region;
  • the depth detecting method uses different structured light for the edge of the object and the non-edge region of the object, and can obtain the depth change of the non-edge region of the object and the depth contour of the edge of the object as much as possible, and the obtained depth image is more accurate and can be easily solved.
  • the acquired coded image blocks are classified.
  • the analyzing the image of the object further comprises obtaining a highlight region of the image of the object, wherein the projected first structured light, wherein the non-edge region of the object is projected
  • the first grayscale gradient strip includes: a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-highlight region, and the highlight portion structured light projected to the highlight region is projected to the highlight region from the previous time The light is dark.
  • the image pixels for the highlight region can be reduced, and the difference may be different in different embodiments.
  • the high-light partial structure light projected on the highlight region is darker than the light projected to the highlight region in the previous time, and is less than half the brightness of the light projected from the previous highlight region.
  • Light For example, if it is detected that the image obtained after the previous projection of the structured light has a highlight region, the brightness of the projected light that projects the highlight portion of the highlight portion again is reduced to 128; for example, the brightness of the light projected to the highlight region for the previous time.
  • the acquired image still detects that the pixel brightness is 255
  • the brightness of the structured light of the highlight portion is reduced to 64, and then continues until the detected image brightness is less than 255, and the projected brightness is no longer lowered.
  • the second gradation gradient strip projected on the edge region of the object and the structural light of the object portion of the first gradation gradient strip projected on the non-edge region of the object may be simultaneously reduced Brightness, or the same as the previous brightness, can be.
  • the step of analyzing an image of an object that is not affected by external light to obtain a highlight region of the image of the object includes a highlight overflow detection, and the highlight overflow detection may have multiple criteria for judging The requirements are set.
  • the blooming detection includes: determining a gray value of a pixel, where the number n of adjacent pixels having a gray value of 255 is greater than or equal to a preset threshold x, determining the gray value The area where the adjacent pixels of 255 are located is a highlight area.
  • the present invention adopts the depth detection method of the image structure-based projected structured light method, and analyzes the object image that is not affected by external light, and further includes obtaining an object edge of the object image, a non-edge region of the object, and a highlight region, according to Obtaining the structured image, the structured light includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the non-edge region of the object is projected
  • a grayscale gradient strip includes: a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-highlight region, and the highlight portion structured light projected to the highlight region is projected to the highlight region from the previous time. The light is dark.
  • the image of the object obtained by the method greatly reduces the influence of external light, and the constraint is greatly reduced by the edge, the highlight, and the like.
  • a preferred embodiment includes: after the projecting the first structured light, the method further comprises:
  • the method includes: projecting a first grayscale gradient strip on the non-edge region of the object, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight portion structured light projected to the highlight region and an object portion projected to the non-highlight region
  • the structured light, the highlight portion of the light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
  • the present application adopts the depth detection method of the projected structure light method based on the image content, and after analyzing the current image, performs strategy adjustment on the projected structured light and the number of projections, and uses the structured light method to project the non-edge region of the object.
  • a first grayscale gradient strip projecting a second grayscale gradient strip to the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight portion structured light and a non-highlight region projected to the highlight region
  • the projected object partially structs light, and the highlight portion of the projected light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
  • the structured light projection method may also have other implementation manners, such as analyzing the current image. If the edge of the obtained object is large and complicated, the second grayscale gradient strip of the frame is separately projected on the edge of the object, or in the object. The second grayscale gradient strip is projected a few times at the edge, and the obtained multi-frame image is superimposed to solve the depth of the edge.
  • the number of times the structured light is projected may be determined according to the condition of the previous frame image, and the multi-frame structured light may be projected, and the structured light of each frame is darker than the structure light of the previous frame to obtain a more accurate object image.
  • the first grayscale gradient stripe and the second grayscale gradient stripe have different grayscale value regions.
  • the gray value of the second grayscale gradient stripe is 128-256
  • the grayscale value of the first grayscale gradient stripe is 0-128, or other different value regions.
  • the first grayscale gradient strip and the second grayscale gradient strip have different gradient stripe arrangement manners, and the first grayscale gradient strip and the second grayscale gradient strip The gradation of the pixels in the adjacent area is inconsistent.
  • the first grayscale gradient strip and the second grayscale gradient strip can be distinguished from each other, so that the two can be more accurately calculated for the edge of the object and the depth of the surface of the object.
  • the analyzing the acquired image of the object and determining whether the highlight image includes the highlight region includes: determining a gray value of the pixel, and selecting a neighboring pixel with a gray value of 255 If the number n is greater than or equal to the preset threshold x, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area; or the pixel of the gray value is judged, and the number of adjacent pixels of the gray value is 255 When the ratio of the number n of the total number of pixels of the object image exceeds a preset threshold y, it is determined that the area of the adjacent pixel whose gradation value is 255 is a highlight area.
  • the image of the object that is not affected by external light includes:
  • the obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
  • the subtracting the acquired two frames of images to obtain an object image that is not affected by external light includes: subtracting the pixel-by-pixel grayscale of the image of the second frame by pixel-by-pixel grayscale The pixel gradation after subtraction.
  • the first grayscale gradient strip is projected on the non-edge region of the object, and the entire strip of the first grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the gray between adjacent pixels along the grayscale gradient direction The degree is different, and the gray level of adjacent pixels increases or decreases along the gray level gradient direction.
  • the second grayscale gradient strip is projected along an edge of the object, and the width of the second grayscale gradient strip is D and the width spans the edge of the object, and the grayscale gradient direction of the second grayscale gradient stripe and the edge of the object Consistently, there is no repeating texture along the grayscale gradient direction of the entire strip of the second grayscale gradient strip, and the gray scales of adjacent pixels along the grayscale gradient direction are different, and the gray scales of adjacent pixels are increased along the grayscale gradient direction or Decrement.
  • the first grayscale gradient stripe and the second grayscale gradient stripe do not coincide with pixel grayscales in adjacent regions.
  • the present application is based on a projected structured light method of an image content and a depth detecting method.
  • the image detecting of the object tracking may be applied, after the first structured light is projected, and the object image of the first structured light is acquired. And projecting the first structured light to the object again, acquiring the image of the object after the first structured light is projected, repeatedly projecting the first structured light, acquiring a plurality of the image of the object, and obtaining an image continuously tracked by the object.
  • the application also provides a structured light projection device, comprising:
  • a storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
  • the image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
  • Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
  • the image of the object that is not affected by external light includes:
  • the obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
  • the analyzing the image of the object that is not affected by external light further comprising obtaining a highlight region of the image of the object, wherein the first structured light is projected, wherein the first gray projected on the non-edge region of the object
  • the gradient strip includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is darker than the previous projected light to the highlight region .
  • the highlight portion structured light projected on the highlight region is darker than the light projected to the highlight region in the previous time, and is a light that is projected to be half the brightness of the light projected from the highlight region in the previous time.
  • the step of analyzing the image of the object that is not affected by the external light to obtain a highlight region of the object image includes a highlight overflow detection, and the highlight overflow detection is to determine the gray value of the pixel, and the gray value is If the number n of adjacent pixels of 255 is greater than or equal to the preset threshold x, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area; or the gray value of the pixel is determined, and the gray value is When the ratio of the number n of adjacent pixel points of 255 to the total number of pixel points of the object image exceeds a preset threshold y, it is determined that the area of the adjacent pixel whose gradation value is 255 is a highlight area.
  • the instructions stored by the storage device further include after projecting the first structured light:
  • the method includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight projected on the highlight region Partially structured light and part of the structured light projected onto the non-highlighted region, the highlight portion of the structured light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
  • the step of determining whether the object image includes the highlight region in the object image after the acquired object image of the previous frame structured light includes: determining the gray value of the pixel, and the gray value is 255. If the number n of adjacent pixels is greater than or equal to the preset threshold x, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area; or the gray value of the pixel is judged, and the gray value is 255. When the ratio of the number of adjacent pixels to the total number of pixels of the object image exceeds a preset threshold y, it is determined that the region where the adjacent pixel of the gradation value is 255 is a highlight region.
  • the subtracting the acquired two frames of images to obtain an object image that is not affected by external light includes: subtracting the pixel-by-pixel grayscale of the first frame image from the pixel-by-pixel grayscale of the second frame image to obtain a phase Subtracted pixel grayscale.
  • the first grayscale gradient strip is projected on the non-edge region of the object, and the entire strip of the first grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the gray between adjacent pixels along the grayscale gradient direction The degree is different, and the gray level of adjacent pixels increases or decreases along the gray level gradient direction.
  • the second grayscale gradient strip is projected along the edge of the object, and the width of the second grayscale gradient strip is D and the width spans the edge of the object, and the grayscale gradient direction of the second grayscale gradient strip is The edges of the object are consistent, and the entire strip of the second grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the grayscale between adjacent pixels along the grayscale gradient direction is different, and the adjacent pixel grayscale along the grayscale gradient direction Increment or decrement.
  • the first grayscale gradient stripe and the second grayscale gradient stripe have different gradient stripe arrangement manners, and the first grayscale gradient stripe is adjacent to the second grayscale gradient stripe
  • the pixel gradation of the area is inconsistent.
  • the present application adopts the image structure-based projection structure light method and the depth detection method, firstly acquiring an object image that is not affected by external light, and differently using the object edge from the non-edge area of the object.
  • the structured light after projecting the first structured light, acquires an image of the object after projecting the first structured light, and obtains a depth change of the non-edge region of the object and a depth profile of the edge of the object as much as possible, and the obtained depth image is more accurate. It is also convenient to classify the obtained coded image blocks when solving.
  • the method of the present application can obtain very fine structured light, and the calculation of the structured light is not difficult, and the number of projection frames is not much, which can effectively eliminate the interference of external light.
  • Figure 1 is a basic schematic diagram of depth detection
  • FIG. 2 is a schematic diagram of an embodiment of a method for projecting structured light based on image content of the present application
  • FIG. 3 is a schematic diagram of the comparison between the projected light and the image obtained after light transmission in the present application.
  • the present application is based on an image structure of a projected structure light method embodiment, including:
  • the gradient strip includes: a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is darker than the previous projected light to the highlight region .
  • the high-light portion structured light projected to the highlight region is darker than the global projected white light, that is, darker than the brightness of the previous projected light.
  • the high-light partial structure light projected on the highlight region is darker than the brightness of the previous projection light to obtain a more accurate depth image after projecting the structured light, and can effectively eliminate interference from external light.
  • a high-light partial structure light of 128 luminance is projected on the highlight region for a pixel point having a grayscale value of 255 in the highlight region.
  • the edge detection uses a Canny edge detection algorithm, referred to as the Canny algorithm.
  • the Canny algorithm is John F. Canny. 1986 A multi-level edge detection algorithm developed in the year.
  • the purpose of edge detection is to significantly reduce the data size of an image while preserving the original image attributes.
  • the Canny algorithm is a long-standing method, it can be said to be a standard algorithm for edge detection and is still widely used in research.
  • Canny The goal is to find an optimal edge detection algorithm. The meaning of optimal edge detection is:
  • Optimal detection the algorithm can identify the actual edges in the image as much as possible, and the probability of missing the true edge and the probability of false detection of the non-edge are as small as possible;
  • Optimal positioning criterion the position of the detected edge point is closest to the position of the actual edge point, or the extent to which the detected edge deviates from the true edge of the object due to the influence of noise;
  • the detection point corresponds one-to-one with the edge point: the edge point detected by the operator should have a one-to-one correspondence with the actual edge point.
  • a variational method is used, which is a method of finding a function that optimizes a specific function.
  • the optimal detection is represented by four exponential function terms, but it is very similar to the first derivative of the Gaussian function.
  • the Canny edge detection algorithm can be divided into the following five steps:
  • the step of analyzing the image of the object to obtain an edge of the object and a highlight region includes performing edge detection and highlight overflow detection.
  • the highlight overflow detection includes: determining a gray value of a pixel, where the number n of adjacent pixel points whose gray value is 255 is greater than or equal to a preset threshold x, determining that the adjacent pixel whose gray value is 255 is located
  • the area is a highlight area.
  • the preset threshold y 5%, or other values.
  • the first grayscale gradient strip and the second grayscale gradient strip adopt a grayscale structured light strip.
  • the first grayscale gradient strip is projected on the non-edge region of the object, and the entire strip of the first grayscale gradient strip has no repeating texture along the grayscale gradient direction, that is, in the uniform direction along the grayscale gradient, there is no arbitrary
  • the gray levels of the pixels are the same, and the gray levels between adjacent pixels along the gray level gradient direction are different. This difference may be manifested by increasing or decreasing the gray level of adjacent pixels along the gray level gradient direction.
  • the second grayscale gradient strip is projected along the edge of the object, and the width of the second grayscale gradient strip is D and the width spans the edge of the object, that is, the second grayscale gradient stripe projected along the edge of the object.
  • the gray-graded direction of the second gray-graded strip is consistent with the extending direction of the object edge, and the entire strip of the second gray-graded strip has no repeating texture along the gray-graded direction, that is, along the gray
  • the gradation of any pixel is the same, and the gradation of the adjacent pixels along the gradation direction of the gradation is different.
  • the difference may be represented by the adjacent pixel gray along the gradation direction.
  • the degree is incremented or decremented.
  • the first grayscale gradient strip is different from the grayscale value range of the second grayscale gradient strip.
  • the gray value of the second grayscale gradient stripe is 128-256
  • the grayscale value of the first grayscale gradient stripe is 0-128, or other different value regions.
  • the first grayscale gradient strip and the second grayscale gradient strip have different gradient stripe arrangement manners, and the first grayscale gradient strip and the second grayscale gradient strip The gradation of the pixels in the adjacent area is inconsistent.
  • the first grayscale gradient strip and the second grayscale gradient strip can be distinguished from each other, so that the two can be more accurately calculated for the edge of the object and the depth of the surface of the object.
  • the above step (5) may be repeated, and the first structured light is projected a plurality of times to obtain a plurality of images of the object at different time points.
  • the application is applied to perform high-precision depth detection on an object, and further optimize the structured light on the basis of the above step (5), and then project the structured light again, further acquire an image, obtain a plurality of images, and perform superposition operation. Get the depth of the object.
  • the number of times the structured light is projected can be judged based on the image obtained by projecting the structured light from the previous time, and the specific implementation is as follows.
  • step (5) acquiring the third frame image, and further comprising determining whether to project the second structured light according to the third frame image to acquire the fourth frame image.
  • Determining whether to project the second structured light to acquire the fourth frame image according to the third frame image includes determining whether the highlight image is included in the third frame image, and if the third frame image includes a highlight region, projecting a second structured light, the projected second structured light comprising: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale projected on the non-edge region of the object
  • the gradient strip includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is projected to the highlight region in the first structured light
  • the intensity of the structured light in the highlight portion is dark.
  • the highlight portion of the second structured light structures the light of 128 brightness.
  • Determining whether the highlight region is included in the image of the third frame includes determining whether there is a pixel having a gray value of 255 in the image of the third frame, and determining whether the number n of pixels having a gray value of 255 is greater than 1, To include a highlight region; or to determine that if the number n of adjacent pixel points whose gray value is 255 is greater than or equal to a preset threshold x, it is determined that the region where the adjacent pixel of the gray value is 255 is a highlight region.
  • the ratio of the number of adjacent pixel points n of the RGB value in the image of the third frame to the total number of pixel points of the object image exceeds a preset threshold y, and if the threshold value y is exceeded, the gray value is determined.
  • the area where the adjacent pixels of 255 are located is a highlight area.
  • the preset threshold y 5%, or other values.
  • the projecting the second structured light further includes determining, according to the fourth frame image, whether to project the third structured light to acquire the fifth frame image.
  • Determining whether to project the third structured light to acquire the fifth frame image according to the fourth frame image includes determining whether the highlight image is included in the fourth frame image, and if the fourth frame image includes a highlight region, projecting a third structured light, the projected third structured light comprising: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale projected on the non-edge region of the object
  • the gradient strip includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is projected to the highlight region in the second structured light
  • the intensity of the structured light in the highlight portion is dark.
  • the highlight portion of the third structured light structures the light of 64 brightness.
  • Determining whether the highlight region is included in the image of the fourth frame includes determining whether there is a pixel having a gray value of 255 in the image of the fourth frame, and determining whether the number n of pixels having a gray value of 255 is greater than 1, To include a highlight region; or to determine that if the number n of adjacent pixel points whose gray value is 255 is greater than or equal to a preset threshold x, it is determined that the region where the adjacent pixel of the gray value is 255 is a highlight region.
  • the ratio of the number of adjacent pixel points n of the RGB value in the fourth frame image to the total number of pixel points of the object image exceeds a preset threshold y, and if the threshold value y is exceeded, the gray value is determined.
  • the area where the adjacent pixels of 255 are located is a highlight area.
  • the preset threshold y 5%, or other values.
  • the projected light intensity of the projected highlight portion can be no longer reduced.
  • the method of the present application can obtain very fine structured light, and the calculation of the structured light is not difficult; the number of projected frames is not much; the interference against external light is also good.
  • the projection light source is controllable (ie, any pattern can be controlled to be output, and most of the structured light sensors adopt this solution;
  • the projection light source is generally a general projector such as a laser projector or a DMD).
  • the application also provides a structured light projection device, comprising:
  • a storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
  • the image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
  • Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
  • the application also provides a depth detecting device, comprising:
  • a storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
  • the image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
  • Projecting the first structured light including respectively projecting a first grayscale gradient strip to the non-edge region of the object, and projecting a second grayscale gradient strip to the edge region;

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

An image content-based structured light projection method , comprising: firstly acquiring an image of an object that is not affected by external light; projecting first structured light, wherein same comprises projecting a first grayscale gradient strip onto a non-edge region of the object, and projecting a second grayscale gradient strip onto an edge region; and acquiring an image of the object after the first structured light is projected. The depth variation of the non-edge region of the object and the depth contour of the edge of the object can be obtained, and the obtained depth image is more accurate, thereby also making it convenient to classify the obtained coded image blocks during calculation. Further disclosed are a depth detection method and a structured light projection apparatus using same. According to the method, very fine structured light can be obtained, the calculation difficulty for the structured light is not great, there are not many projection frames, and the interference caused by external light can be effectively eliminated.

Description

基于图像内容的投射结构光方法、深度检测方法及结构光投射装置 Projected structured light method based on image content, depth detecting method and structured light projection device
【技术领域】[Technical Field]
本申请涉及图像处理、机器视觉技术领域,尤其涉及一种基于图像内容的投射结构光方法及深度检测方法。The present application relates to the field of image processing and machine vision technology, and in particular, to a projected structured light method and a depth detecting method based on image content.
【背景技术】 【Background technique】
视觉是人类观察与认知世界最直接、最主要的途径。我们生活在一个三维世界中,人类视觉不仅能感知物体表面的亮度、颜色、纹理信息,运动情况,而且能判断其形状、空间及空间位置(深度、距离)。如何让机器视觉能实时获得高精度的三维深度信息、提高机器的智能水平是当前机器视觉系统研究的难点。Vision is the most direct and important way of human observation and cognitive world. We live in a three-dimensional world. Human vision can not only sense the brightness, color, texture information, motion of the surface of the object, but also its shape, space and spatial position (depth, distance). How to make machine vision obtain high-precision 3D depth information in real time and improve the intelligence level of the machine is the difficulty of current machine vision system research.
深度感知技术和装置在工业领域,高分辨率、高精度的三维深度信息在汽车辅助安全驾驶、高速机床加工、工业建模、3D打印、医疗成像、物联网3D视觉感知等领域有着广泛的应用需求。在消费电子领域,深度感知技术和装置有助于提高电子产品的智能水平和交互能力,可为用户带来全新的人机交互体验,在智能电视、智能手机、家电、平板PC等实现创新应用。Depth sensing technology and devices In the industrial field, high-resolution, high-precision 3D depth information has a wide range of applications in automotive-assisted safe driving, high-speed machine tool processing, industrial modeling, 3D printing, medical imaging, and IoT 3D visual perception. demand. In the field of consumer electronics, deep sensing technology and devices help to improve the intelligence level and interaction capabilities of electronic products, and bring new human-computer interaction experience to users, enabling innovative applications in smart TVs, smart phones, home appliances, tablet PCs, etc. .
深度感知技术大致可分为被动式和主动式。传统的双目立体视觉测距一种被动式测距方法,其受环境光影响大、立体匹配过程复杂。主动式测距方法主要有结构光编码和ToF两种方法。其中基于结构光编码的主动视觉模式可以较为准确地获取图像深度信息,其通过投射结构光检测深度图像的原理如图1所示,结构光投影模组110投射出结构光,经反射后由透镜120入射,CCD感光元件130检测反射光,以结构光第n条光线101为例,如图所示,光线出射角度a1已知,参考平面与透镜120之间距离d已知,CCD感光元件130检测到由参考平面反射的光线入射点x,被测物体反射光线的入射点x’,可得到被测物体反射光线入射透镜120的入射角a2,因此可计算出被测物体距离d’。上述为结构光投影测算物体深度的基本原理,对光条、或散点等的结构光ID(编号)进行解析,知道ID就知道入射角,就可根据三角原理计算反射光对应的物体表面处的深度(距离),实际上根据所采用的结构光不同、透镜、感光元件等条件的变化,计算方式会有不同的变化。现有技术采用条纹结构光的方法中,条纹结构光投射出来是有一定宽度的,为捕捉更精细的深度变化,条纹宽度也要尽量窄。但带来的就是条纹要更密,更密就更难区分。一般做法是投射多帧,从粗到细,如格林码。但是检测周期被大大延长,而且精度也无法精确到像素级。也有一些做法是用渐变条纹对被检物体扫描,但其极易受外界光干扰,当有其它背景光干扰时,对上述ID的解析就容易受到干扰,进而解算的深度就出问题。由于结构光经常受背景光干扰,大大降低了结构光的匹配效果。Depth sensing technology can be roughly divided into passive and active. Traditional binocular stereo vision ranging is a passive ranging method, which is greatly affected by ambient light and complicated in stereo matching process. Active ranging methods mainly include structured optical coding and ToF. The active visual mode based on the structured optical coding can acquire the image depth information more accurately. The principle of detecting the depth image by projecting the structured light is as shown in FIG. 1. The structured light projection module 110 projects the structured light and is reflected by the lens. 120 is incident, the CCD photosensitive element 130 detects the reflected light, taking the n-th ray 101 of the structured light as an example. As shown in the figure, the light exit angle a1 is known, the distance d between the reference plane and the lens 120 is known, and the CCD photosensitive element 130 The incident point x of the light reflected by the reference plane is detected, and the incident point x' of the reflected light of the measured object is obtained, so that the incident angle a2 of the reflected light of the measured object entering the lens 120 can be obtained, so that the distance d' of the measured object can be calculated. The above is the basic principle of measuring the depth of the object by the structured light projection, and analyzing the structured light ID (number) of the light bar or the scatter point, and knowing the ID to know the incident angle, the surface of the object corresponding to the reflected light can be calculated according to the triangular principle. The depth (distance) is actually different depending on the structural light used, the lens, the photosensitive element, and the like. In the prior art method of using stripe structured light, the stripe structure light is projected to have a certain width, and the stripe width should be as narrow as possible to capture a finer depth variation. But the thing is that the stripes are denser and denser and harder to distinguish. The general practice is to project multiple frames, from coarse to fine, such as Greencode. However, the detection period is greatly extended and the accuracy is not accurate to the pixel level. There are also some methods of scanning the object to be inspected with the gradient stripe, but it is highly susceptible to external light interference. When there is other background light interference, the analysis of the above ID is easily disturbed, and the depth of the solution is problematic. Since the structured light is often disturbed by the background light, the matching effect of the structured light is greatly reduced.
因此,提供一种减少背景光干扰的结构光匹配投射方法及深度检测方法实为必要。Therefore, it is necessary to provide a structured light matching projection method and a depth detecting method for reducing background light interference.
【发明内容】 [Summary of the Invention]
本申请的目的在于提供一种减少背景光干扰的基于图像内容的投射结构光方法、深度检测方法及结构光投射装置。The purpose of the present application is to provide an image content-based projection structure light method, a depth detection method, and a structure light projection device that reduce background light interference.
为实现上述目的,本申请提供一种基于图像内容的投射结构光方法,其包括: To achieve the above objective, the present application provides a projected structured light method based on image content, including:
获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带。Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
本申请所述基于图像内容的投射结构光方法,首先获取不受外界光线影响的物体图像,在获得物体图像,得到物体边缘、物体非边缘区域之后,投射相应的第一灰度渐变条带和第二灰度渐变条带。通过该方法可以得到非常精细结构光,该结构光基于图像内容,不受外界光线影响,且结构光的解算难度不大,投射帧数也不多,抗外界光的干扰也较好。The method for projecting structured light based on image content in the present application first acquires an image of an object that is not affected by external light, and after obtaining an image of the object, obtaining an edge of the object and a non-edge region of the object, projecting a corresponding first grayscale gradient strip and The second grayscale gradient strip. By this method, very fine structured light can be obtained, which is based on image content, is not affected by external light, and the calculation of structured light is not difficult, the number of projected frames is not much, and the interference against external light is also good.
本申请还提供一种采用所述基于图像内容的投射结构光方法的一种深度检测方法,包括:The present application also provides a depth detecting method using the image structure-based projected structured light method, including:
获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带;Projecting the first structured light, including respectively projecting a first grayscale gradient strip to the non-edge region of the object, and projecting a second grayscale gradient strip to the edge region;
获取投射第一结构光后的物体图像,对该物体图像进行深度解算。Obtaining an object image after projecting the first structured light, and performing depth solution on the object image.
该深度检测方法,对物体边缘与物体非边缘区域使用不同的结构光,可尽可能得到物体非边缘区域的深度变化及物体边缘的深度轮廓,所获得的深度图像更精确,也可方便解算时对获取的编码图像区块进行归类。The depth detecting method uses different structured light for the edge of the object and the non-edge region of the object, and can obtain the depth change of the non-edge region of the object and the depth contour of the edge of the object as much as possible, and the obtained depth image is more accurate and can be easily solved. The acquired coded image blocks are classified.
为获得更精细的结构光,在较佳实施方式中,所述对该物体图像进行分析中,还包括得到物体图像的高光区域,所述投射第一结构光,其中对物体非边缘区域投射的第一灰度渐变条带包括:对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。In order to obtain finer structured light, in a preferred embodiment, the analyzing the image of the object further comprises obtaining a highlight region of the image of the object, wherein the projected first structured light, wherein the non-edge region of the object is projected The first grayscale gradient strip includes: a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-highlight region, and the highlight portion structured light projected to the highlight region is projected to the highlight region from the previous time The light is dark.
这里只要对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线暗,即可减低对高光区域的图像像素,对于暗多少,在不同实施方式中可以不同。Here, as long as the highlight portion structured light projected to the highlight region is darker than the light projected to the highlight region in the previous time, the image pixels for the highlight region can be reduced, and the difference may be different in different embodiments.
较佳实施方式中,所述对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗,是投射比前一次对所述高光区域投射的光线亮度降低一半的光线。例如检测到前一次投射结构光后获得的图像有高光区域,则将对所述高光区域再次投射高光部分结构光的投射光线亮度降为128;又例如前一次对所述高光区域投射的光线亮度为128,获取图像仍检测有像素亮度为255时,再对所述高光区域投射高光部分结构光的亮度降低为64的光线,如此继续,直至检测图像亮度小于255时不再降低投射亮度。在所述再次或多次投射结构光时,对物体边缘区域投射的第二灰度渐变条带,以及对物体非边缘区域投射的第一灰度渐变条带的物体部分结构光,可以同时降低亮度,或与前次亮度相同,均可。In a preferred embodiment, the high-light partial structure light projected on the highlight region is darker than the light projected to the highlight region in the previous time, and is less than half the brightness of the light projected from the previous highlight region. Light. For example, if it is detected that the image obtained after the previous projection of the structured light has a highlight region, the brightness of the projected light that projects the highlight portion of the highlight portion again is reduced to 128; for example, the brightness of the light projected to the highlight region for the previous time. At 128, when the acquired image still detects that the pixel brightness is 255, the brightness of the structured light of the highlight portion is reduced to 64, and then continues until the detected image brightness is less than 255, and the projected brightness is no longer lowered. When the structured light is projected again or again, the second gradation gradient strip projected on the edge region of the object and the structural light of the object portion of the first gradation gradient strip projected on the non-edge region of the object may be simultaneously reduced Brightness, or the same as the previous brightness, can be.
较佳实施方式中,所述对该不受外界光线影响的物体图像进行分析,得到物体图像的高光区域的步骤,包括高光溢出检测,所述高光溢出检测可以有多种判断标准,可以根据具体的需求所设定。In a preferred embodiment, the step of analyzing an image of an object that is not affected by external light to obtain a highlight region of the image of the object includes a highlight overflow detection, and the highlight overflow detection may have multiple criteria for judging The requirements are set.
在一些实施例中,所述高光溢出检测包括,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域。在具体实施例中,所述预设阈值x=5,或x=1,或其他数值。In some embodiments, the blooming detection includes: determining a gray value of a pixel, where the number n of adjacent pixels having a gray value of 255 is greater than or equal to a preset threshold x, determining the gray value The area where the adjacent pixels of 255 are located is a highlight area. In a particular embodiment, the predetermined threshold x=5, or x=1, or other value.
在另一些实施例中,所述高光溢出检测包括,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值y=5%,或其他数值。In other embodiments, the blooming detection includes determining the gray value of the pixel, and the ratio of the number of adjacent pixels n of the gray value to 255 to the total number of pixels of the object image exceeds a preset threshold. y, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area. In a specific embodiment, the preset threshold y=5%, or other values.
本申请采用所述基于图像内容的投射结构光方法的深度检测方法,对该不受外界光线影响的物体图像进行分析中,还包括得到物体图像的物体边缘、物体非边缘区域、高光区域,根据所获得的物体图像,投射上述结构光,该结构光包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括:对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。该方法所获得的物体图像,更大大减少了外界光线的影响,通过边缘、高光等为约束,可大大降低匹配难度。The present invention adopts the depth detection method of the image structure-based projected structured light method, and analyzes the object image that is not affected by external light, and further includes obtaining an object edge of the object image, a non-edge region of the object, and a highlight region, according to Obtaining the structured image, the structured light includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the non-edge region of the object is projected A grayscale gradient strip includes: a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-highlight region, and the highlight portion structured light projected to the highlight region is projected to the highlight region from the previous time. The light is dark. The image of the object obtained by the method greatly reduces the influence of external light, and the constraint is greatly reduced by the edge, the highlight, and the like.
为进一步得到更精细的结构光,在本申请前述结构光方法实施方式的基础上,更佳的实施方式包括,所述投射第一结构光后还包括:In order to further obtain finer structured light, based on the foregoing embodiments of the structured light method of the present application, a preferred embodiment includes: after the projecting the first structured light, the method further comprises:
获取投射前一帧结构光后的物体图像,Obtaining an object image after projecting the previous frame of structured light,
对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域,若图像中包括高光区域,则投射后一帧结构光,所述投射后一帧结构光中包括对物体非边缘区域投射第一灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。And analyzing the acquired image of the object after the previous frame of the structured light, determining whether the object image includes a highlight region, and if the image includes a highlight region, projecting the next frame of structured light, and the projected frame of the structured light The method includes: projecting a first grayscale gradient strip on the non-edge region of the object, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight portion structured light projected to the highlight region and an object portion projected to the non-highlight region The structured light, the highlight portion of the light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
本申请采用所述基于图像内容的投射结构光方法的深度检测方法,对当前图像进行分析后,进行投射结构光及投射次数上的策略调整,如采用上述结构光方法,对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。The present application adopts the depth detection method of the projected structure light method based on the image content, and after analyzing the current image, performs strategy adjustment on the projected structured light and the number of projections, and uses the structured light method to project the non-edge region of the object. a first grayscale gradient strip, projecting a second grayscale gradient strip to the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight portion structured light and a non-highlight region projected to the highlight region The projected object partially structs light, and the highlight portion of the projected light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
该结构光投射方法还可以有其他一些实施方式,如对当前图像进行分析,若所得物体边缘多且复杂,则对物体边缘单独投射一帧渐变区分的第二灰度渐变条带,或在物体边缘处多投射几次第二灰度渐变条带,所获得的多帧图像叠加解算边缘的深度。The structured light projection method may also have other implementation manners, such as analyzing the current image. If the edge of the obtained object is large and complicated, the second grayscale gradient strip of the frame is separately projected on the edge of the object, or in the object. The second grayscale gradient strip is projected a few times at the edge, and the obtained multi-frame image is superimposed to solve the depth of the edge.
投射结构光的次数可根据前一帧图像的情况而定,可投射多帧结构光,每一帧结构光比前一帧结构光均更暗,以获取更精确物体图像。The number of times the structured light is projected may be determined according to the condition of the previous frame image, and the multi-frame structured light may be projected, and the structured light of each frame is darker than the structure light of the previous frame to obtain a more accurate object image.
较佳实施方式中,所述第一灰度渐变条带与所述第二灰度渐变条带的灰度值取值区域不相同。比如:第二灰度渐变条带的灰度值取值区域为128-256,第一灰度渐变条带的灰度值取值区域为0-128,或者是其他的不同取值区域。较佳实施方式中,所述第一灰度渐变条带和第二灰度渐变条带的渐变条纹排布方式不相同,所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致。所述第一灰度渐变条带与所述第二灰度渐变条带两者可以区分开,就可以让两者分布对物体边缘及对物体表面的深度计算更精确。In a preferred embodiment, the first grayscale gradient stripe and the second grayscale gradient stripe have different grayscale value regions. For example, the gray value of the second grayscale gradient stripe is 128-256, and the grayscale value of the first grayscale gradient stripe is 0-128, or other different value regions. In a preferred embodiment, the first grayscale gradient strip and the second grayscale gradient strip have different gradient stripe arrangement manners, and the first grayscale gradient strip and the second grayscale gradient strip The gradation of the pixels in the adjacent area is inconsistent. The first grayscale gradient strip and the second grayscale gradient strip can be distinguished from each other, so that the two can be more accurately calculated for the edge of the object and the depth of the surface of the object.
在较佳实施方式中,所述对所获取的物体图像分析,判断所述物体图像中是否包括高光区域,包括:对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。In a preferred embodiment, the analyzing the acquired image of the object and determining whether the highlight image includes the highlight region includes: determining a gray value of the pixel, and selecting a neighboring pixel with a gray value of 255 If the number n is greater than or equal to the preset threshold x, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area; or the pixel of the gray value is judged, and the number of adjacent pixels of the gray value is 255 When the ratio of the number n of the total number of pixels of the object image exceeds a preset threshold y, it is determined that the area of the adjacent pixel whose gradation value is 255 is a highlight area.
其中,所述获取不受外界光线影响的物体图像包括:The image of the object that is not affected by external light includes:
对全局投射白光,获取第1帧图像;Projecting white light globally to acquire the first frame image;
不投射任何光,获取第2帧图像;Does not project any light, and acquires the image of the second frame;
将获取的所述两帧图像相减得到不受外界光线影响的物体图像。The obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
具体的,所述将获取的所述两帧图像相减得到不受外界光线影响的物体图像,包括:将第2帧图像的逐个像素灰度减去第1帧图像中逐个像素灰度,获得相减后的像素灰度。Specifically, the subtracting the acquired two frames of images to obtain an object image that is not affected by external light includes: subtracting the pixel-by-pixel grayscale of the image of the second frame by pixel-by-pixel grayscale The pixel gradation after subtraction.
其中,所述第一灰度渐变条带在物体非边缘区域投射,第一灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。Wherein, the first grayscale gradient strip is projected on the non-edge region of the object, and the entire strip of the first grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the gray between adjacent pixels along the grayscale gradient direction The degree is different, and the gray level of adjacent pixels increases or decreases along the gray level gradient direction.
所述第二灰度渐变条带沿物体边缘投射,且第二灰度渐变条带的宽度为D并且宽度横跨物体边缘,所述第二灰度渐变条带的灰度渐变方向与物体边缘一致,第二灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致。The second grayscale gradient strip is projected along an edge of the object, and the width of the second grayscale gradient strip is D and the width spans the edge of the object, and the grayscale gradient direction of the second grayscale gradient stripe and the edge of the object Consistently, there is no repeating texture along the grayscale gradient direction of the entire strip of the second grayscale gradient strip, and the gray scales of adjacent pixels along the grayscale gradient direction are different, and the gray scales of adjacent pixels are increased along the grayscale gradient direction or Decrement. The first grayscale gradient stripe and the second grayscale gradient stripe do not coincide with pixel grayscales in adjacent regions.
本申请基于图像内容的投射结构光方法以及深度检测方法,在其他一些实施例中,可应用在对物体追踪的图像检测,则在投射第一结构光,获取投射第一结构光的物体图像之后,对所述物体进行再次投射第一结构光,再次获取投射第一结构光后的物体图像,重复投射第一结构光,获取多个所述物体图像,可获得该物体连续追踪的影像。The present application is based on a projected structured light method of an image content and a depth detecting method. In other embodiments, the image detecting of the object tracking may be applied, after the first structured light is projected, and the object image of the first structured light is acquired. And projecting the first structured light to the object again, acquiring the image of the object after the first structured light is projected, repeatedly projecting the first structured light, acquiring a plurality of the image of the object, and obtaining an image continuously tracked by the object.
本申请还提供一种结构光投射装置,其包括: The application also provides a structured light projection device, comprising:
处理器,适于实现各指令;以及a processor adapted to implement each instruction;
存储设备,适于存储多条指令,所述指令适于由处理器加载并执行:A storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
获取不受外界光线影响的物体图像; Obtain an image of an object that is not affected by external light;
对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带。Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
其中,所述获取不受外界光线影响的物体图像包括:The image of the object that is not affected by external light includes:
对全局投射白光,获取第1帧图像;Projecting white light globally to acquire the first frame image;
不投射任何光,获取第2帧图像;Does not project any light, and acquires the image of the second frame;
将获取的所述两帧图像相减得到不受外界光线影响的物体图像。The obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
在一些实施方式中,所述对该不受外界光线影响的物体图像进行分析中,还包括得到物体图像的高光区域,所述投射第一结构光,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。In some embodiments, the analyzing the image of the object that is not affected by external light, further comprising obtaining a highlight region of the image of the object, wherein the first structured light is projected, wherein the first gray projected on the non-edge region of the object The gradient strip includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is darker than the previous projected light to the highlight region .
其中,所述对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗,是投射比前一次对所述高光区域投射的光线亮度降低一半的光线。The highlight portion structured light projected on the highlight region is darker than the light projected to the highlight region in the previous time, and is a light that is projected to be half the brightness of the light projected from the highlight region in the previous time.
其中,所述对该不受外界光线影响的物体图像进行分析,得到物体图像的高光区域的步骤,包括高光溢出检测,所述高光溢出检测为,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The step of analyzing the image of the object that is not affected by the external light to obtain a highlight region of the object image includes a highlight overflow detection, and the highlight overflow detection is to determine the gray value of the pixel, and the gray value is If the number n of adjacent pixels of 255 is greater than or equal to the preset threshold x, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area; or the gray value of the pixel is determined, and the gray value is When the ratio of the number n of adjacent pixel points of 255 to the total number of pixel points of the object image exceeds a preset threshold y, it is determined that the area of the adjacent pixel whose gradation value is 255 is a highlight area.
在一些实施方式中,所述存储设备存储的指令中还包括在投射第一结构光后:In some embodiments, the instructions stored by the storage device further include after projecting the first structured light:
获取投射前一帧结构光后的物体图像,Obtaining an object image after projecting the previous frame of structured light,
对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域,若图像中包括高光区域,则投射后一帧结构光,所述投射后一帧结构光中包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。And analyzing the acquired image of the object after the previous frame of the structured light, determining whether the object image includes a highlight region, and if the image includes a highlight region, projecting the next frame of structured light, and the projected frame of the structured light The method includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight projected on the highlight region Partially structured light and part of the structured light projected onto the non-highlighted region, the highlight portion of the structured light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
其中,所述对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域的步骤,包括:对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The step of determining whether the object image includes the highlight region in the object image after the acquired object image of the previous frame structured light includes: determining the gray value of the pixel, and the gray value is 255. If the number n of adjacent pixels is greater than or equal to the preset threshold x, it is determined that the area where the adjacent pixel of the gray value is 255 is a highlight area; or the gray value of the pixel is judged, and the gray value is 255. When the ratio of the number of adjacent pixels to the total number of pixels of the object image exceeds a preset threshold y, it is determined that the region where the adjacent pixel of the gradation value is 255 is a highlight region.
其中,所述将获取的所述两帧图像相减得到不受外界光线影响的物体图像,包括:将第2帧图像的逐个像素灰度减去第1帧图像中逐个像素灰度,获得相减后的像素灰度。The subtracting the acquired two frames of images to obtain an object image that is not affected by external light includes: subtracting the pixel-by-pixel grayscale of the first frame image from the pixel-by-pixel grayscale of the second frame image to obtain a phase Subtracted pixel grayscale.
其中,所述第一灰度渐变条带在物体非边缘区域投射,第一灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。Wherein, the first grayscale gradient strip is projected on the non-edge region of the object, and the entire strip of the first grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the gray between adjacent pixels along the grayscale gradient direction The degree is different, and the gray level of adjacent pixels increases or decreases along the gray level gradient direction.
其中,所述第二灰度渐变条带沿物体边缘投射,且第二灰度渐变条带的宽度为D并且宽度横跨物体边缘,所述第二灰度渐变条带的灰度渐变方向与物体边缘一致,第二灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。Wherein the second grayscale gradient strip is projected along the edge of the object, and the width of the second grayscale gradient strip is D and the width spans the edge of the object, and the grayscale gradient direction of the second grayscale gradient strip is The edges of the object are consistent, and the entire strip of the second grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the grayscale between adjacent pixels along the grayscale gradient direction is different, and the adjacent pixel grayscale along the grayscale gradient direction Increment or decrement.
其中,所述第一灰度渐变条带和第二灰度渐变条带的渐变条纹排布方式不相同,所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致。The first grayscale gradient stripe and the second grayscale gradient stripe have different gradient stripe arrangement manners, and the first grayscale gradient stripe is adjacent to the second grayscale gradient stripe The pixel gradation of the area is inconsistent.
有益效果:区别于现有技术的情况,本申请采用所述基于图像内容的投射结构光方法以及深度检测方法,先是获取不受外界光线影响的物体图像,对物体边缘与物体非边缘区域使用不同的结构光,在投射所述第一结构光后,获取投射第一结构光后的物体图像,可尽可能得到物体非边缘区域的深度变化及物体边缘的深度轮廓,所获得的深度图像更精确,也可方便解算时对获取的编码图像区块进行归类。本申请方法可以得到非常精细的结构光,且结构光的解算难度不大,投射帧数也不多,能有效排除外界光线的干扰。Advantageous Effects: Different from the prior art, the present application adopts the image structure-based projection structure light method and the depth detection method, firstly acquiring an object image that is not affected by external light, and differently using the object edge from the non-edge area of the object. The structured light, after projecting the first structured light, acquires an image of the object after projecting the first structured light, and obtains a depth change of the non-edge region of the object and a depth profile of the edge of the object as much as possible, and the obtained depth image is more accurate. It is also convenient to classify the obtained coded image blocks when solving. The method of the present application can obtain very fine structured light, and the calculation of the structured light is not difficult, and the number of projection frames is not much, which can effectively eliminate the interference of external light.
【附图说明】 [Description of the Drawings]
图1是深度检测基本原理图;Figure 1 is a basic schematic diagram of depth detection;
图2是本申请基于图像内容的投射结构光方法实施例的示意图;2 is a schematic diagram of an embodiment of a method for projecting structured light based on image content of the present application;
图3是本申请投射光与透光后获取图像的比对示意图。FIG. 3 is a schematic diagram of the comparison between the projected light and the image obtained after light transmission in the present application.
【具体实施方式】【Detailed ways】
为使本领域的技术人员更好地理解本申请的技术方案,下面结合附图和具体实施方式对本申请做进一步详细描述。To enable those skilled in the art to better understand the technical solutions of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
请参照图2和图3,本申请基于图像内容的投射结构光方法实施例,包括:Referring to FIG. 2 and FIG. 3, the present application is based on an image structure of a projected structure light method embodiment, including:
(1)对全局投射白光,获取第1帧图像;(1) Projecting white light globally to acquire the image of the first frame;
(2)不投射任何光,获取第2帧图像;(2) not projecting any light, acquiring the image of the second frame;
(3)将获取的两帧图像相减得到不受外界光线影响的物体图像;(3) subtracting the acquired two frames of images to obtain an image of the object that is not affected by external light;
(4)对该物体图像进行分析,得到物体边缘、物体非边缘区域、高光区域;(4) analyzing the image of the object to obtain an edge of the object, a non-edge region of the object, and a highlight region;
(5)投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括:对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。在这里,对所述高光区域投射的高光部分结构光比对全局投射白光时的亮度要暗,也就是比前一次投射光线的亮度要暗。(5) projecting the first structured light, comprising: respectively projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale projected on the non-edge region of the object The gradient strip includes: a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is darker than the previous projected light to the highlight region . Here, the high-light portion structured light projected to the highlight region is darker than the global projected white light, that is, darker than the brightness of the previous projected light.
由于检测得高光区域的物体光线高亮,说明该高光区域的亮度已到达最高,若继续投射与前一次同样强度的光线,则只会检测到同样的高光结果,不能获得物体实际深度图像,因此对所述高光区域投射的高光部分结构光要比前一次投射光线的亮度要暗,以获得投射结构光后的更精确的深度图像,并能有效排除外界光线的干扰。Since the light of the object in the highlight area is highlighted, the brightness of the highlight area has reached the highest level. If the light of the same intensity as the previous time is continued, only the same highlight result is detected, and the actual depth image of the object cannot be obtained. The high-light partial structure light projected on the highlight region is darker than the brightness of the previous projection light to obtain a more accurate depth image after projecting the structured light, and can effectively eliminate interference from external light.
具体实施例中,对所述高光区域灰度值等于255的像素点,对所述高光区域投射128亮度的高光部分结构光。In a specific embodiment, a high-light partial structure light of 128 luminance is projected on the highlight region for a pixel point having a grayscale value of 255 in the highlight region.
所述将获取的两帧图像相减得到不受光线影响的物体图像的步骤中包括,将第2帧图像的逐个像素灰度I2(x,y)减去第1帧图像中逐个像素灰度I1(x,y)=I2(x,y) – I1(x,y),获得相减后的像素灰度。The step of subtracting the acquired two frames of images to obtain an object image that is not affected by the light includes: subtracting the pixel-by-pixel grayscale I2 (x, y) of the second frame image by the pixel-by-pixel grayscale of the first frame image I1(x,y)=I2(x,y) – I1(x, y), the pixel gradation after subtraction is obtained.
所述边缘检测采用Canny边缘检测算法,简称Canny算法。Canny算法是John F. Canny于 1986 年开发出来的一个多级边缘检测算法。通常情况下边缘检测的目的是在保留原有图像属性的情况下,显著减少图像的数据规模。目前有多种算法可以进行边缘检测,虽然Canny算法年代久远,但可以说它是边缘检测的一种标准算法,而且仍在研究中广泛使用。Canny 的目标是找到一个最优的边缘检测算法,最优边缘检测的含义是:The edge detection uses a Canny edge detection algorithm, referred to as the Canny algorithm. The Canny algorithm is John F. Canny. 1986 A multi-level edge detection algorithm developed in the year. In general, the purpose of edge detection is to significantly reduce the data size of an image while preserving the original image attributes. There are a variety of algorithms for edge detection. Although the Canny algorithm is a long-standing method, it can be said to be a standard algorithm for edge detection and is still widely used in research. Canny The goal is to find an optimal edge detection algorithm. The meaning of optimal edge detection is:
(1)最优检测:算法能够尽可能多地标识出图像中的实际边缘,漏检真实边缘的概率和误检非边缘的概率都尽可能小;(1) Optimal detection: the algorithm can identify the actual edges in the image as much as possible, and the probability of missing the true edge and the probability of false detection of the non-edge are as small as possible;
(2)最优定位准则:检测到的边缘点的位置距离实际边缘点的位置最近,或者是由于噪声影响引起检测出的边缘偏离物体的真实边缘的程度最小;(2) Optimal positioning criterion: the position of the detected edge point is closest to the position of the actual edge point, or the extent to which the detected edge deviates from the true edge of the object due to the influence of noise;
(3)检测点与边缘点一一对应:算子检测的边缘点与实际边缘点应该是一一对应。(3) The detection point corresponds one-to-one with the edge point: the edge point detected by the operator should have a one-to-one correspondence with the actual edge point.
为了满足这些要求使用了变分法,这是一种寻找优化特定功能的函数的方法。最优检测使用四个指数函数项表示,但是它非常近似于高斯函数的一阶导数。In order to meet these requirements, a variational method is used, which is a method of finding a function that optimizes a specific function. The optimal detection is represented by four exponential function terms, but it is very similar to the first derivative of the Gaussian function.
Canny边缘检测算法可以分为以下5个步骤:The Canny edge detection algorithm can be divided into the following five steps:
1.应用高斯滤波来平滑图像,目的是去除噪声;1. Apply Gaussian filtering to smooth the image in order to remove noise;
2.找寻图像的强度梯度;2. Find the intensity gradient of the image;
3.应用非最大抑制技术来消除边误检;3. Apply non-maximum suppression techniques to eliminate edge false detections;
4.应用双阈值的方法来决定可能的边界;4. Apply a dual threshold method to determine possible boundaries;
5.利用滞后技术来跟踪边界。5. Use hysteresis techniques to track boundaries.
所述对该物体图像进行分析,得到物体边缘、高光区域的步骤,包括做边缘检测和高光溢出检测。The step of analyzing the image of the object to obtain an edge of the object and a highlight region includes performing edge detection and highlight overflow detection.
所述高光溢出检测包括,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值x=5,或x=1,或其他数值。或者是,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值是否超过预设的阈值y,若超过阈值y则判断所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值y=5%,或其他数值。The highlight overflow detection includes: determining a gray value of a pixel, where the number n of adjacent pixel points whose gray value is 255 is greater than or equal to a preset threshold x, determining that the adjacent pixel whose gray value is 255 is located The area is a highlight area. In a specific embodiment, the preset threshold x=5, or x=1, or other values. Alternatively, it is determined whether the pixel gray value is 255, and the ratio of the number n of adjacent pixel points of the gray value to 255 to the total number of pixel points of the object image exceeds a preset threshold y, and if the threshold value y is exceeded, the The area where the adjacent pixel of the gradation value is 255 is the highlight area. In a specific embodiment, the preset threshold y=5%, or other values.
所述第一灰度渐变条带、第二灰度渐变条带采用灰度渐变的结构光条带。所述第一灰度渐变条带在物体非边缘区域投射,第一灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,也就是沿灰度渐变的一致方向上,没有任意像素的灰度是相同的,沿灰度渐变方向的相邻像素间灰度有差异,这种差异体现的方式可以是,沿灰度渐变方向相邻像素灰度递增或递减。The first grayscale gradient strip and the second grayscale gradient strip adopt a grayscale structured light strip. The first grayscale gradient strip is projected on the non-edge region of the object, and the entire strip of the first grayscale gradient strip has no repeating texture along the grayscale gradient direction, that is, in the uniform direction along the grayscale gradient, there is no arbitrary The gray levels of the pixels are the same, and the gray levels between adjacent pixels along the gray level gradient direction are different. This difference may be manifested by increasing or decreasing the gray level of adjacent pixels along the gray level gradient direction.
所述第二灰度渐变条带沿物体边缘投射,且第二灰度渐变条带的宽度为D并且宽度横跨物体边缘,也就是沿物体边缘投射的所述第二灰度渐变条带压过边缘线;所述第二灰度渐变条带的灰度渐变方向与物体边缘延伸方向一致,第二灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,也就是沿灰度渐变的一致方向上,没有任意像素的灰度是相同的,沿灰度渐变方向的相邻像素间灰度有差异,这种差异体现的方式可以是,沿灰度渐变方向相邻像素灰度递增或递减。The second grayscale gradient strip is projected along the edge of the object, and the width of the second grayscale gradient strip is D and the width spans the edge of the object, that is, the second grayscale gradient stripe projected along the edge of the object. Over the edge line; the gray-graded direction of the second gray-graded strip is consistent with the extending direction of the object edge, and the entire strip of the second gray-graded strip has no repeating texture along the gray-graded direction, that is, along the gray In the uniform direction of the gradual gradient, the gradation of any pixel is the same, and the gradation of the adjacent pixels along the gradation direction of the gradation is different. The difference may be represented by the adjacent pixel gray along the gradation direction. The degree is incremented or decremented.
所述第一灰度渐变条带与所述第二灰度渐变条带的灰度值取值区域不相同。比如:第二灰度渐变条带的灰度值取值区域为128-256,第一灰度渐变条带的灰度值取值区域为0-128,或者是其他的不同取值区域。较佳实施方式中,所述第一灰度渐变条带和第二灰度渐变条带的渐变条纹排布方式不相同,所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致。所述第一灰度渐变条带与所述第二灰度渐变条带两者可以区分开,就可以让两者分布对物体边缘及对物体表面的深度计算更精确。The first grayscale gradient strip is different from the grayscale value range of the second grayscale gradient strip. For example, the gray value of the second grayscale gradient stripe is 128-256, and the grayscale value of the first grayscale gradient stripe is 0-128, or other different value regions. In a preferred embodiment, the first grayscale gradient strip and the second grayscale gradient strip have different gradient stripe arrangement manners, and the first grayscale gradient strip and the second grayscale gradient strip The gradation of the pixels in the adjacent area is inconsistent. The first grayscale gradient strip and the second grayscale gradient strip can be distinguished from each other, so that the two can be more accurately calculated for the edge of the object and the depth of the surface of the object.
本申请应用在物体追踪检测时,可重复上述步骤(5),多次投射所述第一结构光,获得物体不同时间点的多个图像。When the present application is applied to object tracking detection, the above step (5) may be repeated, and the first structured light is projected a plurality of times to obtain a plurality of images of the object at different time points.
本申请应用在对物体进行较高精度深度检测时,可在上述步骤(5)的基础上,再进一步优化结构光,然后再次投射结构光,进一步获取图像,获取多个图像后进行叠加运算,获得物体深度。投射结构光的次数可根据前一次投射结构光所获得的图像来判断,具体实施例如下所述。The application is applied to perform high-precision depth detection on an object, and further optimize the structured light on the basis of the above step (5), and then project the structured light again, further acquire an image, obtain a plurality of images, and perform superposition operation. Get the depth of the object. The number of times the structured light is projected can be judged based on the image obtained by projecting the structured light from the previous time, and the specific implementation is as follows.
具体的,在上述步骤(5)投射第一结构光后,获取第3帧图像,然后还包括,根据所述第3帧图像,决定是否投射第二结构光从而获取第4帧图像。Specifically, after the first structured light is projected in the above step (5), acquiring the third frame image, and further comprising determining whether to project the second structured light according to the third frame image to acquire the fourth frame image.
所述根据所述第3帧图像,决定是否投射第二结构光从而获取第4帧图像包括,判断所述第3帧图像中是否包括高光区域,若第3帧图像中包括高光区域,则投射第二结构光,所述投射第二结构光包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比第一结构光中对所述高光区域投射的高光部分结构光的强度要暗。具体实施例中,对所述第3帧图像中高光区域灰度值等于255的像素点,第二结构光中所述高光部分结构光投射128亮度的光线。Determining whether to project the second structured light to acquire the fourth frame image according to the third frame image includes determining whether the highlight image is included in the third frame image, and if the third frame image includes a highlight region, projecting a second structured light, the projected second structured light comprising: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale projected on the non-edge region of the object The gradient strip includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is projected to the highlight region in the first structured light The intensity of the structured light in the highlight portion is dark. In a specific embodiment, for a pixel point in the image of the third frame where the gray value of the highlight region is equal to 255, the highlight portion of the second structured light structures the light of 128 brightness.
所述判断所述第3帧图像中是否包括高光区域包括,判断第3帧图像中是否有灰度值为255的像素点,若灰度值为255的像素点个数n大于1,则判断为包括高光区域;或判断若灰度值为255的相邻像素点个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值x=5,或x=1,或其他数值。或者是,判断第3帧图像中灰度值为255的相邻像素点数量n占物体图像整体像素点数量的比值是否超过预设的阈值y,若超过阈值y则判断为所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值y=5%,或其他数值。Determining whether the highlight region is included in the image of the third frame includes determining whether there is a pixel having a gray value of 255 in the image of the third frame, and determining whether the number n of pixels having a gray value of 255 is greater than 1, To include a highlight region; or to determine that if the number n of adjacent pixel points whose gray value is 255 is greater than or equal to a preset threshold x, it is determined that the region where the adjacent pixel of the gray value is 255 is a highlight region. In a specific embodiment, the preset threshold x=5, or x=1, or other values. Alternatively, it is determined whether the ratio of the number of adjacent pixel points n of the RGB value in the image of the third frame to the total number of pixel points of the object image exceeds a preset threshold y, and if the threshold value y is exceeded, the gray value is determined. The area where the adjacent pixels of 255 are located is a highlight area. In a specific embodiment, the preset threshold y=5%, or other values.
进一步地,所述投射第二结构光后还包括,根据所述第4帧图像,决定是否投射第三结构光从而获取第5帧图像。Further, the projecting the second structured light further includes determining, according to the fourth frame image, whether to project the third structured light to acquire the fifth frame image.
所述根据所述第4帧图像,决定是否投射第三结构光从而获取第5帧图像包括,判断所述第4帧图像中是否包括高光区域,若第4帧图像中包括高光区域,则投射第三结构光,所述投射第三结构光包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比第二结构光中对所述高光区域投射的高光部分结构光的强度要暗。具体实施例中,对所述第4帧图像中高光区域灰度值等于255的像素点,第三结构光中所述高光部分结构光投射64亮度的光线。Determining whether to project the third structured light to acquire the fifth frame image according to the fourth frame image includes determining whether the highlight image is included in the fourth frame image, and if the fourth frame image includes a highlight region, projecting a third structured light, the projected third structured light comprising: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale projected on the non-edge region of the object The gradient strip includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-high beam region, and the highlight portion structured light projected to the highlight region is projected to the highlight region in the second structured light The intensity of the structured light in the highlight portion is dark. In a specific embodiment, for the pixel point of the fourth frame image in which the highlight value is equal to 255, the highlight portion of the third structured light structures the light of 64 brightness.
所述判断所述第4帧图像中是否包括高光区域包括,判断第4帧图像中是否有灰度值为255的像素点,若灰度值为255的像素点个数n大于1,则判断为包括高光区域;或判断若灰度值为255的相邻像素点个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值x=5,或x=1,或其他数值。或者是,判断第4帧图像中灰度值为255的相邻像素点数量n占物体图像整体像素点数量的比值是否超过预设的阈值y,若超过阈值y则判断为所述灰度值为255的相邻像素所在区域为高光区域。具体实施例中,所述预设阈值y=5%,或其他数值。Determining whether the highlight region is included in the image of the fourth frame includes determining whether there is a pixel having a gray value of 255 in the image of the fourth frame, and determining whether the number n of pixels having a gray value of 255 is greater than 1, To include a highlight region; or to determine that if the number n of adjacent pixel points whose gray value is 255 is greater than or equal to a preset threshold x, it is determined that the region where the adjacent pixel of the gray value is 255 is a highlight region. In a specific embodiment, the preset threshold x=5, or x=1, or other values. Alternatively, it is determined whether the ratio of the number of adjacent pixel points n of the RGB value in the fourth frame image to the total number of pixel points of the object image exceeds a preset threshold y, and if the threshold value y is exceeded, the gray value is determined. The area where the adjacent pixels of 255 are located is a highlight area. In a specific embodiment, the preset threshold y=5%, or other values.
如此,直至获取的图像中不再检测到高光区域,则可以不再降低投射的高光部分结构光强度。In this way, until the highlight region is no longer detected in the acquired image, the projected light intensity of the projected highlight portion can be no longer reduced.
本申请方法可以得到非常精细的结构光,且结构光的解算难度不大;投射帧数也不多;抗外界光的干扰也较好。The method of the present application can obtain very fine structured light, and the calculation of the structured light is not difficult; the number of projected frames is not much; the interference against external light is also good.
本申请适用范围是,投射光源是可控的(即可以控制输出任意图案、大部分结构光法传感器均采用此解决方案;投射光源一般是激光投影机或者DMD等普通投影机)。The scope of application of the present application is that the projection light source is controllable (ie, any pattern can be controlled to be output, and most of the structured light sensors adopt this solution; the projection light source is generally a general projector such as a laser projector or a DMD).
本申请还提供一种结构光投射装置,其包括: The application also provides a structured light projection device, comprising:
处理器,适于实现各指令;以及a processor adapted to implement each instruction;
存储设备,适于存储多条指令,所述指令适于由处理器加载并执行:A storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
获取不受外界光线影响的物体图像; Obtain an image of an object that is not affected by external light;
对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带。Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
本申请还提供一种深度检测装置,其包括:The application also provides a depth detecting device, comprising:
处理器,适于实现各指令;以及a processor adapted to implement each instruction;
存储设备,适于存储多条指令,所述指令适于由处理器加载并执行:A storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带;Projecting the first structured light, including respectively projecting a first grayscale gradient strip to the non-edge region of the object, and projecting a second grayscale gradient strip to the edge region;
获取投射第一结构光后的物体图像,对该物体图像进行深度解算。Obtaining an object image after projecting the first structured light, and performing depth solution on the object image.
以上仅为本申请的实施方式,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围。The above is only the embodiment of the present application, and thus does not limit the scope of patents of the present application, and the equivalent structure or equivalent process transformation made by using the specification and the contents of the drawings, or directly or indirectly applied to other related technical fields, The same applies to the scope of patent protection of this application.

Claims (31)

  1. 一种基于图像内容的投射结构光方法,其特征在于,包括: A method for projecting structured light based on image content, comprising:
    获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
    对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
    投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带。Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
  2. 根据权利要求1所述的基于图像内容的投射结构光方法,其特征在于,所述获取不受外界光线影响的物体图像包括:The image structure-based projection structure light method according to claim 1, wherein the acquiring an object image that is not affected by external light comprises:
    对全局投射白光,获取第1帧图像;Projecting white light globally to acquire the first frame image;
    不投射任何光,获取第2帧图像;Does not project any light, and acquires the image of the second frame;
    将获取的所述两帧图像相减得到不受外界光线影响的物体图像。The obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
  3. 根据权利要求1所述的基于图像内容的投射结构光方法,其特征在于,所述对该不受外界光线影响的物体图像进行分析中,还包括得到物体图像的高光区域,所述投射第一结构光,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。The method for projecting structured light based on image content according to claim 1, wherein the analyzing the image of the object that is not affected by external light further comprises obtaining a highlight region of the image of the object, the projection being first Structured light, wherein the first grayscale gradient strip projected onto the non-edge region of the object comprises a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-highlight region, and a highlight portion structure projected to the highlight region The light is darker than the light projected to the highlight region the previous time.
  4. 根据权利要求3所述的基于图像内容的投射结构光方法,其特征在于,所述对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗,是投射比前一次对所述高光区域投射的光线亮度降低一半的光线。The image structure-based projection structure light method according to claim 3, wherein the highlight portion structured light projected to the highlight region is darker than the light projected from the previous highlight region, and is a projection ratio. The light that was projected to the highlight area for the previous time was reduced by half the light.
  5. 根据权利要求3所述的基于图像内容的投射结构光方法,其特征在于,所述对该不受外界光线影响的物体图像进行分析,得到物体图像的高光区域的步骤,包括高光溢出检测,所述高光溢出检测为,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The method for projecting structured light based on image content according to claim 3, wherein the step of analyzing the image of the object that is not affected by external light to obtain a highlight region of the image of the object includes a high-gloss detection. The high light overflow detection is performed by determining the gray value of the pixel, and the number n of adjacent pixel points whose gray value is 255 is greater than or equal to the preset threshold x, and determining the area of the adjacent pixel where the gray value is 255 For the highlight region; or for determining the gray value of the pixel, if the ratio of the number of adjacent pixels of the gray value of 255 to the total number of pixels of the object image exceeds a preset threshold y, the gray scale is determined. The area where the adjacent pixel is 255 is the highlight area.
  6. 根据权利要求3~5任一项所述的基于图像内容的投射结构光方法,其特征在于,所述投射第一结构光后还包括:The image structure-based projection structure light method according to any one of claims 3 to 5, wherein the projecting the first structured light further comprises:
    获取投射前一帧结构光后的物体图像,Obtaining an object image after projecting the previous frame of structured light,
    对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域,若图像中包括高光区域,则投射后一帧结构光,所述投射后一帧结构光中包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。And analyzing the acquired image of the object after the previous frame of the structured light, determining whether the object image includes a highlight region, and if the image includes a highlight region, projecting the next frame of structured light, and the projected frame of the structured light The method includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight projected on the highlight region Partially structured light and part of the structured light projected onto the non-highlighted region, the highlight portion of the structured light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
  7. 根据权利要求1~5任一项所述的基于图像内容的投射结构光方法,其特征在于,所述第一灰度渐变条带与所述第二灰度渐变条带的灰度值取值区域不相同。The method for projecting structured light based on image content according to any one of claims 1 to 5, wherein the grayscale value of the first grayscale gradient strip and the second grayscale gradient stripe are The area is different.
  8. 根据权利要求6所述的基于图像内容的投射结构光方法,其特征在于,所述对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域的步骤,包括:对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The image structure-based projection structure light method according to claim 6, wherein the step of analyzing the acquired object image after the previous frame structured light is acquired, and determining whether the object image includes a highlight region The method includes: determining the gray value of the pixel, and determining the number of adjacent pixels of the gray value of 255 to be greater than or equal to the preset threshold x, determining that the area of the adjacent pixel whose gray value is 255 is a highlight area Or determining the gray value of the pixel, and the ratio of the number of adjacent pixels of the gray value of 255 to the total number of pixel points of the object image exceeds a preset threshold y, and the gray value is determined to be 255. The area where the adjacent pixels are located is a highlight area.
  9. 根据权利要求2所述的基于图像内容的投射结构光方法,其特征在于,所述将获取的所述两帧图像相减得到不受外界光线影响的物体图像,包括:将第2帧图像的逐个像素灰度减去第1帧图像中逐个像素灰度,获得相减后的像素灰度。The image structure-based projection structure light method according to claim 2, wherein the subtracting the acquired two frames of images to obtain an object image that is not affected by external light includes: The pixel-by-pixel gradation in the image of the first frame is subtracted pixel by pixel, and the pixel gradation after subtraction is obtained.
  10. 根据权利要求1~5任一项所述的基于图像内容的投射结构光方法,其特征在于,所述第一灰度渐变条带在物体非边缘区域投射,第一灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。 The method for projecting structured light based on image content according to any one of claims 1 to 5, wherein the first gradation gradient strip is projected on a non-edge region of the object, and the whole of the first gradation gradient strip There is no repeating texture in the grayscale gradient direction along the stripe, and the gray scales between adjacent pixels along the grayscale gradient direction are different, and the gray scales of adjacent pixels are increased or decreased along the grayscale gradient direction.
  11. 根据权利要求1~5任一项所述的基于图像内容的投射结构光方法,其特征在于,所述第二灰度渐变条带沿物体边缘投射,且第二灰度渐变条带的宽度为D并且宽度横跨物体边缘,所述第二灰度渐变条带的灰度渐变方向与物体边缘一致,第二灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。The method for projecting structured light based on image content according to any one of claims 1 to 5, wherein the second grayscale gradient strip is projected along an edge of the object, and the width of the second grayscale gradient strip is D and width across the edge of the object, the grayscale gradient direction of the second grayscale gradient strip is consistent with the edge of the object, and the entire strip of the second grayscale gradient strip has no repeating texture along the grayscale gradient direction, along the gray The gray level of adjacent pixels in the gradient direction is different, and the gray level of adjacent pixels is increased or decreased along the gray level gradient direction.
  12. 根据权利要求1~5任一项所述的基于图像内容的投射结构光方法,其特征在于,所述第一灰度渐变条带和第二灰度渐变条带的渐变条纹排布方式不相同,所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致。The image structure-based projection structure light method according to any one of claims 1 to 5, wherein the first grayscale gradient stripe and the second grayscale gradient stripe have different gradient stripe arrangement manners. The first grayscale gradient stripe and the second grayscale gradient stripe are inconsistent with pixel grayscales in adjacent regions.
  13. 一种深度检测方法,其特征在于,包括:A depth detecting method, comprising:
    获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
    对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
    投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带;Projecting the first structured light, including respectively projecting a first grayscale gradient strip to the non-edge region of the object, and projecting a second grayscale gradient strip to the edge region;
    获取投射第一结构光后的物体图像,对该物体图像进行深度解算。Obtaining an object image after projecting the first structured light, and performing depth solution on the object image.
  14. 根据权利要求13所述的深度检测方法,其特征在于,所述获取不受外界光线影响的物体图像包括:The depth detecting method according to claim 13, wherein the acquiring an image of an object that is not affected by external light comprises:
    对全局投射白光,获取第1帧图像;Projecting white light globally to acquire the first frame image;
    不投射任何光,获取第2帧图像;Does not project any light, and acquires the image of the second frame;
    将获取的所述两帧图像相减得到不受外界光线影响的物体图像。The obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
  15. 根据权利要求14所述的深度检测方法,其特征在于,所述对该物体图像进行分析还包括得到物体图像的高光区域,所述投射第一结构光,其中对物体非边缘区域投射的第一灰度渐变条带包括:对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。The depth detecting method according to claim 14, wherein the analyzing the object image further comprises obtaining a highlight region of the object image, wherein the first structured light is projected, wherein the first object is projected on the non-edge region The grayscale gradient strip includes: a highlight portion structured light projected to the highlight region and a portion of the structured light projected to the non-highlight region, and the highlight portion projected light projected to the highlight region is light projected from the previous highlight region. Be dark.
  16. 根据权利要求15所述的深度检测方法,其特征在于,所述投射第一结构光,获取投射第一结构光后的物体图像,之后还包括:The depth detecting method according to claim 15, wherein the projecting the first structured light to obtain an image of the object after the first structured light is projected, further comprising:
    对投射前一帧结构光后所获取的物体图像分析,判断所述物体图像中是否包括高光区域,若图像中包括高光区域,则投射后一帧结构光,所述投射后一帧结构光中包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。。For analyzing an image of the object acquired after projecting the previous frame of structured light, determining whether the object image includes a highlight region, and if the image includes a highlight region, projecting the next frame of structured light, and the projected frame is structured light. The method includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight portion projected on the highlight region The structured light and the portion of the structured light projected onto the non-highlight region, the highlight portion of the structured light projected to the highlight region is darker than the light projected to the highlight region from the previous time. .
  17. 根据权利要求15或16所述的深度检测方法,其特征在于,所述得到物体图像的高光区域的步骤,包括高光溢出检测,所述高光溢出检测包括,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The depth detecting method according to claim 15 or 16, wherein the step of obtaining a highlight region of the object image comprises a highlight overflow detection, the highlight overflow detection comprising: determining a grayscale value of the pixel, and grayscale If the number n of adjacent pixel points with a value of 255 is greater than or equal to the preset threshold x, it is determined that the region where the adjacent pixel of the gray value is 255 is a highlight region; or the gray value of the pixel is determined, and the gray scale is determined. When the ratio of the number n of adjacent pixel points having the value of 255 to the total number of pixel points of the object image exceeds a preset threshold y, it is determined that the area of the adjacent pixel whose gradation value is 255 is a highlight area.
  18. 根据权利要求13~15任一项所述的深度检测方法其特征在于,所述第一灰度渐变条带在物体非边缘区域投射,第一灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。The depth detecting method according to any one of claims 13 to 15, wherein the first grayscale gradation strip is projected on a non-edge region of the object, and the entire gradation of the first gradation gradient strip is grayscaled. There is no repeating texture in the gradient direction, and the gray level between adjacent pixels along the gray level gradient direction is different, and the gray level of adjacent pixels is increased or decreased along the gray level gradient direction.
  19. 根据权利要求13或14所述的深度检测方法其特征在于,所述第二灰度渐变条带沿物体边缘投射,且第二灰度渐变条带的宽度为D并且宽度横跨物体边缘,所述第二灰度渐变条带的灰度渐变方向与物体边缘一致,第二灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。The depth detecting method according to claim 13 or 14, wherein the second gradation gradation strip is projected along an edge of the object, and the width of the second gradation gradation strip is D and the width spans the edge of the object. The grayscale gradient direction of the second grayscale gradient strip is consistent with the edge of the object, and the entire strip of the second grayscale gradient strip has no repeating texture along the grayscale gradient direction, and the adjacent pixels are grayed along the grayscale gradient direction. The degree is different, and the gray level of adjacent pixels increases or decreases along the gray level gradient direction.
  20. 根据权利要求13或14所述的深度检测方法,其特征在于,所述第一灰度渐变条带和第二灰度渐变条带的渐变条纹排布方式不相同,所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致,所述第一灰度渐变条带与所述第二灰度渐变条带的灰度值取值区域不相同。The depth detecting method according to claim 13 or 14, wherein the first grayscale gradient strip and the second grayscale gradient strip have different gradient stripe arrangement manners, and the first grayscale gradient The stripe and the second grayscale gradient stripe are inconsistent with pixel gray levels in adjacent regions, and the first grayscale gradient stripe is different from the grayscale value stripping region of the second grayscale gradient stripe .
  21. 一种结构光投射装置,其特征在于,包括: A structured light projection device, comprising:
    处理器,适于实现各指令;以及a processor adapted to implement each instruction;
    存储设备,适于存储多条指令,所述指令适于由处理器加载并执行:A storage device adapted to store a plurality of instructions adapted to be loaded and executed by the processor:
    获取不受外界光线影响的物体图像;Obtain an image of an object that is not affected by external light;
    获取不受外界光线影响的物体图像; Obtain an image of an object that is not affected by external light;
    对该不受外界光线影响的物体图像进行分析,得到物体边缘、物体非边缘区域;The image of the object that is not affected by external light is analyzed to obtain an edge of the object and a non-edge area of the object;
    投射第一结构光,其中包括分别对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带。Projecting the first structured light includes projecting a first grayscale gradient strip to the non-edge region of the object and a second grayscale gradient strip to the edge region.
  22. 根据权利要求21所述的结构光投射装置,其特征在于,所述获取不受外界光线影响的物体图像包括:The structured light projection device according to claim 21, wherein the acquiring an image of an object that is not affected by external light comprises:
    对全局投射白光,获取第1帧图像;Projecting white light globally to acquire the first frame image;
    不投射任何光,获取第2帧图像;Does not project any light, and acquires the image of the second frame;
    将获取的所述两帧图像相减得到不受外界光线影响的物体图像。The obtained two frames of images are subtracted to obtain an image of an object that is not affected by external light.
  23. 根据权利要求21所述的结构光投射装置,其特征在于,所述对该不受外界光线影响的物体图像进行分析中,还包括得到物体图像的高光区域,所述投射第一结构光,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。The structured light projection device according to claim 21, wherein the analyzing the image of the object that is not affected by external light further comprises obtaining a highlight region of the image of the object, wherein the first structured light is projected, wherein The first grayscale gradation strip projected on the non-edge region of the object includes a highlight portion structured light projected to the highlight region and an object portion structured light projected to the non-highlight region, and the highlight portion structured light projected to the highlight region is prior to the previous time The light projected to the highlight area is dark.
  24. 根据权利要求23所述的结构光投射装置,其特征在于,所述对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗,是投射比前一次对所述高光区域投射的光线亮度降低一半的光线。The structured light projection device according to claim 23, wherein the highlight portion of the light projected onto the highlight region is darker than the light projected from the highlight region in the previous time, and is a projection ratio of the previous time. The light emitted by the highlight area is reduced by half the light.
  25. 根据权利要求23所述的结构光投射装置,其特征在于,所述对该不受外界光线影响的物体图像进行分析,得到物体图像的高光区域的步骤,包括高光溢出检测,所述高光溢出检测为,对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The structured light projection device according to claim 23, wherein the step of analyzing the image of the object that is not affected by external light to obtain a highlight region of the image of the object includes highlight overflow detection, the highlight overflow detection For determining the gray value of the pixel, if the number n of adjacent pixels of the gray value is 255 is greater than or equal to the preset threshold x, determining that the area of the adjacent pixel whose gray value is 255 is a highlight area; Or determining the gray value of the pixel, if the ratio of the number of adjacent pixels of the gray value of 255 to the total number of pixels of the object image exceeds a preset threshold y, the gray value is determined to be 255. The area where adjacent pixels are located is a highlight area.
  26. 根据权利要求23~25任一项所述的结构光投射装置,其特征在于,所述存储设备存储的指令中还包括在投射第一结构光后:The structured light projection device according to any one of claims 23 to 25, wherein the instruction stored by the storage device further comprises: after projecting the first structured light:
    获取投射前一帧结构光后的物体图像,Obtaining an object image after projecting the previous frame of structured light,
    对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域,若图像中包括高光区域,则投射后一帧结构光,所述投射后一帧结构光中包括对物体非边缘区域投射第一灰度渐变条带,对边缘区域投射第二灰度渐变条带,其中对物体非边缘区域投射的第一灰度渐变条带包括对高光区域投射的高光部分结构光和对非高光区域投射的物体部分结构光,对所述高光区域投射的高光部分结构光比前一次对所述高光区域投射的光线要暗。And analyzing the acquired image of the object after the previous frame of the structured light, determining whether the object image includes a highlight region, and if the image includes a highlight region, projecting the next frame of structured light, and the projected frame of the structured light The method includes: projecting a first grayscale gradient strip on the non-edge region of the object, and projecting a second grayscale gradient strip on the edge region, wherein the first grayscale gradient strip projected on the non-edge region of the object includes a highlight projected on the highlight region Partially structured light and part of the structured light projected onto the non-highlighted region, the highlight portion of the structured light projected onto the highlight region is darker than the light projected to the highlight region from the previous time.
  27. 根据权利要求26所述的结构光投射装置,其特征在于,所述对所获取的投射前一帧结构光后的物体图像分析,判断所述物体图像中是否包括高光区域的步骤,包括:对像素灰度值进行判断,灰度值为255的相邻像素点的个数n大于等于预设阈值x,则判断所述灰度值为255的相邻像素所在区域为高光区域;或者是对像素灰度值进行判断,灰度值为255的相邻像素点的个数n占物体图像整体像素点数量的比值超过预设的阈值y,则判断所述灰度值为255的相邻像素所在区域为高光区域。The structured light projection device according to claim 26, wherein the step of analyzing the acquired object image after the previous frame structured light is captured, and determining whether the object image includes a highlight region comprises: The pixel gray value is determined, and the number n of adjacent pixel points whose gray value is 255 is greater than or equal to the preset threshold x, and the area where the adjacent pixel of the gray value is 255 is determined to be a highlight area; or The pixel gray value is determined. If the ratio of the number of adjacent pixel points n of the gray value to 255 to the total number of pixel points of the object image exceeds a preset threshold y, the adjacent pixel whose gray value is 255 is determined. The area is the highlight area.
  28. 根据权利要求22所述的结构光投射装置,其特征在于,所述将获取的所述两帧图像相减得到不受外界光线影响的物体图像,包括:将第2帧图像的逐个像素灰度减去第1帧图像中逐个像素灰度,获得相减后的像素灰度。The structured light projection device according to claim 22, wherein the subtracting the acquired two frames of images to obtain an object image that is not affected by external light includes: gray-by-pixel gradation of the second frame image The pixel-by-pixel gradation in the image of the first frame is subtracted, and the pixel gradation after subtraction is obtained.
  29. 根据权利要求21~25任一项所述的结构光投射装置,其特征在于,所述第一灰度渐变条带在物体非边缘区域投射,第一灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。The structured light projection device according to any one of claims 21 to 25, wherein the first gray scaled strip is projected on a non-edge region of the object, and the inner strip of the first gray scale strip is inscribed There is no repeating texture in the grayscale gradient direction, and the grayscales between adjacent pixels along the grayscale gradient direction are different, and the grayscales of adjacent pixels are increased or decreased along the grayscale gradient direction.
  30. 根据权利要求21~25任一项所述的结构光投射装置,其特征在于,所述第二灰度渐变条带沿物体边缘投射,且第二灰度渐变条带的宽度为D并且宽度横跨物体边缘,所述第二灰度渐变条带的灰度渐变方向与物体边缘一致,第二灰度渐变条带的整体条带内沿灰度渐变方向没有重复纹理,沿灰度渐变方向的相邻像素间灰度有差异,沿灰度渐变方向相邻像素灰度递增或递减。The structured light projection device according to any one of claims 21 to 25, wherein the second grayscale gradient strip is projected along an edge of the object, and the width of the second grayscale gradient strip is D and the width is horizontal. Across the edge of the object, the grayscale gradient direction of the second grayscale gradient strip is consistent with the edge of the object, and the entire strip of the second grayscale gradient strip has no repeating texture along the grayscale gradient direction, along the grayscale gradient direction. The gray level varies between adjacent pixels, and the gray level of adjacent pixels increases or decreases along the gray level gradient direction.
  31. 根据权利要求21~25任一项所述的结构光投射装置,其特征在于,所述第一灰度渐变条带和第二灰度渐变条带的渐变条纹排布方式不相同,所述第一灰度渐变条带与所述第二灰度渐变条带在相邻区域的像素灰度不一致。 The structured light projection device according to any one of claims 21 to 25, wherein the first gradation gradient strip and the second gradation gradient strip have different gradation strip arrangement patterns, A grayscale gradient strip is inconsistent with the pixel grayscale of the second grayscale gradient strip in the adjacent region.
PCT/CN2017/116586 2017-12-15 2017-12-15 Image content-based structured light projection method , depth detection method and structured light projection apparatus WO2019113968A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/116586 WO2019113968A1 (en) 2017-12-15 2017-12-15 Image content-based structured light projection method , depth detection method and structured light projection apparatus
CN201780034793.0A CN109661683B (en) 2017-12-15 2017-12-15 Structured light projection method, depth detection method and structured light projection device based on image content

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/116586 WO2019113968A1 (en) 2017-12-15 2017-12-15 Image content-based structured light projection method , depth detection method and structured light projection apparatus

Publications (1)

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

Family

ID=66110528

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/116586 WO2019113968A1 (en) 2017-12-15 2017-12-15 Image content-based structured light projection method , depth detection method and structured light projection apparatus

Country Status (2)

Country Link
CN (1) CN109661683B (en)
WO (1) WO2019113968A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111526303B (en) * 2020-04-30 2022-05-24 长春长光辰芯光电技术有限公司 Method for removing background light in structured light imaging
CN113112432A (en) * 2021-05-13 2021-07-13 广州道一科学技术有限公司 Method for automatically identifying image strips

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104581124A (en) * 2013-10-29 2015-04-29 汤姆逊许可公司 Method and apparatus for generating depth map of a scene
CN104809698A (en) * 2015-03-18 2015-07-29 哈尔滨工程大学 Kinect depth image inpainting method based on improved trilateral filtering
US20160247287A1 (en) * 2015-02-23 2016-08-25 Canon Kabushiki Kaisha Information processing apparatus, information processing method, and storage medium
CN106504284A (en) * 2016-10-24 2017-03-15 成都通甲优博科技有限责任公司 A kind of depth picture capturing method combined with structure light based on Stereo matching
CN106651938A (en) * 2017-01-17 2017-05-10 湖南优象科技有限公司 Depth map enhancement method blending high-resolution color image
CN106651941A (en) * 2016-09-19 2017-05-10 深圳奥比中光科技有限公司 Depth information acquisition method and depth measuring system
CN106875435A (en) * 2016-12-14 2017-06-20 深圳奥比中光科技有限公司 Obtain the method and system of depth image
CN107424186A (en) * 2016-05-19 2017-12-01 纬创资通股份有限公司 depth information measuring method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101087413B (en) * 2006-06-07 2010-05-12 中兴通讯股份有限公司 Division method of motive object in video sequence

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104581124A (en) * 2013-10-29 2015-04-29 汤姆逊许可公司 Method and apparatus for generating depth map of a scene
US20160247287A1 (en) * 2015-02-23 2016-08-25 Canon Kabushiki Kaisha Information processing apparatus, information processing method, and storage medium
CN104809698A (en) * 2015-03-18 2015-07-29 哈尔滨工程大学 Kinect depth image inpainting method based on improved trilateral filtering
CN107424186A (en) * 2016-05-19 2017-12-01 纬创资通股份有限公司 depth information measuring method and device
CN106651941A (en) * 2016-09-19 2017-05-10 深圳奥比中光科技有限公司 Depth information acquisition method and depth measuring system
CN106504284A (en) * 2016-10-24 2017-03-15 成都通甲优博科技有限责任公司 A kind of depth picture capturing method combined with structure light based on Stereo matching
CN106875435A (en) * 2016-12-14 2017-06-20 深圳奥比中光科技有限公司 Obtain the method and system of depth image
CN106651938A (en) * 2017-01-17 2017-05-10 湖南优象科技有限公司 Depth map enhancement method blending high-resolution color image

Also Published As

Publication number Publication date
CN109661683A (en) 2019-04-19
CN109661683B (en) 2020-09-15

Similar Documents

Publication Publication Date Title
JP3938257B2 (en) Method and apparatus for detecting a face-like area and observer tracking display
US20070176927A1 (en) Image Processing method and image processor
US20150229911A1 (en) One method of binocular depth perception based on active structured light
WO2014058248A1 (en) Image monitoring apparatus for estimating gradient of singleton, and method therefor
WO2011065671A2 (en) Apparatus and method for detecting a vertex of an image
CN108846819B (en) Laser cutting parameter acquisition method and device, electronic equipment and storage medium
JP5342413B2 (en) Image processing method
WO2019113968A1 (en) Image content-based structured light projection method , depth detection method and structured light projection apparatus
WO2019104616A1 (en) Image processing method and device and computer-readable storage medium
WO2016180246A1 (en) Laser machining method and device for sapphires, and storage medium
CN107203743B (en) Face depth tracking device and implementation method
WO2010008134A2 (en) Image processing method
CN112836634B (en) Multi-sensor information fusion gate anti-trailing method, device, equipment and medium
EP2793172B1 (en) Image processing apparatus, image processing method and program
JP2005172559A (en) Method and device for detecting line defect on panel
KR20040100963A (en) Image processing apparatus
WO2018072172A1 (en) Method and apparatus for identifying shapes within images, device and computer storage medium
JPH06308256A (en) Cloudy fog detecting method
CN111536895B (en) Appearance recognition device, appearance recognition system, and appearance recognition method
CN115184362B (en) Rapid defect detection method based on structured light projection
JP7007324B2 (en) Image processing equipment, image processing methods, and robot systems
WO2017034323A1 (en) Image processing device and method for adaptively improving low illumination level, and object detection device using same
JP2565585B2 (en) Position detection method for scribe line intersection area
WO2022086001A1 (en) Image processing method and image processing apparatus using same
JPH01315884A (en) Pattern tracking method

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: 17934965

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: 17934965

Country of ref document: EP

Kind code of ref document: A1