In the field of machine vision, determination of the tridimensional information from images is of great importance. One of the most used ways for achieving this task is based on stereo vision. Shape-from-stereo method computes a depth map from a stereo-pair of images. Using several images of different perspectives, tridimensional representation of a test scene can be obtained. The key point in this process is the stereo matching. Stereo matching determines the position change of a pixel in one image of the stereo-pair with regard to another image. In this paper a stereo matching algorithm based on dynamic programming is suggested for 3D shape recovery from textured images. The proposed technique uses the information of a two-dimensional small neighborhood to solve the corresponding problem.