An image processing method of detecting an edge of an analysis region where an object is analyzed and that has a rectangular shape with rounded corners from image data obtained by capturing an image of the analysis region and surroundings of the analysis region, the method comprising the steps of: a) extracting an edge coordinate group for the analysis region from the image data, wherein the edge coordinate group is a group of coordinate data pieces extracted based on a change of the luminance of each pixel in the image data; b) performing processing for extracting, from the edge coordinate group, a side coordinate group that corresponds to one side of the analysis region for each of four sides of the analysis region; c) generating four approximate lines respectively from the four side coordinate groups; d) performing processing for extracting, from the edge coordinate group, a corner coordinate group that is a group of coordinates for specifying one corner of the analysis region for each of four corners of the analysis region; e) selecting a first approximate line and a second approximate line that intersect with each other from among the four approximate lines; f) setting a plurality of contact candidate coordinates on each of the first approximate line and the second approximate line; g) generating an approximate curve by polynomial approximation from one of the corner coordinate groups that is closest to an intersection point of the first approximate line and the second approximate line, the approximate curve being in contact with at least one or more pairs of one contact candidate coordinates set on the first approximate line and one contact candidate coordinates set on the second approximate line; and h) selecting an approximate curve that is closest to the corner coordinate group used in the step g) from among the approximate curves generated in the step g), wherein the steps e) to h) are performed for every possible combination of the four approximate lines. a) extracting an edge coordinate group for the analysis region from the image data, wherein the edge coordinate group is a group of coordinate data pieces extracted based on a change of the luminance of each pixel in the image data; b) performing processing for extracting, from the edge coordinate group, a side coordinate group that corresponds to one side of the analysis region for each of four sides of the analysis region; c) generating four approximate lines respectively from the four side coordinate groups; d) performing processing for extracting, from the edge coordinate group, a corner coordinate group that is a group of coordinates for specifying one corner of the analysis region for each of four corners of the analysis region; e) selecting a first approximate line and a second approximate line that intersect with each other from among the four approximate lines; f) setting a plurality of contact candidate coordinates on each of the first approximate line and the second approximate line; g) generating an approximate curve by polynomial approximation from one of the corner coordinate groups that is closest to an intersection point of the first approximate line and the second approximate line, the approximate curve being in contact with at least one or more pairs of one contact candidate coordinates set on the first approximate line and one contact candidate coordinates set on the second approximate line; and h) selecting an approximate curve that is closest to the corner coordinate group used in the step g) from among the approximate curves generated in the step g),