A distance measuring device that generates a parallax image to measure a distance, the distance measuring device comprising: a plurality of image sensors (3a,3b) each configured to capture an image; an edge image extractor configured to extract edge images based on the images captured by image sensors (3a,3b), the edge images including pixel values each containing identification information used to identify an edge caused by a brightness variation from light to dark or an edge caused by a brightness variation from dark to light, wherein the identification information corresponds to positive and negative numerals; a binarized edge image generator configured to generate binarized edge images in accordance with the identification information of the edge images, wherein the binarized edge image generator is configured to substitute a pixel value, including the identification information for identifying the edge in the edge image caused by the brightness variation from light to dark, by one of binary values, and is configured to substitute a pixel value, including the identification information for identifying the edge in the edge image caused by the brightness variation from dark to light, by the other of binary values, thereby generating the binarization images; and wherein the binarized edge image generator is configured to substitute all pixel values without the identification information in the edge image by a regular pattern including one or the other of binary values; a parallax image generator configured to generate the parallax image from the binarized edge images; and a distance image calculator configured to calculate a distance image from the parallax image. a plurality of image sensors (3a,3b) each configured to capture an image; an edge image extractor configured to extract edge images based on the images captured by image sensors (3a,3b), the edge images including pixel values each containing identification information used to identify an edge caused by a brightness variation from light to dark or an edge caused by a brightness variation from dark to light, wherein the identification information corresponds to positive and negative numerals; a binarized edge image generator configured to generate binarized edge images in accordance with the identification information of the edge images, wherein the binarized edge image generator is configured to substitute a pixel value, including the identification information for identifying the edge in the edge image caused by the brightness variation from light to dark, by one of binary values, and is configured to substitute a pixel value, including the identification information for identifying the edge in the edge image caused by the brightness variation from dark to light, by the other of binary values, thereby generating the binarization images; and wherein the binarized edge image generator is configured to substitute all pixel values without the identification information in the edge image by a regular pattern including one or the other of binary values; a parallax image generator configured to generate the parallax image from the binarized edge images; and a distance image calculator configured to calculate a distance image from the parallax image.