A kind of light source position calibration method of three-dimensional reconstruction apparatus
Technical field
The present invention relates to three-dimensional reconstruction the relevant technologies technical field more particularly to a kind of light source positions of three-dimensional reconstruction apparatus
Calibration method.
Background technique
Nowadays three-dimensional reconstruction apparatus is widely used in production practices and daily life.Currently, a kind of common Three-dimensional Gravity
The mode of building is the gray difference estimation body surface normal vector by object under different illumination conditions, and advantage is thin to texture
The recovery capability of section is prominent, but to the calibration request of light source parameters height, in reduction precision by light source and camera installation error
Influence, it is therefore desirable to design it is a kind of can influence with light source and camera installation error to reduction precision Source calibration method.
Summary of the invention
Technical problem: to solve the above problems, the present invention provides a kind of light source position of three-dimensional reconstruction apparatus
Calibration method, including light source group, camera, controller, plane template and image processor, it is possible to reduce the peace of light source and camera
Influence of the error to reduction precision is filled,
Technical solution: the present invention is a kind of light source position calibration method of three-dimensional reconstruction apparatus, the three-dimensional reconstruction apparatus
Including light source group, camera, controller, plane template and image processor, wherein camera is located at centre, and light source group includes light
Source one, light source two, light source three, light source four are located at 4 sides of camera, and plane template is located at the top of camera and light source group;
The light source position calibration method of the three-dimensional reconstruction apparatus includes shooting link, prepares link and operation link;It claps
It takes the photograph under link and is shot by camera, obtain flat image, in preparing link, the flat image of shooting is subjected to gray processing processing,
The offset coordinates that operation link obtains when error coefficient is minimized are denoted as most suitable coordinate;It is after operation link if described
It detects step-length and is greater than 2 pixels, then the lattice point being overlapped in the detection grid with most suitable coordinate distance is greater than detection
The lattice point of step-length is deleted;The detection step-length is halved and adds new lattice point in the detection grid;The inspection
The distance of neighboring lattice points of the survey grid lattice after being added to the lattice point is detection step-length, and the detection grid area is not
Increase;Subsequent repetitive operation link;If the detection step-length is less than 2 pixels after operation link, by it is described most
Suitable coordinate is denoted as optimized migration coordinate.
Wherein:
The shooting link are as follows: each light source inside controller control light source group is successively lighted, and in each light source
The plane template that camera shooting is placed in front of the light source group and the camera is controlled after lighting at once, is obtained
One group of photo be known as the first flat image.
The preparation link is using plane where first flat image as x-y plane, with the first flat image left side
Upper angle is that origin establishes three-dimensional cartesian coordinate system;In the image processor setting detection step-length, along x, y-axis direction is established flat
For row in the detection grid of (x, y) plane, neighboring lattice points spacing is the detection step-length, the z of the three-dimensional cartesian coordinate system
Axis is by wherein one of a certain lattice point, and the camera position detection grid coplanar and described with the detection grid is to z=0
The projection of plane is entirely located within first plan view image.
Under the operation link, (x, y) coordinate of offset coordinates is successively set as the detection net by image processor
(x, y) coordinate of each lattice point in lattice, by the z coordinate of the offset coordinates be set as camera and the plane template away from
From;Three-dimensional reconstruction algorithm and first flat image built in the image processor is to the plane mould
Plate carries out three-dimensional reconstruction, obtains the first areal model;By the first areal model upright projection to x-y plane, and throwing
Shadow zone domain is evenly dividing along x, y-axis as the Error Grid having a size of m*n;In first areal model with the Error Grid lattice point
There is the set of the point of identical (x, y) coordinate to be denoted as first cloud;
First cloud is fitted to by image processing unit in the three-dimensional cartesian coordinate system under operation link
One plane, referred to as the second plane;It is flat at a distance from second plane to calculate point all in first cloud
Fang He, referred to as error coefficient;Compare the offset coordinates and is located at the error obtained when each lattice point in the detection grid
Coefficient, recording error coefficient minimum value, the offset coordinates when error coefficient is minimized are denoted as most suitable coordinate.
The light source group includes 4 light sources, is mounted on the midpoint on 4 sides of the square that side length is s;The camera
(2) square center and its optical axis direction are mounted on perpendicular to the square;When shooting, each light
Source has and only one is in illuminating state;The brightness of each light source is identical and distance to each other can be measured accurately.
The image processing unit passes through light in the grayscale information in first plan view image, the light source group
The distance between source, the coordinate of the camera and the distance between itself and the plane template calculate described first
Areal model.
First flat image includes 4 pictures, will obtain 4 grayscale images after the 4 picture gray processings,
The pixel of same position has corresponded to the same point in areal model in 4 grayscale images;If the grayscale image is having a size of m*n picture
Element is horizontally to the right y-axis direction, is vertically downward x-axis direction using the pixel in the grayscale image upper left corner as origin, direction
The direction of the camera is that z-axis positive direction establishes rectangular coordinate system;1 millimeter in the plane template of length is located in institute
R pixel is corresponded in the grayscale image stated, the camera and plane template distance are d millimeters, then sit at the right angle
Camera coordinates described in mark system are (m/2, n/2, d*r);
In the grayscale image, EkIndicate the gray matrix of kth grayscale image, PijI-th row in grayscale image described in indicating
Coordinate of the pixel of jth column in the rectangular coordinate system,Indicate k-th of light source the i-th row into the grayscale image
The direction vector of the pixel of j column,The pixel of the i-th row jth column is right on the plane template in grayscale image described in indicating
Surface normal of the point answered in the rectangular coordinate system;It is anti-when the plane template according to Lambert's law of reflection
Penetrate light be diffusing reflection when, for its surface any point, there is following equation:
Solving equation can getAnd then solve the gradient at any point on the plane template surface;To gradient into
Row integral can calculate the z coordinate at any point on the plane template surface, that is, restore first areal model.
The center of the light source group is overlapped with optimized migration coordinate.
The utility model has the advantages that passing through built-in three the present invention provides a kind of light source position calibration method of three-dimensional reconstruction apparatus
Algorithm for reconstructing is tieed up, the light source position parameter in adjustment algorithm utilizes one group shot using plane template as object in shooting link
Photo carries out three-dimensional reconstruction to plane template, and reconstructed results are fitted to plane and calculate the difference between reconstructed results and plane
It is different, determine the best light source location parameter, can influence of the error to reconstructed results effectively in correcting device installation process, improve
The quality of three-dimensional reconstruction.
Detailed description of the invention
Fig. 1 is the mechanical structure schematic diagram of the three-dimensional reconstruction apparatus for light source position calibration of the embodiment of the present application;
Drawing reference numeral explanation:
Plane template 1, camera 2, light source 1, light source 24, light source 35, light source 46.
Specific embodiment
Present invention is further described in detail with specific embodiment with reference to the accompanying drawing:
The present invention provides a kind of light source position calibration method of three-dimensional reconstruction apparatus, including light source group, camera, controller,
The light source position calibration of plane template and image processor, provided three-dimensional reconstruction apparatus includes three links,
, can be by built-in three-dimensional reconstruction algorithm under operation link, light source position parameter in adjustment algorithm, using in shooting ring
Section carries out three-dimensional reconstruction to plane template using one group of photo that plane template is shot as object, determines best light by reconstructed results
Source position parameter can effectively improve the quality of three-dimensional reconstruction.With reference to the accompanying drawing, to the specific embodiment party of the embodiment of the present application
Formula is described in further detail.
Refering to what is shown in Fig. 1, the application mechanical structure is as follows, including plane template 1, and camera 2, light source 1, light source 24, light
Source 35, light source 46.
The specific method is as follows for a kind of light source position calibration method of three-dimensional reconstruction apparatus of the present invention, and described device includes light source
Group, camera, controller, plane template and image processor, it is characterised in that: the working condition of described device includes shooting ring
Section prepares link and operation link;
It shoots under link:
Each light source under shooting link inside controller control light source group is successively lighted, and is stood after each light source igniting
Carve the plane template that control camera shooting is placed in front of the light source group and the camera, one group of photograph of acquisition
Piece is known as the first flat image;
Prepare under link:
Prepare using plane is x-y plane where first flat image under link, with first flat image
The upper left corner is that origin establishes three-dimensional cartesian coordinate system;In the suitable detection step-length of image processor setting, along x, y-axis side
The detection grid of (x, y) plane is parallel to foundation, it is characterised in that neighboring lattice points spacing is the detection step-length, described
For the z-axis of three-dimensional cartesian coordinate system by wherein one of a certain lattice point, the camera position is coplanar with the detection grid, and
And projection of the detection grid to z=0 plane is entirely located within first plan view image;
Under operation link:
(x, y) coordinate of offset coordinates is successively set as each in the detection grid by image processor under operation link
The z coordinate of the offset coordinates is set as camera at a distance from the plane template by (x, y) coordinate of a lattice point;According to
Three-dimensional reconstruction algorithm and first flat image built in the image processor carry out the plane template
Three-dimensional reconstruction obtains the first areal model;By the first areal model upright projection to x-y plane, and view field
It is evenly dividing along x, y-axis as the Error Grid having a size of m*n;Have in first areal model with the Error Grid lattice point identical
The set of point of (x, y) coordinate be denoted as first cloud;
First cloud is fitted to by image processing unit in the three-dimensional cartesian coordinate system under operation link
One plane, referred to as the second plane.It is flat at a distance from second plane to calculate point all in first cloud
Fang He, referred to as error coefficient;Compare the offset coordinates and is located at the error obtained when each lattice point in the detection grid
Coefficient, recording error coefficient minimum value, the offset coordinates when error coefficient is minimized are denoted as most suitable coordinate;
After operation link if the detection step-length be greater than 2 pixels, by the detection grid with it is described
Most suitable coordinate be overlapped lattice point distance be greater than detection step-length lattice point delete;The detection step-length is halved and described
New lattice point is added in detection grid;The detection grid is characterized in that neighboring lattice points after being added to the lattice point
Distance is detection step-length, and the detection grid area does not increase;Subsequent repetitive operation link;
If the most suitable coordinate is denoted as most preferably by the detection step-length less than 2 pixels after operation link
Offset coordinates.
The above described is only a preferred embodiment of the present invention, being not the limit for making any other form to the present invention
System, and made any modification or equivalent variations according to the technical essence of the invention, still fall within present invention model claimed
It encloses.