findContours() with detailed images
Hi all,
I am implementing a custom barcode code reader (to read custom codes that look like a QR-code) with openCV on Android. At some point, I am using findContours() with tree hierarchy.
My problem is, that if the image contains a lot of details (like what it does when pointing the camera out of the window), findContours() takes quite a bit of time, because it finds up to 3000+ contours... This eats a lot of battery, while the image does not contain any QR-code...
I have already applied various pre-processing steps (gaussian, morph opening etc.) but the details are big enough to still produce the large number of contours.
I have no idea, how to deal with such a situation... The only way I can think of would be to tell findContours() the maximum number of contours that make sense - and have it return as soon as it reaches the limit...
Does anybody know how to deal with such a situation, when you have no control over the content of the image? Would it be possible to add such an additional parameter to the findContours() function?
- Tom
we already have a qr detector / decoder
Thanks I have seen that. The problem is, that the QR code I have to read is slightly different (conceptually) but similar... it does not have a name (used internally only) thus I am calling it a QR code for the moment... sorry for the confusion.
I edited to question to clarify that I cannot use the existing QR code decoder.
could you provide a sample image of your QR code
sorry I am not allowed to publicly share it. The problem is not so much about the code itself but about the use of findContours(), if the image contains a lot of contours - it is basically an optimization problem to reduce battery consumption... (if findContours() takes a lot of time)
findContours() is basically used to find circles in the image... (the custom code differs in that regard to a classical QR code)