A method for processing a digital image comprising a digital representation of a document , the method comprising: using a processor , defining a plurality of candidate edge points , wherein defining each candidate edge point comprises: defining a large analysis window within a digital image , the large analysis window including a first plurality of pixels; defining a plurality of small analysis windows within the digital image , wherein each of the small analysis windows includes a second plurality of pixels, and wherein the second plurality of pixels is less than the first plurality of pixels included within the large analysis window; estimating one or more distributions of statistics for the large analysis window ; calculating one or more statistics for each small analysis window ; determining whether a statistically significant difference exists between one or more of the statistics calculated for each of the small analysis windows and a corresponding distribution of statistics estimated for the large analysis window ; designating a point in each small analysis window for which the statistically significant difference exists as a candidate edge point upon determining the statistically significant difference exists ; and defining four sides of a tetragon based on the plurality of candidate edge points ; and outputting the digital representation of the document and the tetragon to a display of a mobile device . using a processor , defining a plurality of candidate edge points , wherein defining each candidate edge point comprises: defining a large analysis window within a digital image , the large analysis window including a first plurality of pixels; defining a plurality of small analysis windows within the digital image , wherein each of the small analysis windows includes a second plurality of pixels, and wherein the second plurality of pixels is less than the first plurality of pixels included within the large analysis window; estimating one or more distributions of statistics for the large analysis window ; calculating one or more statistics for each small analysis window ; determining whether a statistically significant difference exists between one or more of the statistics calculated for each of the small analysis windows and a corresponding distribution of statistics estimated for the large analysis window ; designating a point in each small analysis window for which the statistically significant difference exists as a candidate edge point upon determining the statistically significant difference exists ; and defining a large analysis window within a digital image , the large analysis window including a first plurality of pixels; defining a plurality of small analysis windows within the digital image , wherein each of the small analysis windows includes a second plurality of pixels, and wherein the second plurality of pixels is less than the first plurality of pixels included within the large analysis window; estimating one or more distributions of statistics for the large analysis window ; calculating one or more statistics for each small analysis window ; determining whether a statistically significant difference exists between one or more of the statistics calculated for each of the small analysis windows and a corresponding distribution of statistics estimated for the large analysis window ; designating a point in each small analysis window for which the statistically significant difference exists as a candidate edge point upon determining the statistically significant difference exists ; and defining four sides of a tetragon based on the plurality of candidate edge points ; and outputting the digital representation of the document and the tetragon to a display of a mobile device . <EOS>