001/* 002 * Copyright (C) Photon Vision. 003 * 004 * This program is free software: you can redistribute it and/or modify 005 * it under the terms of the GNU General Public License as published by 006 * the Free Software Foundation, either version 3 of the License, or 007 * (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program. If not, see <https://www.gnu.org/licenses/>. 016 */ 017 018package org.photonvision.vision.pipe.impl; 019 020import java.util.List; 021import org.apache.commons.lang3.tuple.Pair; 022import org.opencv.core.Mat; 023import org.opencv.core.Scalar; 024import org.opencv.imgproc.Imgproc; 025import org.photonvision.vision.pipe.MutatingPipe; 026import org.photonvision.vision.target.TrackedTarget; 027 028public class DrawCornerDetectionPipe 029 extends MutatingPipe<Pair<Mat, List<TrackedTarget>>, DrawCornerDetectionPipe.DrawCornerParams> { 030 @Override 031 protected Void process(Pair<Mat, List<TrackedTarget>> in) { 032 Mat image = in.getLeft(); 033 034 for (var target : in.getRight()) { 035 var corners = target.getTargetCorners(); 036 for (var corner : corners) { 037 Imgproc.circle(image, corner, params.dotRadius, params.dotColor); 038 } 039 } 040 041 return null; 042 } 043 044 public static class DrawCornerParams { 045 int dotRadius; 046 Scalar dotColor; 047 } 048}