[libcamera-devel,2/3] utils: raspberrypi: ctt: Fix usage of findHomography function
diff mbox series

Message ID 20210721115220.5090-3-david.plowman@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi: support imx378 sensor
Related show

Commit Message

David Plowman July 21, 2021, 11:52 a.m. UTC
The OpenCV findHomography function now raises an unhandled error if it
receives fewer than 4 points whereas previously the limit was 3. This
makes no material difference to the behaviour of the tuning tool as it
will continue to search for the Macbeth chart at different scales.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 utils/raspberrypi/ctt/ctt_macbeth_locator.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Naushir Patuck July 21, 2021, 1:10 p.m. UTC | #1
Hi David,

On Wed, 21 Jul 2021 at 12:52, David Plowman <david.plowman@raspberrypi.com>
wrote:

> The OpenCV findHomography function now raises an unhandled error if it
> receives fewer than 4 points whereas previously the limit was 3. This
> makes no material difference to the behaviour of the tuning tool as it
> will continue to search for the Macbeth chart at different scales.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
>

I wonder if we could perhaps do a OpenCV version check on startup to
catch things like this in the future?  But that's not related to this fix...

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>


> ---
>  utils/raspberrypi/ctt/ctt_macbeth_locator.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> index 35c84807..cae1d334 100644
> --- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> +++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> @@ -597,10 +597,10 @@ def get_macbeth_chart(img, ref_data):
>                      ref_cents.append(ref_cent)
>
>                      """
> -                    At least three squares need to have voted for a
> centre in
> +                    At least four squares need to have voted for a centre
> in
>                      order for a transform to be found
>                      """
> -            if len(sq_cents) < 3:
> +            if len(sq_cents) < 4:
>                  raise MacbethError(
>                      '\nWARNING: No macbeth chart found!'
>                      '\nNot enough squares found'
> --
> 2.20.1
>
>
Kieran Bingham July 26, 2021, 10:33 a.m. UTC | #2
Hi David,

On 21/07/2021 12:52, David Plowman wrote:
> The OpenCV findHomography function now raises an unhandled error if it
> receives fewer than 4 points whereas previously the limit was 3. This
> makes no material difference to the behaviour of the tuning tool as it
> will continue to search for the Macbeth chart at different scales.

Sounds reasonable to me.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  utils/raspberrypi/ctt/ctt_macbeth_locator.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> index 35c84807..cae1d334 100644
> --- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> +++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> @@ -597,10 +597,10 @@ def get_macbeth_chart(img, ref_data):
>                      ref_cents.append(ref_cent)
>  
>                      """
> -                    At least three squares need to have voted for a centre in
> +                    At least four squares need to have voted for a centre in
>                      order for a transform to be found
>                      """
> -            if len(sq_cents) < 3:
> +            if len(sq_cents) < 4:
>                  raise MacbethError(
>                      '\nWARNING: No macbeth chart found!'
>                      '\nNot enough squares found'
>
Laurent Pinchart Aug. 2, 2021, 12:40 a.m. UTC | #3
Hello,

On Wed, Jul 21, 2021 at 02:10:02PM +0100, Naushir Patuck wrote:
> On Wed, 21 Jul 2021 at 12:52, David Plowman wrote:
> 
> > The OpenCV findHomography function now raises an unhandled error if it
> > receives fewer than 4 points whereas previously the limit was 3. This
> > makes no material difference to the behaviour of the tuning tool as it
> > will continue to search for the Macbeth chart at different scales.
> >
> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> 
> I wonder if we could perhaps do a OpenCV version check on startup to
> catch things like this in the future?  But that's not related to this fix...
> 
> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>

Given that this change remains backward-compatible with older OpenCV
version, it doesn't depend on a new minimum version, so

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> > ---
> >  utils/raspberrypi/ctt/ctt_macbeth_locator.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> > b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> > index 35c84807..cae1d334 100644
> > --- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> > +++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
> > @@ -597,10 +597,10 @@ def get_macbeth_chart(img, ref_data):
> >                      ref_cents.append(ref_cent)
> >
> >                      """
> > -                    At least three squares need to have voted for a centre in
> > +                    At least four squares need to have voted for a centre in
> >                      order for a transform to be found
> >                      """
> > -            if len(sq_cents) < 3:
> > +            if len(sq_cents) < 4:
> >                  raise MacbethError(
> >                      '\nWARNING: No macbeth chart found!'
> >                      '\nNot enough squares found'

Patch
diff mbox series

diff --git a/utils/raspberrypi/ctt/ctt_macbeth_locator.py b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
index 35c84807..cae1d334 100644
--- a/utils/raspberrypi/ctt/ctt_macbeth_locator.py
+++ b/utils/raspberrypi/ctt/ctt_macbeth_locator.py
@@ -597,10 +597,10 @@  def get_macbeth_chart(img, ref_data):
                     ref_cents.append(ref_cent)
 
                     """
-                    At least three squares need to have voted for a centre in
+                    At least four squares need to have voted for a centre in
                     order for a transform to be found
                     """
-            if len(sq_cents) < 3:
+            if len(sq_cents) < 4:
                 raise MacbethError(
                     '\nWARNING: No macbeth chart found!'
                     '\nNot enough squares found'