From 500e24d6cdaeca6a165ccb62e9be032970b29988 Mon Sep 17 00:00:00 2001 From: Giles Payne Date: Sun, 31 Jul 2022 21:04:14 +0900 Subject: [PATCH] Fix bug ObjC/Swift Quicklook function; check only one channel when drawing Mat as matrix --- modules/imgcodecs/misc/objc/ios/Mat+QuickLook.mm | 2 +- modules/imgcodecs/misc/objc/macosx/Mat+QuickLook.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/imgcodecs/misc/objc/ios/Mat+QuickLook.mm b/modules/imgcodecs/misc/objc/ios/Mat+QuickLook.mm index 84cf25879b..f68a9e154e 100644 --- a/modules/imgcodecs/misc/objc/ios/Mat+QuickLook.mm +++ b/modules/imgcodecs/misc/objc/ios/Mat+QuickLook.mm @@ -62,7 +62,7 @@ typedef UIFont* (*FontGetter)(); } - (id)debugQuickLookObject { - if ([self dims] == 2 && [self rows] <= 10 && [self cols] <= 10) { + if ([self dims] == 2 && [self rows] <= 10 && [self cols] <= 10 && [self channels] == 1) { FontGetter fontGetters[] = { getCMU, getBodoni72, getAnySerif, getSystemFont }; UIFont* font = nil; for (int fontGetterIndex = 0; font==nil && fontGetterIndex < (sizeof(fontGetters)) / (sizeof(fontGetters[0])); fontGetterIndex++) { diff --git a/modules/imgcodecs/misc/objc/macosx/Mat+QuickLook.mm b/modules/imgcodecs/misc/objc/macosx/Mat+QuickLook.mm index bdc5eda811..21854d67d9 100644 --- a/modules/imgcodecs/misc/objc/macosx/Mat+QuickLook.mm +++ b/modules/imgcodecs/misc/objc/macosx/Mat+QuickLook.mm @@ -58,7 +58,7 @@ typedef NSFont* (*FontGetter)(); - (id)debugQuickLookObject { // for smallish Mat objects display as a matrix - if ([self dims] == 2 && [self rows] <= 10 && [self cols] <= 10) { + if ([self dims] == 2 && [self rows] <= 10 && [self cols] <= 10 && [self channels] == 1) { FontGetter fontGetters[] = { getCMU, getBodoni72, getAnySerif, getSystemFont }; NSFont* font = nil; for (int fontGetterIndex = 0; font==nil && fontGetterIndex < (sizeof(fontGetters)) / (sizeof(fontGetters[0])); fontGetterIndex++) {