A method of acquiring a reference grating of a three-dimensional measurement system using moiré, wherein the three-dimensional measurement system comprises a light source for emitting light, a projection grating for generating a grating pattern, a grating actuator for moving the projection grating and a camera for acquiring the reference grating and a moiré pattern obtained from an object, and analyzes the moiré pattern acquired through the camera to measure the shape of the object, the method comprising the steps of:
- acquiring an initial reference grating using the light source and the projection grating;
- confirming whether or not the acquired initial reference grating includes noise through a noise detector;
- and
- moving the projection grating through the grating actuator to acquire the next reference grating when the initial reference grating does not include noise and correcting the reference grating when the reference grating includes noise,
- wherein correcting the reference grating comprises:
- binarizing the acquired reference grating;
- thinning the reference grating such that central points of lines of the binarized reference grating are detected and portions of the lines other than the central points are eliminated to leave only the central points;
- substituting the central points to a linear equation to obtain optimum straight lines that closely pass through the central points;
- calculating the slope of the reference grating using the straight lines;
- and
- obtaining a distance between neighboring straight lines corresponding to central lines of the grating and generating a grating using the distance.