A lens-attached matter detector, comprising: a process area obtainer configured to set a process target area from an input image from an imager having a lens, and divide the process target area into a plurality of areas including a plurality of pixels; an edge extractor configured to extract an edge image for each of the plurality areas, the edge image having only weak edges, that is edges whose intensity is within a predetermined range; a brightness distribution extractor configured to, repeatedly within a predetermined time, calculate an average brightness value of a brightness value of the pixels for each of the plurality areas, select an area having the average brightness value within a threshold range as an attention area, select an area around the attention area as a circumference area, count the number of circumference areas having an average brightness value higher than the average brightness value of the attention area, calculate a ratio of the counted circumference area, and count the number of weak edges by using the edge image extracted by the edge extractor; a brightness change extractor configured to calculate, when the predetermined time has passed and with respect to each area, variance of the average brightness value based on the average brightness value of the previous cycle which is obtained and accumulated by the brightness distribution extractor for each of the plurality of areas; and an attached matter determiner configured to determine the presence or absence of attached matter based on the number of weak edges counted by the brightness distribution extractor, the ratio of the circumference areas calculated by the brightness distribution extractor, and the variance of the average brightness value for each of the plurality of areas calculated by the brightness change extractor. a process area obtainer configured to set a process target area from an input image from an imager having a lens, and divide the process target area into a plurality of areas including a plurality of pixels; an edge extractor configured to extract an edge image for each of the plurality areas, the edge image having only weak edges, that is edges whose intensity is within a predetermined range; a brightness distribution extractor configured to, repeatedly within a predetermined time, calculate an average brightness value of a brightness value of the pixels for each of the plurality areas, select an area having the average brightness value within a threshold range as an attention area, select an area around the attention area as a circumference area, count the number of circumference areas having an average brightness value higher than the average brightness value of the attention area, calculate a ratio of the counted circumference area, and count the number of weak edges by using the edge image extracted by the edge extractor; a brightness change extractor configured to calculate, when the predetermined time has passed and with respect to each area, variance of the average brightness value based on the average brightness value of the previous cycle which is obtained and accumulated by the brightness distribution extractor for each of the plurality of areas; and an attached matter determiner configured to determine the presence or absence of attached matter based on the number of weak edges counted by the brightness distribution extractor, the ratio of the circumference areas calculated by the brightness distribution extractor, and the variance of the average brightness value for each of the plurality of areas calculated by the brightness change extractor.