Photon Vision - Cargo not Bumpers

Has anyone had good luck using photon vision to track the blue and red cargo without picking up on bumpers?

I was playing with it today using the shape function and had a heck of a time getting it to pick up on the cargo and not the bumpers.

3 Likes

Added Support for 3D tracking of the 2022 Cargo Balls by 1337-haxxor · Pull Request #408 · PhotonVision/photonvision (github.com)

Maybe try out the latest dev .jar and use this? Worth a shot.
Also, we do now have a PhotonVision category on ChiefDelphi so if you use that, the developers will get notified when you post.

1 Like

So far this was the blue cargo pipeline I was trying:

Blue Cargo
  "pipelineIndex" : 0,
  "pipelineType" : "ColoredShape",
  "inputImageFlipMode" : "NONE",
  "inputImageRotationMode" : "DEG_180",
  "pipelineNickname" : "Blue Cargo",
  "cameraExposure" : 50.0,
  "cameraBrightness" : 50,
  "cameraGain" : 50,
  "cameraVideoModeIndex" : 0,
  "streamingFrameDivisor" : "NONE",
  "ledMode" : true,
  "inputShouldShow" : true,
  "outputShouldShow" : true,
  "hsvHue" : {
    "first" : 100,
    "second" : 140
  },
  "hsvSaturation" : {
    "first" : 215,
    "second" : 255
  },
  "hsvValue" : {
    "first" : 0,
    "second" : 70
  },
  "outputShouldDraw" : true,
  "outputShowMultipleTargets" : true,
  "contourArea" : {
    "first" : 0.2,
    "second" : 35.0
  },
  "contourRatio" : {
    "first" : 0.0,
    "second" : 20.0
  },
  "contourFullness" : {
    "first" : 0.0,
    "second" : 100.0
  },
  "contourSpecklePercentage" : 5,
  "contourSortMode" : "Largest",
  "contourTargetOffsetPointEdge" : "Center",
  "contourTargetOrientation" : "Landscape",
  "offsetRobotOffsetMode" : "None",
  "offsetSinglePoint" : {
    "x" : 0.0,
    "y" : 0.0
  },
  "offsetDualPointA" : {
    "x" : 0.0,
    "y" : 0.0
  },
  "offsetDualPointAArea" : 0.0,
  "offsetDualPointB" : {
    "x" : 0.0,
    "y" : 0.0
  },
  "offsetDualPointBArea" : 0.0,
  "contourGroupingMode" : "Single",
  "contourIntersection" : "Up",
  "solvePNPEnabled" : false,
  "targetModel" : "k2020HighGoalOuter",
  "cornerDetectionStrategy" : "APPROX_POLY_DP_AND_EXTREME_CORNERS",
  "cornerDetectionUseConvexHulls" : true,
  "cornerDetectionExactSideCount" : false,
  "cornerDetectionSideCount" : 4,
  "cornerDetectionAccuracyPercentage" : 10.0,
  "contourShape" : "Circle",
  "contourPerimeter" : {
    "first" : 0.0,
    "second" : 600.0
  },
  "accuracyPercentage" : 10.0,
  "circleDetectThreshold" : 20,
  "contourRadius" : {
    "first" : 0,
    "second" : 25
  },
  "minDist" : 20,
  "maxCannyThresh" : 35,
  "circleAccuracy" : 10,
  "cameraCalibration" : null,
  "erode" : false,
  "dilate" : false
} ]```

Wasn’t trying red much until the hue thresholding was better. Also, this is work in progress, but I figured by sharing might slowly get better contours and settings for the cargo.

Some other caveats are I think the lower blue shadow hues will be reduced with illumination by some light on the robot, so that is why that is fairly narrow.

Also I did run it with the bumper in foreground and it didn’t target it, but didn’t do background located bumpers. It didn’t target my blue jeans however.

2 Likes

@mdurrani834 Okay. I’ll have to check that out and play with it a bit.

@ngreen I’m having a harder time with the red cargo. Visually the bumpers don’t represent a circle at all except for the round corners. Yet if I turned down the circle accuracy enough to were it would not pick up on the bumper, it would start glitching in and out on the cargo.

I’ve tried adjusting the exposer and brightness to minimize shadows underneath the cargo without sacrificing to much frame rate. This gives me a fuller circle with narrower HSV selections but still doesn’t seem to help much with distinction between the two.

I’ll keep playing with it and share the results when I can.

This is because red wraps around zero on the color wheel and there is currently no way to grab both a little above and below zero without grabbing everything in between

2 Likes

Are you talking about how photon vision currently works or just in general?
I’ve found opencv tutorials on collecting values from both sides of the range for a wider spectrum.

Here is what I found.
Do you use opencv underneath for the pipeline processes?

It seems to be a UI issue with using sliders and deciding that it was a feature needed to be implemented, and how best to.

I was saying how it currently works. It is more a UI problem to intuitively allow 2 ranges than a technical problem.

@jdaming
Just a thought. Maybe you could have both ends of the slides different colors and then allow them to cross each other.

Example: Slider one is blue and represents the starting value for the range.
Slider two is red and represents the end of the range.
If I wanted a wide range of red, I would move the blue slider to a value of 160 and the red to 10.

1 Like