private static Point imageMatching(Mat source, Mat template)
	{
		//TODO source greater than template -> resize?
		if(source.cols() < template.cols())
		{}
		
		if(source.rows() < template.rows())
		{}
		
		int             cols             = source.cols() - template.cols() + 1;
		int             rows             = source.rows() - template.rows() + 1;
		Mat             result           = new Mat(cols, rows, CvType.CV_32FC1);
		Point           location         = null;
		MinMaxLocResult minMaxLocation   = null;
		Mat             resultThreshold  = new Mat(result.rows(),   result.cols(),   CvType.CV_32FC1);
		Mat             logPolarSource   = new Mat(source.rows(),   source.cols(),   CvType.CV_32FC1);
		Mat             logPolarTemplate = new Mat(template.rows(), template.cols(), CvType.CV_32FC1);
		
		// transform data to polar coordinates
		Imgproc.logPolar(source, logPolarSource, 
		                 new Point(logPolarSource.cols() / 2, logPolarSource.rows() / 2), 
		                 0.1, Imgproc.CV_WARP_INVERSE_MAP + Imgproc.CV_WARP_FILL_OUTLIERS);

        Imgproc.logPolar(template, logPolarTemplate, 
                         new Point(logPolarTemplate.cols() / 2, logPolarTemplate.rows() / 2), 
                         0.1, Imgproc.CV_WARP_INVERSE_MAP + Imgproc.CV_WARP_FILL_OUTLIERS);
		
		// matching, normalize
		Imgproc.matchTemplate(logPolarSource, logPolarTemplate, result, Imgproc.TM_CCOEFF);
		Core.normalize(result, result, 0, 1, Core.NORM_MINMAX, -1, new Mat());
		Imgproc.threshold(result, resultThreshold, 0.8, 255, 0);

		// find best match
		minMaxLocation = Core.minMaxLoc(result);
		
		// method = Imgproc.TM_SQDIFF || Imgproc.TM_SQDIFF_NORMED
		// location = minMaxLocation.minLoc;
		// else
		location = minMaxLocation.maxLoc;

		// rate match
		int white = 0;
		double percentWhite = 100;
		
		for (int i = 0; i < resultThreshold.cols(); i++) 
		{
			for (int j = 0; j < resultThreshold.rows(); j++) 
			{
				if((int)resultThreshold.get(j, i)[0] == 255)
				{
					white++;
				}
			}
		}
		
		percentWhite = (100.0 / ((double)resultThreshold.cols() * (double)resultThreshold.rows())) * (double)white;

		// Complete image dump?
		//Imgcodecs.imwrite("source.jpg",           source);
		//Imgcodecs.imwrite("template.jpg",         template);
		//Imgcodecs.imwrite("logPolarSource.jpg",   logPolarSource);
		//Imgcodecs.imwrite("logPolarTemplate.jpg", logPolarTemplate);
		//Imgcodecs.imwrite("resultThreshold.jpg",  resultThreshold);
		
		//System.out.println(percentWhite);
		
		if(percentWhite > 5 || percentWhite <= 0.0001)
		{
			return null;
		}
		
		/*// Marked image
		Imgproc.rectangle(source, location, new Point(location.x + template.cols(), 
					      location.y + template.rows()), new Scalar(0, 255, 0));
		Imgcodecs.imwrite("markedMatch.jpg",  source);
		*/
		
		return location;
	}