1. A method for detecting objects used in a device for detecting objects, wherein the method comprises: acquiring an image having pixels; generating a plurality of image blocks, in which each of the image blocks corresponds to one of the pixels; filtering a specific image block of the image blocks by using N filtering parameters to generate N filtering results, in which the N filtering parameters gradually enhance the blurriness of the specific image block, wherein N is an integer greater than 1; computing N root mean square error (RMSE.) values, in which M is an integer from 2 to N, the first RMSE value is computed according to the first filtering result and the specific image block with no filtering, and the M-th RMSE value is computed according to the M-th and the (M−1)-th filtering results; computing a slope of an approximate line according to the RMSE values as the blurriness value of the specific image block; repeating the above steps to generate the blurriness values of all of the image blocks correspond to the pixels: and comparing each of the blurriness values with a threshold value to detect corresponding pixels which are parts of a sharp object and further detect an in-focus object.