Ryan Lee
commited on
Commit
·
a8f2672
1
Parent(s):
ab90c04
Fix visualization and correct default model (#237)
Browse files
models/text_detection_ppocr/demo.cpp
CHANGED
|
@@ -18,7 +18,7 @@ vector< pair<cv::dnn::Backend, cv::dnn::Target> > backendTargetPairs = {
|
|
| 18 |
|
| 19 |
std::string keys =
|
| 20 |
"{ help h | | Print help message. }"
|
| 21 |
-
"{ model m |
|
| 22 |
"{ input i | | Usage: Path to input image or video file. Skip this argument to capture frames from a camera.}"
|
| 23 |
"{ width | 736 | Usage: Resize input image to certain width, default = 736. It should be multiple by 32.}"
|
| 24 |
"{ height | 736 | Usage: Resize input image to certain height, default = 736. It should be multiple by 32.}"
|
|
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
|
|
| 113 |
int maxCand = parser.get<int>("max_candidates");
|
| 114 |
double unRatio = parser.get<float>("unclip_ratio");
|
| 115 |
bool save = parser.get<bool>("save");
|
| 116 |
-
bool viz = parser.get<
|
| 117 |
|
| 118 |
PPOCRDet model(modelName, inpSize, binThresh, polyThresh, maxCand, unRatio, backendTargetPairs[backendTargetid].first, backendTargetPairs[backendTargetid].second);
|
| 119 |
|
|
@@ -172,7 +172,10 @@ int main(int argc, char** argv)
|
|
| 172 |
imwrite("result.jpg", originalImage);
|
| 173 |
}
|
| 174 |
if (viz)
|
|
|
|
| 175 |
imshow(kWinName, originalImage);
|
|
|
|
|
|
|
| 176 |
}
|
| 177 |
else
|
| 178 |
imshow(kWinName, originalImage);
|
|
|
|
| 18 |
|
| 19 |
std::string keys =
|
| 20 |
"{ help h | | Print help message. }"
|
| 21 |
+
"{ model m | text_detection_cn_ppocrv3_2023may.onnx | Usage: Set model type, defaults to text_detection_ch_ppocrv3_2023may.onnx }"
|
| 22 |
"{ input i | | Usage: Path to input image or video file. Skip this argument to capture frames from a camera.}"
|
| 23 |
"{ width | 736 | Usage: Resize input image to certain width, default = 736. It should be multiple by 32.}"
|
| 24 |
"{ height | 736 | Usage: Resize input image to certain height, default = 736. It should be multiple by 32.}"
|
|
|
|
| 113 |
int maxCand = parser.get<int>("max_candidates");
|
| 114 |
double unRatio = parser.get<float>("unclip_ratio");
|
| 115 |
bool save = parser.get<bool>("save");
|
| 116 |
+
bool viz = parser.get<bool>("viz");
|
| 117 |
|
| 118 |
PPOCRDet model(modelName, inpSize, binThresh, polyThresh, maxCand, unRatio, backendTargetPairs[backendTargetid].first, backendTargetPairs[backendTargetid].second);
|
| 119 |
|
|
|
|
| 172 |
imwrite("result.jpg", originalImage);
|
| 173 |
}
|
| 174 |
if (viz)
|
| 175 |
+
{
|
| 176 |
imshow(kWinName, originalImage);
|
| 177 |
+
waitKey(0);
|
| 178 |
+
}
|
| 179 |
}
|
| 180 |
else
|
| 181 |
imshow(kWinName, originalImage);
|