protected static org.sikuli.natives.Mat convertBufferedImageToMat(BufferedImage img) { if (img != null) { long theMatTime = new Date().getTime(); byte[] data = convertBufferedImageToByteArray(img); org.sikuli.natives.Mat theMat = Vision.createMat(img.getHeight(), img.getWidth(), data); if (Settings.FindProfiling) { Debug.logp("[FindProfiling] createCVMat [%d x %d]: %d msec", img.getWidth(), img.getHeight(), new Date().getTime() - theMatTime); } return theMat; } else { return null; } }