Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions adcvApp/adcvSrc/NDPluginCVHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ ADCVStatus_t NDPluginCVHelper::find_centroids(Mat& img, double* inputs, double*
int thresholdVal = (int)inputs[2];
double upperSizeThreshold = inputs[3];
double lowerSizeThreshold = inputs[4];
int reverseY = (int)inputs[5];
try {
// first we need to convert to grayscale if necessary
GaussianBlur(img, img, Size(blurDegree, blurDegree), 0);
Expand Down Expand Up @@ -661,8 +662,15 @@ ADCVStatus_t NDPluginCVHelper::find_centroids(Mat& img, double* inputs, double*
int counter = 0;
for (k = 0; k < contour_centroids.size(); k++) {
outputs[counter] = contour_centroids[k].x;
if (contour_centroids[k].y != 0)
outputs[counter + 1] = img.size().height - contour_centroids[k].y;
if (contour_centroids[k].y != 0) {
//to preserve old behavior, "reverse" aspect is just the plain Y value
if (reverseY) {
outputs[counter + 1] = contour_centroids[k].y;
}
else { //this is the old behavior
outputs[counter + 1] = img.size().height - contour_centroids[k].y;
}
}
counter = counter + 2;
if (counter >= NUM_OUTPUTS) break;
}
Expand Down Expand Up @@ -1267,13 +1275,14 @@ ADCVStatus_t NDPluginCVHelper::get_centroid_finder_description(string* inputDesc
string* outputDesc,
string* description) {
ADCVStatus_t status = cvHelperSuccess;
int numInput = 5;
int numInput = 6;
int numOutput = 10;
inputDesc[0] = "Num Largest Contours (Int 1 - 5)";
inputDesc[1] = "Blur degree (Int) Ex. 3";
inputDesc[2] = "Threshold Value (Int) Ex. 100";
inputDesc[3] = "Upper Size Threshold Ex. 600*400";
inputDesc[4] = "Lower Size Threshold Ex. 400";
inputDesc[5] = "Reverse Y";
outputDesc[0] = "Centroid 1 X";
outputDesc[1] = "Centroid 1 Y";
outputDesc[2] = "Centroid 2 X";
Expand Down
3 changes: 2 additions & 1 deletion docs/ADCompVision/ADCompVision.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ of desired objects to find, the blur degree (3 or 5 is usually best), a
threshold value, and an upper and lower pixel area threshold for the
objects. Play around with these numbers until the desired objects are
detected. The centroid centers are then outputted into the 'Output' PV
values
values. The "Reverse Y" option, when set to 1, will flip the Y coordinate
output to match, for example, what NDOverlay is expecting.

**Video Record**

Expand Down
4 changes: 2 additions & 2 deletions docs/ADCompVision/ADCompVisionManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ function, along with descriptions for each function
<tr>
<th>FindObjectCentroids
</th>
<th>5
<th>6
</th>
<th>[Num Largest Contours (Int), Blur Degree (Int), Threshold Value (Int), Upper Size Threshold (Int), Lower Size Threshold (Int)]
<th>[Num Largest Contours (Int), Blur Degree (Int), Threshold Value (Int), Upper Size Threshold (Int), Lower Size Threshold (Int), Reverse Y (Int)]
</th>
<th>2-10
</th>
Expand Down