All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.catools.media.utils.CBoofCVUtil Maven / Gradle / Ivy

package org.catools.media.utils;

import boofcv.io.image.ConvertBufferedImage;
import boofcv.struct.image.GrayF32;
import boofcv.struct.image.ImageBase;

import java.awt.image.BufferedImage;

public class CBoofCVUtil {

    public static GrayF32 toGrayF32(BufferedImage buffered) {
        return ConvertBufferedImage.convertFrom(buffered, new GrayF32(buffered.getWidth(), buffered.getHeight()));
    }

    public static void reshapeToSameSize(ImageBase img1, ImageBase img2) {
        int maxHeight = Math.max(img1.getHeight(), img2.getHeight());
        int maxWidth = Math.max(img1.getWidth(), img2.getWidth());

        img1.reshape(maxWidth, maxHeight);
        img2.reshape(maxWidth, maxHeight);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy