class Java2DFrameUtils {

    private static OpenCVFrameConverter.ToIplImage  iplConv = new OpenCVFrameConverter.ToIplImage();
    private static OpenCVFrameConverter.ToMat       matConv = new OpenCVFrameConverter.ToMat();
    private static Java2DFrameConverter             biConv  = new Java2DFrameConverter();

    /**
     * Clones (deep copies the data) of a {@link BufferedImage}. Necessary when
     * converting to BufferedImages from JavaCV types to avoid re-using the same
     * memory locations.
     *
     * @param source
     * @return
     */
    public static BufferedImage deepCopy(BufferedImage source) {
        return Java2DFrameConverter.cloneBufferedImage(source);
    }

    public synchronized static BufferedImage toBufferedImage(IplImage src) {
        try (Frame f = iplConv.convert(src).clone()) {
            return deepCopy(biConv.getBufferedImage(f));
        }
    }

    public synchronized static BufferedImage toBufferedImage(Mat src) {<FILL_FUNCTION_BODY>}

    public synchronized static BufferedImage toBufferedImage(Frame src) {
        try (Frame f = src.clone()) {
            return deepCopy(biConv.getBufferedImage(f));
        }
    }

    public synchronized static IplImage toIplImage(Mat src){
        return iplConv.convertToIplImage(matConv.convert(src)).clone();
    }

    public synchronized static IplImage toIplImage(Frame src){
        return iplConv.convertToIplImage(src).clone();
    }

    public synchronized static IplImage toIplImage(BufferedImage src){
        return iplConv.convertToIplImage(biConv.convert(src)).clone();
    }

    public synchronized static Mat toMat(IplImage src){
        return matConv.convertToMat(iplConv.convert(src).clone());
    }

    public synchronized static Mat toMat(Frame src){
        return matConv.convertToMat(src).clone();
    }

    public synchronized static Mat toMat(BufferedImage src){
        return matConv.convertToMat(biConv.convert(src)).clone();
    }

    public synchronized static Frame toFrame(IplImage src){
        return iplConv.convert(src).clone();
    }

    public synchronized static Frame toFrame(Mat src){
        return matConv.convert(src).clone();
    }

    public synchronized static Frame toFrame(BufferedImage src){
        return biConv.convert(src).clone();
    }
}

        try (Frame f = matConv.convert(src).clone()) {
            return deepCopy(biConv.getBufferedImage(f));
        }
    
<no_super_class>