Skip to content

QR-Code detector : multiple detection#15338

Merged
alalek merged 61 commits intoopencv:3.4from
rayonnant14:my_detect_and_decode_3.4
Jan 26, 2020
Merged

QR-Code detector : multiple detection#15338
alalek merged 61 commits intoopencv:3.4from
rayonnant14:my_detect_and_decode_3.4

Conversation

@rayonnant14
Copy link
Copy Markdown
Contributor

@rayonnant14 rayonnant14 commented Aug 19, 2019

Merge with extra: opencv/opencv_extra#684

@rayonnant14 rayonnant14 changed the title My detect and decode 3.4 QR-Code detector : multiple detection Aug 19, 2019
@asmorkalov
Copy link
Copy Markdown
Contributor

@rayonnant14, @allnes What is the PR status? Is it still WIP?

@allnes
Copy link
Copy Markdown
Member

allnes commented Oct 24, 2019

@rayonnant14, @allnes What is the PR status? Is it still WIP?

Yes, this PR in progress.

@rayonnant14 rayonnant14 requested a review from alalek January 14, 2020 13:24
@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 15, 2020

Again, drawing functions should be avoided.

checkPointsInsideQuadrangle() and checkPointsInsideTriangle() should not "draw" anything.
Take a look on pointPolygonTest() function.

The similar note is about checkPoints(). Intensity check can be related for "bounding rectangle".

another one fillConvexPoly() call in findQRCodeContours().

need to revise code using of floodFill() / LineIterator() functionality.

@param img grayscale or color (BGR) image containing (or not) QR codes.
@param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes.
*/
CV_WRAP bool detectMulti(InputArray img, OutputArrayOfArrays points) const;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OutputArrayOfArrays
InputArrayOfArrays
std::vector< std::vector< Point > > corners;

Please avoid using of *OfArrays types and/or nested std::vector.
This is unnecessary for fixed size elements (4 points per QR code).

Lets store points as one "array" (without nesting):

  • std::vector< Point > where each 4 points define QR code instance (<0, 1, 2, 3>, <4, 5, 6 ,7> ...).
  • Mat - CV_32FC2 with one or multiple rows.
    and pass them as OutputArray.

This is continued discussion from this comment: #15338 (comment)

break;
}
if (!out_origin_file.empty())
imwrite(out_origin_file, frame); // write original frame
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saving each frame slowdowns demo significantly. Image I/O is not optimized (because it is for debug purposes here).

Original and processed frames should be saved by pressing key only (it was space ' '). Both at once.

class qrcode_detector_test(NewOpenCVTests):
def test_detect_and_decode(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
self.assertFalse(img == None)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== None

In Python world checks should look like:

  • a is None
  • a is not None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alalek Which way is better img is None or np.shape(img) is () ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants