A method for detecting if an object detected in a surveillance or access control system comprising a camera is a two-dimensional representation and not a real three-dimensional object, the method comprising: capturing (S1) a first image by the camera, using a first focus setting and a first aperture size, detecting (S2) the object in the first image , determining (S3a) a first protrusion focus measure (F p1 ) in a protrusion area of the object in the first image, determining (S3b) a first recess focus measure (F r1 ) in a recess area of the object in the first image, capturing (S4) a second image by the camera, using the first focus setting and a second aperture size which is different from the first aperture size, detecting (S5) the object in the second image , determining (S6a) a second protrusion focus measure (F p2 ) in a protrusion area of the object in the second image, determining (S6b) a second recess focus measure (F r2 ) in a recess area of the object in the second image, calculating (S7a) a protrusion focus difference between the first and second protrusion focus measures, calculating (S7b) a recess focus difference between the first and second recess focus measures, comparing (S8) the protrusion focus difference and the recess focus difference, and if the protrusion focus difference and the recess focus difference differ by less than a predetermined threshold amount, determining (S9) that the object is a two-dimensional representation and not a real three-dimensional object, wherein the object is a face and wherein the protrusion area is an area corresponding to a nose area of the face, and wherein the recess area is an area corresponding to an ear , cheek, chin, or forehead area of the face. capturing (S1) a first image by the camera, using a first focus setting and a first aperture size, detecting (S2) the object in the first image , determining (S3a) a first protrusion focus measure (F p1 ) in a protrusion area of the object in the first image, determining (S3b) a first recess focus measure (F r1 ) in a recess area of the object in the first image, capturing (S4) a second image by the camera, using the first focus setting and a second aperture size which is different from the first aperture size, detecting (S5) the object in the second image , determining (S6a) a second protrusion focus measure (F p2 ) in a protrusion area of the object in the second image, determining (S6b) a second recess focus measure (F r2 ) in a recess area of the object in the second image, calculating (S7a) a protrusion focus difference between the first and second protrusion focus measures, calculating (S7b) a recess focus difference between the first and second recess focus measures, comparing (S8) the protrusion focus difference and the recess focus difference, and if the protrusion focus difference and the recess focus difference differ by less than a predetermined threshold amount, determining (S9) that the object is a two-dimensional representation and not a real three-dimensional object, wherein the object is a face and wherein the protrusion area is an area corresponding to a nose area of the face, and wherein the recess area is an area corresponding to an ear , cheek, chin, or forehead area of the face. <EOS>