An image recognition program for contour detection causing a computer of an information processing apparatus to function as: image acquisition means (31, S1) for acquiring an image; difference calculation means (31, S22) for calculating a difference between a pixel value of a first pixel in the image and a pixel value of a second pixel, the second pixel placed a predetermined number of pixels away from the first pixel; threshold calculation means (31, S31) for, when the difference is equal to or greater than a predetermined value, calculating an edge determination threshold; and edge pixel detection means (31, S32) for detecting an edge pixel corresponding to an edge present between the first pixel and the second pixel, by comparing the edge determination threshold with a pixel value of each pixel placed between the first pixel and the second pixel, characterized in that the threshold calculation means (31, S31) is adapted to calculate, as the edge determination threshold, an average value of a white area luminance value (Lw) and a black area luminance value (Lb), wherein the threshold calculation means (31, S31) includes: first detection means for detecting a local maximum value from among the pixel values of one of the first pixel and pixels near the first pixel, wherein the local maximum value is used for the white area luminance value (Lw), and for detecting another local maximum value from among the pixel values of one of the second pixel and pixels near the second pixel, wherein the other local maximum value is used for the black area luminance value (Lb) when the difference between the other local maximum value and the white area luminance value is larger than the predetermined value and wherein the pixel value of the second pixel is used as the black area luminance value (Lb) otherwise. image acquisition means (31, S1) for acquiring an image; difference calculation means (31, S22) for calculating a difference between a pixel value of a first pixel in the image and a pixel value of a second pixel, the second pixel placed a predetermined number of pixels away from the first pixel; threshold calculation means (31, S31) for, when the difference is equal to or greater than a predetermined value, calculating an edge determination threshold; and edge pixel detection means (31, S32) for detecting an edge pixel corresponding to an edge present between the first pixel and the second pixel, by comparing the edge determination threshold with a pixel value of each pixel placed between the first pixel and the second pixel, characterized in that the threshold calculation means (31, S31) is adapted to calculate, as the edge determination threshold, an average value of a white area luminance value (Lw) and a black area luminance value (Lb), wherein the threshold calculation means (31, S31) includes: first detection means for detecting a local maximum value from among the pixel values of one of the first pixel and pixels near the first pixel, wherein the local maximum value is used for the white area luminance value (Lw), and for detecting another local maximum value from among the pixel values of one of the second pixel and pixels near the second pixel, wherein the other local maximum value is used for the black area luminance value (Lb) when the difference between the other local maximum value and the white area luminance value is larger than the predetermined value and wherein the pixel value of the second pixel is used as the black area luminance value (Lb) otherwise.