package org.firstinspires.ftc.teamcode.utility_code;
import android.graphics.Canvas;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.robotcore.internal.camera.calibration.CameraCalibration;
import org.firstinspires.ftc.vision.VisionProcessor;
import org.opencv.core.Mat;
public class PropDetectionProcessor implements VisionProcessor {
/* Our original class, PropDetection, implemented OpenCvPipeline, plus added a method
* called getLocation.
*/
private final PropDetection pipeline;
/**
* Our constructor needs to pass whatever the OpenCvPipeline's constructor wanted.
*
* @param t Telemetry object
*/
public PropDetectionProcessor(Telemetry t) {
pipeline = new PropDetection(t);
}
/**
* Our original pipeline exposed a computed value. We just pass through the method.
*
* @return whatever the original class returned.
* @noinspection unused
*/
public PropDetection.Location getLocation() {
return pipeline.getLocation();
}
/**
* We aren't doing anything for init.
*
* @param width width of the image
* @param height height of the image
* @param calibration calibration parameters for the camera
*/
@Override
public void init(int width, int height, CameraCalibration calibration) {
}
/**
* We pass through processFrame to the original pipeline, returning the result.
*
* @param input image frame
* @param captureTimeNanos capture time duration
* @return the modified image
*/
@Override
public Mat processFrame(Mat input, long captureTimeNanos) {
return pipeline.processFrame(input);
}
/**
* We aren't doing anything with onDrawFrame. We could render the output from processFrame,
* or augment the canvas by drawing graphics on top of it based on our determined actions.
*
* @param canvas a place to draw results
* @param onscreenWidth the size of the display
* @param onscreenHeight the size of the display
* @param scaleBmpPxToCanvasPx a scale factor from our image to the display
* @param scaleCanvasDensity see docs
* @param userContext see docs
*/
@Override
public void onDrawFrame(Canvas canvas, int onscreenWidth, int onscreenHeight, float scaleBmpPxToCanvasPx, float scaleCanvasDensity, Object userContext) {
}
}