def stretch_pattern(image_source):
wsize, hsize = image_source.size;<EOL>(ws, hs, we, he) = gray_pattern_borders(image_source);<EOL>image_source = image_source.crop((ws, hs, we, he));<EOL>image_source = image_source.resize((wsize, hsize), Image.ANTIALIAS);<EOL>data = [pixel for pixel in image_source.getdata()];<EOL>image_pattern = rgb2gray(data);<EOL>return (image_pattern, image_source)<EOL>
!
    @brief Returns stretched content as 1-dimension (gray colored) matrix with size of input image.

    @param[in] image_source (Image): PIL Image instance.

    @return (list, Image) Stretched image as gray colored matrix and source image.