Fix dnn object detection sample
This commit is contained in:
parent
8d0b3dad5c
commit
741aee6901
@ -347,7 +347,7 @@ void postprocess(Mat& frame, const std::vector<Mat>& outs, Net& net)
|
|||||||
int bottom = (int)data[i + 6];
|
int bottom = (int)data[i + 6];
|
||||||
int width = right - left + 1;
|
int width = right - left + 1;
|
||||||
int height = bottom - top + 1;
|
int height = bottom - top + 1;
|
||||||
if (width * height <= 1)
|
if (width <= 2 || height <= 2)
|
||||||
{
|
{
|
||||||
left = (int)(data[i + 3] * frame.cols);
|
left = (int)(data[i + 3] * frame.cols);
|
||||||
top = (int)(data[i + 4] * frame.rows);
|
top = (int)(data[i + 4] * frame.rows);
|
||||||
|
|||||||
@ -126,7 +126,7 @@ def postprocess(frame, outs):
|
|||||||
bottom = int(detection[6])
|
bottom = int(detection[6])
|
||||||
width = right - left + 1
|
width = right - left + 1
|
||||||
height = bottom - top + 1
|
height = bottom - top + 1
|
||||||
if width * height <= 1:
|
if width <= 2 or height <= 2:
|
||||||
left = int(detection[3] * frameWidth)
|
left = int(detection[3] * frameWidth)
|
||||||
top = int(detection[4] * frameHeight)
|
top = int(detection[4] * frameHeight)
|
||||||
right = int(detection[5] * frameWidth)
|
right = int(detection[5] * frameWidth)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user