A method of inspecting a terminal of an inspection target mounted on a substrate, comprising: acquiring a first image, that is a 2D image, by irradiating the inspection targe with pattern light for obtaining three-dimensional image of the inspection target and receiving the pattern light reflected by the inspection target, acquiring a second image, that is a 2D image obtained, by irradiating the inspection target with at least two lights with different colors and receiving the at least two lights reflected by the inspection target; producing a composite image of the first image and the second image, which is a 2D image, by using the brightness information from the first image and the color information from the second image and setting an inspection area to include the terminal of the inspection target on the composite image; setting a section in which the color of a pixel changes from a first color to another color along a reference direction, the reference direction being a direction from one side boundary of the terminal to other side boundary within the inspection area, acquiring at least a portion of a boundary of the terminal of the inspection target from a change in the brightness information per pixel and a change in the color information per pixel within said section, whereby the pattern light for obtaining three-dimensional image of the inspection target is irradiated with a first inclination angle with reference to a normal line perpendicular to the plane of the inspection taget, and the at least two lights with different colors include at least a first color light and a second color light having a different color from the first color light, the first color light is irradiated with a second inclination angle smaller than the first inclination angle, and the second color light is irradiated with a third inclination angle larger than the first inclination angle, wherein the color and the brightness are set to a normalized quantitative value for each pixel, and the change of the color and the change of the brightness are respectively a change of a color value per pixel and a change of a brightness value per pixel according to the reference direction, wherein the first color is red, the change of the color is increased in the section according to the reference direction and the change of the brightness is decreased in the section according to the reference direction, and wherein the boundary of the terminal is determined by a point where an increasing trend line corresponding to the change of the color value per pixel meets a decreasing trend line corresponding to the change of the brightness value per pixel. acquiring a first image, that is a 2D image, by irradiating the inspection targe with pattern light for obtaining three-dimensional image of the inspection target and receiving the pattern light reflected by the inspection target, acquiring a second image, that is a 2D image obtained, by irradiating the inspection target with at least two lights with different colors and receiving the at least two lights reflected by the inspection target; producing a composite image of the first image and the second image, which is a 2D image, by using the brightness information from the first image and the color information from the second image and setting an inspection area to include the terminal of the inspection target on the composite image; setting a section in which the color of a pixel changes from a first color to another color along a reference direction, the reference direction being a direction from one side boundary of the terminal to other side boundary within the inspection area, acquiring at least a portion of a boundary of the terminal of the inspection target from a change in the brightness information per pixel and a change in the color information per pixel within said section, whereby the pattern light for obtaining three-dimensional image of the inspection target is irradiated with a first inclination angle with reference to a normal line perpendicular to the plane of the inspection taget, and the at least two lights with different colors include at least a first color light and a second color light having a different color from the first color light, the first color light is irradiated with a second inclination angle smaller than the first inclination angle, and the second color light is irradiated with a third inclination angle larger than the first inclination angle, wherein the color and the brightness are set to a normalized quantitative value for each pixel, and the change of the color and the change of the brightness are respectively a change of a color value per pixel and a change of a brightness value per pixel according to the reference direction, wherein the first color is red, the change of the color is increased in the section according to the reference direction and the change of the brightness is decreased in the section according to the reference direction, and wherein the boundary of the terminal is determined by a point where an increasing trend line corresponding to the change of the color value per pixel meets a decreasing trend line corresponding to the change of the brightness value per pixel.