mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 11:21:39 +08:00
fixed a bug in mean subtraction from target and search patches
As the type of `targetPatch` and `searchPatch` is CV_8UC3, subtracting 128 from them will saturate all values smaller than 128 to zero.
This commit is contained in:
@@ -148,13 +148,9 @@ bool TrackerGOTURNImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
|
|||||||
resize(targetPatch, targetPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT);
|
resize(targetPatch, targetPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT);
|
||||||
resize(searchPatch, searchPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT);
|
resize(searchPatch, searchPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT);
|
||||||
|
|
||||||
//Mean Subtract
|
//Convert to Float type and subtract mean
|
||||||
targetPatch = targetPatch - 128;
|
Mat targetBlob = dnn::blobFromImage(targetPatch, 1.0f, Size(), Scalar::all(128), false);
|
||||||
searchPatch = searchPatch - 128;
|
Mat searchBlob = dnn::blobFromImage(searchPatch, 1.0f, Size(), Scalar::all(128), false);
|
||||||
|
|
||||||
//Convert to Float type
|
|
||||||
Mat targetBlob = dnn::blobFromImage(targetPatch, 1.0f, Size(), Scalar(), false);
|
|
||||||
Mat searchBlob = dnn::blobFromImage(searchPatch, 1.0f, Size(), Scalar(), false);
|
|
||||||
|
|
||||||
net.setInput(targetBlob, "data1");
|
net.setInput(targetBlob, "data1");
|
||||||
net.setInput(searchBlob, "data2");
|
net.setInput(searchBlob, "data2");
|
||||||
|
Reference in New Issue
Block a user