fixed it lol

This commit is contained in:
gallant 2023-09-29 08:40:01 -05:00
parent 9a45010845
commit e0c1709867

View file

@ -114,24 +114,23 @@ public class FreeSightPipeline extends OpenCvPipeline {
MatOfPoint contour = contours.get(index);
Rect boundingRect = Imgproc.boundingRect(contour);
int min_x = boundingRect.x;
int max_x = boundingRect.x - boundingRect.width;
int min_y = boundingRect.y;
int max_y = boundingRect.y - boundingRect.height;
// center is ( x + w ) / 2
int point = (boundingRect.x + boundingRect.width) / 2;
Imgproc.rectangle(
threshold,
new Rect(
min_x,
min_y,
boundingRect.width,
boundingRect.height
),
boundingRect,
outline
);
if(point < width / 3)
positionState = Side.LEFT;
else if(point > width / 1.5)
positionState = Side.RIGHT;
else
positionState = Side.MIDDLE;
//list of frames to reduce inconsistency, not too many so that it is still real-time, change the number from 5 if you want
if (frameList.size() > 5) {
frameList.remove(0);