A method of determining whether an image captured by a capturing device is clean or dirty, the method comprising: receiving the image captured by the image capturing device ; splitting the received image into a plurality of image portions according to predefined splitting criteria; performing, for each of at least some of the image portions, a filter process to produce a feature vector including Laplacian filter features of the image portion; providing each of at least some of the produced feature vectors to a first machine learning module that has been trained to produce a clean/dirty indicator depending on a corresponding feature vector, the clean/dirty indicator including a probabilistic value of cleanness or dirtiness of a corresponding image portion; performing a context-based filtering comprising: determining one or more dirty blocks including neighbouring dirty portions (410 - 412), wherein a dirty portion is an image portion with clean/dirty indicator denoting dirtiness, detecting one or more edges of the one or more dirty blocks , determining sharpness in the dirty portions included in the one or more edges , and adjusting clean/dirty indicators of the dirty portions (410 - 412) in the dirty blocks depending on the sharpness and/or the clean/dirty indicators of clean portions (413 - 416) that are adjacent to the edges , wherein a clean portion is an image portion with clean/dirty indicator denoting cleanness; and determining whether the image is clean or dirty depending on the clean/dirty indicators produced by the first machine learning module and subsequently adjusted by the context-based filtering. receiving the image captured by the image capturing device ; splitting the received image into a plurality of image portions according to predefined splitting criteria; performing, for each of at least some of the image portions, a filter process to produce a feature vector including Laplacian filter features of the image portion; providing each of at least some of the produced feature vectors to a first machine learning module that has been trained to produce a clean/dirty indicator depending on a corresponding feature vector, the clean/dirty indicator including a probabilistic value of cleanness or dirtiness of a corresponding image portion; performing a context-based filtering comprising: determining one or more dirty blocks including neighbouring dirty portions (410 - 412), wherein a dirty portion is an image portion with clean/dirty indicator denoting dirtiness, detecting one or more edges of the one or more dirty blocks , determining sharpness in the dirty portions included in the one or more edges , and adjusting clean/dirty indicators of the dirty portions (410 - 412) in the dirty blocks depending on the sharpness and/or the clean/dirty indicators of clean portions (413 - 416) that are adjacent to the edges , wherein a clean portion is an image portion with clean/dirty indicator denoting cleanness; and determining whether the image is clean or dirty depending on the clean/dirty indicators produced by the first machine learning module and subsequently adjusted by the context-based filtering. determining one or more dirty blocks including neighbouring dirty portions (410 - 412), wherein a dirty portion is an image portion with clean/dirty indicator denoting dirtiness, detecting one or more edges of the one or more dirty blocks , determining sharpness in the dirty portions included in the one or more edges , and adjusting clean/dirty indicators of the dirty portions (410 - 412) in the dirty blocks depending on the sharpness and/or the clean/dirty indicators of clean portions (413 - 416) that are adjacent to the edges , wherein a clean portion is an image portion with clean/dirty indicator denoting cleanness; and determining whether the image is clean or dirty depending on the clean/dirty indicators produced by the first machine learning module and subsequently adjusted by the context-based filtering. <EOS>