1. An image processing apparatus for processing a stained sample image obtained by imaging a stained sample, the image processing apparatus comprising: a processor comprising hardware configured to implement: a characteristic amount calculator for calculating a first characteristic amount for each pixel constituting the stained sample image; and a component ratio calculator for, based on the first characteristic amount calculated by the characteristic amount calculator: calculating a distance of each of the components representing a distance between the target pixel and each of the components in the first characteristic amount; totalizing the distance of each of the components for all of the components of the target pixel to calculate a distance of all of the components; and calculating a component ratio of each of the components in the target pixel by calculating a ratio of the distance of each of the components to the distance of all of the components for all of the components of the target pixel; and a reference value storage medium for storing a reference value of a second characteristic amount for each of the components; the processor being further configured to implement: a component correction coefficient calculator for calculating a component correction coefficient representing a correction coefficient for the second characteristic amount of each of the components, based on the second characteristic amount of each of the components and the reference value thereof stored in the reference value storage medium; a target pixel correction coefficient calculator for calculating, based on the component ratio calculated by the component ratio calculator and the component correction coefficient calculated by the component correction coefficient calculator, a target pixel correction coefficient representing a correction coefficient for the second characteristic amount of the target pixel by multiplying the component ratio and the component correction coefficient together for each of the components of the target pixel to calculate a component-owned correction coefficient representing a correction coefficient owned by each of the components of the target pixel for the second characteristic amount and totalizing the component-owned correction coefficient of all of the components of the target pixel; and a characteristic amount corrector for correcting the second characteristic amount of the target pixel, based on the target pixel correction coefficient calculated by the target pixel correction coefficient calculator.