DNN: More stable DB text detection API#22614
Conversation
2aac53f to
94a1b4e
Compare
c87eb1f to
1f3c63e
Compare
|
Hi, I need your help @alalek, @asmorkalov @rogday. It looks like there is a problem with the Objective-C binding of |
1f3c63e to
faacf9b
Compare
|
@zihaomu Please take a look on https://stackoverflow.com/questions/2286312/method-overloading-in-objective-c. Objective-C does not support methods overload as it's designed in C++. It adds parameters names to methods signature to resolve methods with the same name correctly. Actually the same issue should happen with Python bindings. Bindings generator should generate bindings for one of the overloaded methods, not all of the variants.
|
20f10e7 to
d3dfdcd
Compare
|
Hi @vpisarev, please check if this PR really needs to overload the Actually, there are 3 different ways to support DB API with stddev value:
|
d3dfdcd to
414306e
Compare
|
Update offline discussion results: |
6464bbf to
7895efa
Compare
modules/dnn/src/model.cpp
Outdated
| // Because 0 is meaningless in scalefactor. | ||
| // If the scalefactor is (x, 0, 0, 0), we convert it to (x, x, x, x). | ||
| if (scale[1] == 0 && scale[2] == 0 && scale[3] == 0) | ||
| { | ||
| CV_Assert(scale[0] != 0 && "Scalefactor of 0 is meaningless."); | ||
| scale = Scalar::all(scale[0]); | ||
| } |
There was a problem hiding this comment.
Because we have backward compatibility, I think this hack is necessary.
| } | ||
| /*virtual*/ | ||
| void setInputScale(double scale_) | ||
| void setInputScale(const Scalar& scale_) |
There was a problem hiding this comment.
Change Module API from double to Scalar.
29f5018 to
eb3d550
Compare
modules/dnn/src/dnn_common.hpp
Outdated
| // Scalefactor is a common parameter used for data scaling. In OpenCV, we often use Scalar to represent it. | ||
| // Because 0 is meaningless in scalefactor. | ||
| // If the scalefactor is (x, 0, 0, 0), we convert it to (x, x, x, x). The following func will do this hack. | ||
| Scalar hackScalar(const Scalar& _scale) |
There was a problem hiding this comment.
Should be static / static inline or moved to .cpp
There was a problem hiding this comment.
can we use some better name? say, broadcastRealScalar? Also, I agree that for now it should be put into some internal header and made inline function
|
@opencv-alalek Could you, please, update ABI compliance checker options? |
Merge with extra: opencv/opencv_extra#1011
The followings are the purpose of the PR:
blobFromImagesupportScalarscale to feed the requirement of Standard Deviation value.length == 0.;. The related code part.Related regression test model.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.