1. An image processing device, comprising: imaging means that takes an image; facial image extraction means that extracts a facial image from the image; masking pattern generation means that generates a masking pattern to mask a part of an image, and repeatedly changes the masking pattern until a state where a facial image other than the facial image of a visitor cannot be extracted from the image by the facial image extraction means; and recording means that records the masking pattern when the facial image extraction means cannot extract the facial image other than the facial image of a visitor from the image that has been masked using the masking pattern generated by the masking pattern generation means.