1. A method comprising: extracting one or more target patterns from a portion of an image; forming a pattern matrix based on the one or more target patterns; approximating the pattern matrix using a complexity-regularized representation derived from the pattern matrix; sending a query to search a library of images for vectors in the query to detect, using the complexity-regularized representation, any image in the library that contains image patches similar to the one or more target patterns; performing operations that include: finding a correlation coefficient with a patch extracted from the library for each pattern represented in terms of the complexity-regularized representation, including generating a complexity regularized statistics matrix and combining the complexity regularized statistics matrix with one descriptor of the complexity-regularized representation to obtain correlation results for all patterns; generating pattern presence statistics from correlation coefficients; and for each pattern, comparing a pattern presence statistic for said each pattern to a threshold to determine if said each pattern is present in the patch.