Possible typo in ERFilterNM::er_tree_extract() (Bug #3633)
Description
.\modules\objdetect\src\erfilter.cpp 260
unsigned char quads[3][4]; quads[0][0] = 1 << 3; quads[0][1] = 1 << 2; quads[0][2] = 1 << 1; quads[0][3] = 1; quads[1][0] = (1<<2)|(1<<1)|(1); quads[1][1] = (1<<3)|(1<<1)|(1); quads[1][2] = (1<<3)|(1<<2)|(1); quads[1][3] = (1<<3)|(1<<2)|(1<<1); quads[2][0] = (1<<2)|(1<<1); quads[2][1] = (1<<3)|(1); quads[2][3] = 255; // <=== quads[2][2] lack
Associated revisions
Merge pull request #3633 from mshabunin:fix-gdal-warning
History
Updated by Alexander Smorkalov almost 11 years ago
- Description changed from .\modules\objdetect\src\erfilter.cpp 260 unsigned char quads[3][4]; quads[0]... to .\modules\objdetect\src\erfilter.cpp 260 <pre> unsigned char quads[3][... More
Updated by Alexander Smorkalov almost 11 years ago
OpenCV is open source project and you can help to make it better. The best way to help is to make pull request via Github. Follow by the instructions on how to contribute page.
Updated by Andrew Senin almost 11 years ago
- Assignee set to Maks Naumov
- Difficulty set to Easy
Updated by Yash Vadalia almost 11 years ago
https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/erfilter.cpp
quads[][] is used only between lines 455 and 470. The condition ((p<2)||(q<2)) means that it does not matter what value is stored in quads [2][2] and quads [2][3]. Hence, the missing quads [2][2] initialization should not make any difference. I think we could probably do away with "quads [2][3] = 255;" too.
Updated by Dmitry Retinskiy almost 11 years ago
Hi Yash,
thanks for the analysis, if you want to do this fix you could re-assign the issue to yourself.
Updated by Vadim Pisarevsky almost 10 years ago
- Category changed from objdetect to contrib/text
Updated by Lluis Gomez almost 10 years ago
Hi,
Yash Vadalia is right. quads2[2] and quads2[3] are never used.
The four lowest bits in each quads[i][j] correspond to the 2x2 binary patterns Q_1, Q_2, Q_3 in the NM paper [1] (see in page 4 at the end of first column). Q_1 and Q_2 have four patterns, while Q_3 has only two.
I've made a PR which do away with "quads [2][3] = 255;" too. and adds a comment explaining why they are left uninitialized:
https://github.com/Itseez/opencv_contrib/pull/253
[1] Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012.
- Status changed from New to Done