A method of selecting an optimum value for each parameter of a parameter set for disparity calculation, comprising: an obtainment step of obtaining a pair of training images and a first disparity map corresponding to the pair of training images; a definition step of defining an initial parameter value range for each parameter in the parameter set so as to make up an initial parameter value range combination; a generation step of generating, by dividing the initial parameter value range of each parameter in the initial parameter value range combination, plural parameter value combinations of the parameter set; a calculation step of, regarding each of the plural parameter value combinations, obtaining a second disparity map by conducting disparity calculation with respect to the pair of training images by using the corresponding parameter value combination; a determination step of, regarding each of the plural parameter value combinations, determining a first approaching degree and a second approaching degree between the corresponding second disparity map and the first disparity map; and characterized by: a selection step of selecting a preferred parameter value range combination for the parameter set, corresponding to the pair of training images, wherein, the selection step includes carrying out, based on the first approaching degrees and the second approaching degrees, a grouping process with respect to the parameter value combinations of the parameter set so as to obtain the preferred parameter value range combination for the parameter set, so that the changes of the first approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination are less than a first predetermined threshold; the changes of the second approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination are less than a second predetermined threshold; and a third approaching degree related to the first approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination is greater than a third predetermined threshold. an obtainment step of obtaining a pair of training images and a first disparity map corresponding to the pair of training images; a definition step of defining an initial parameter value range for each parameter in the parameter set so as to make up an initial parameter value range combination; a generation step of generating, by dividing the initial parameter value range of each parameter in the initial parameter value range combination, plural parameter value combinations of the parameter set; a calculation step of, regarding each of the plural parameter value combinations, obtaining a second disparity map by conducting disparity calculation with respect to the pair of training images by using the corresponding parameter value combination; a determination step of, regarding each of the plural parameter value combinations, determining a first approaching degree and a second approaching degree between the corresponding second disparity map and the first disparity map; and characterized by: a selection step of selecting a preferred parameter value range combination for the parameter set, corresponding to the pair of training images, wherein, the selection step includes carrying out, based on the first approaching degrees and the second approaching degrees, a grouping process with respect to the parameter value combinations of the parameter set so as to obtain the preferred parameter value range combination for the parameter set, so that the changes of the first approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination are less than a first predetermined threshold; the changes of the second approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination are less than a second predetermined threshold; and a third approaching degree related to the first approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination is greater than a third predetermined threshold. a selection step of selecting a preferred parameter value range combination for the parameter set, corresponding to the pair of training images, wherein, the selection step includes carrying out, based on the first approaching degrees and the second approaching degrees, a grouping process with respect to the parameter value combinations of the parameter set so as to obtain the preferred parameter value range combination for the parameter set, so that the changes of the first approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination are less than a first predetermined threshold; the changes of the second approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination are less than a second predetermined threshold; and a third approaching degree related to the first approaching degrees determined based on the parameter value combinations within the preferred parameter value range combination is greater than a third predetermined threshold.