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

boofcv.alg.transform.pyramid.impl.ImplPyramidOps_MT Maven / Gradle / Ivy

Go to download

BoofCV is an open source Java library for real-time computer vision and robotics applications.

There is a newer version: 1.1.6
Show newest version
/*
 * Copyright (c) 2021, Peter Abeles. All Rights Reserved.
 *
 * This file is part of BoofCV (http://boofcv.org).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package boofcv.alg.transform.pyramid.impl;

import javax.annotation.Generated;
import boofcv.alg.interpolate.InterpolatePixelS;
import boofcv.struct.image.GrayF32;
import boofcv.struct.image.GrayU8;

import boofcv.concurrency.BoofConcurrency;

/**
 * 

* Image type specific implementations of functions in {@link boofcv.alg.transform.pyramid.PyramidOps}. *

* *

* DO NOT MODIFY. This code was automatically generated by GenerateImplPyramidOps. *

* * @author Peter Abeles */ @SuppressWarnings("Duplicates") @Generated("boofcv.alg.transform.pyramid.impl.ImplPyramidOps") public class ImplPyramidOps_MT { /** * Scales an image up using interpolation */ public static void scaleImageUp(GrayF32 input , GrayF32 output , int scale , InterpolatePixelS interp ) { output.reshape(input.width*scale,input.height*scale); float fdiv = 1/(float)scale; interp.setImage(input); BoofConcurrency.loopFor(0, output.height, y -> { float inputY = y*fdiv; int indexOutput = output.getIndex(0,y); for (int x = 0; x < output.width; x++) { float inputX = x*fdiv; output.data[indexOutput++] = interp.get(inputX,inputY); } }); } /** * Scales down the input by a factor of 2. Every other pixel along both axises is skipped. */ public static void scaleDown2( GrayF32 input , GrayF32 output ) { output.reshape(input.width / 2, input.height / 2); BoofConcurrency.loopFor(0, output.height, y -> { int indexInput = 2*y*input.stride; int indexOutput = y*output.stride; for (int x = 0; x < output.width; x++,indexInput+=2) { output.data[indexOutput++] = input.data[indexInput]; } }); } /** * Scales an image up using interpolation */ public static void scaleImageUp(GrayU8 input , GrayU8 output , int scale , InterpolatePixelS interp ) { output.reshape(input.width*scale,input.height*scale); float fdiv = 1/(float)scale; interp.setImage(input); BoofConcurrency.loopFor(0, output.height, y -> { float inputY = y*fdiv; int indexOutput = output.getIndex(0,y); for (int x = 0; x < output.width; x++) { float inputX = x*fdiv; output.data[indexOutput++] = (byte)interp.get(inputX,inputY); } }); } /** * Scales down the input by a factor of 2. Every other pixel along both axises is skipped. */ public static void scaleDown2( GrayU8 input , GrayU8 output ) { output.reshape(input.width / 2, input.height / 2); BoofConcurrency.loopFor(0, output.height, y -> { int indexInput = 2*y*input.stride; int indexOutput = y*output.stride; for (int x = 0; x < output.width; x++,indexInput+=2) { output.data[indexOutput++] = input.data[indexInput]; } }); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy