Skip to content

Commit 5ed8d98

Browse files
authored
fix(vision): use float for detect_object as these range between 0 and 1 (GoogleCloudPlatform#1047)
Use float specifier so that normalized vertices and confidence score are printed out. Otherwise we get all zeroes for the vertices and confidence score.
1 parent 03d5fac commit 5ed8d98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vision/src/detect_object.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ function detect_object($path)
3636
$score = $object->getScore();
3737
$vertices = $object->getBoundingPoly()->getNormalizedVertices();
3838

39-
printf('%s (confidence %d)):' . PHP_EOL, $name, $score);
39+
printf('%s (confidence %f)):' . PHP_EOL, $name, $score);
4040
print('normalized bounding polygon vertices: ');
4141
foreach ($vertices as $vertex) {
42-
printf(' (%d, %d)', $vertex->getX(), $vertex->getY());
42+
printf(' (%f, %f)', $vertex->getX(), $vertex->getY());
4343
}
4444
print(PHP_EOL);
4545
}

0 commit comments

Comments
 (0)