1. A method for detecting a surface pattern comprising: capturing a surface image of a sample element to be detected, wherein said surface image containing N grayscale pixels and wherein said N is a positive integer; selecting f×N pixels with small grayscale value based on a selection ratio f in order to define a pattern zone and further calculating a pattern mean of said pattern zone based on pixel amount and grayscale value of said pattern zone; selecting f×N pixels with big grayscale value in order to define a background zone and further calculating a background mean of said background zone based on pixel amount and grayscale value of said background zone; and determining whether said surface image of said sample element has a defect based on said pattern mean of said pattern zone and said background mean of said background zone.