Java Code Examples for org.opencv.imgproc.Imgproc#CV_INTER_LINEAR

The following examples show how to use org.opencv.imgproc.Imgproc#CV_INTER_LINEAR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Transform.java    From FTCVision with MIT License 5 votes vote down vote up
private static void resize(Mat img, Size size) {
    int interpolation;
    if (MathUtil.equal(size.area(), img.size().area()))
        return;
    else if (size.width > img.size().width && size.height > img.size().height)
        interpolation = Imgproc.CV_INTER_CUBIC; //enlarge image
    else if (size.width < img.size().width && size.height < img.size().height)
        interpolation = Imgproc.CV_INTER_AREA; //shrink image
    else
        interpolation = Imgproc.CV_INTER_LINEAR; //not entirely sure, so use safe option
    Imgproc.resize(img, img, size, 0, 0, interpolation);
}