1. A method for generating a masking image using a general polygonal mask, comprising: receiving a pixel of a raw image and a polygon vertices array corresponding to a polygonal mask; determining whether the pixel is inside the polygonal mask; labeling the pixel to be a masked pixel if the pixel is inside the polygonal mask, or labeling the pixel to be a visible pixel if the pixel is outside the polygonal mask; and outputting the masked pixel or the visible pixel to generate the masking image; wherein determining whether the pixel is inside the polygonal mask comprises: setting two consecutive vertices of the polygon vertices array to be a start point and a terminal point according to an indication, wherein the indication is one of numbers from zero to a number of edges of the polygonal mask; checking if the pixel is bounded by the start and terminal points in a first dimension; determining if the pixel is at a left side of a first vector according to a cross product and a direction of the first vector if the pixel is bounded by the start and terminal points in the first dimension; increasing a count by one if the pixel is at the left side of the first vector; checking whether relative locations between the pixel and all the edges of the polygonal mask are determined; and checking if the count is odd to determine whether the pixel is inside the polygonal mask if the relative locations between the pixel and all the edges of the polygonal mask are checked.