From dcf7d2e64e64d1ac513534c19951ee049974026b Mon Sep 17 00:00:00 2001 From: Kelvin Ly Date: Fri, 21 Oct 2016 01:39:44 -0400 Subject: [PATCH 1/3] Require nThreads to be a sane value --- library/ComponentLabeling.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/ComponentLabeling.cpp b/library/ComponentLabeling.cpp index 5495693..020cde4 100644 --- a/library/ComponentLabeling.cpp +++ b/library/ComponentLabeling.cpp @@ -454,6 +454,9 @@ myCompLabelerGroup::~myCompLabelerGroup() void myCompLabelerGroup::set( int nThreads, Mat binIm ) { + if (nThreads <= 0) { + nThreads = 1; + } this->numThreads=nThreads; if(binIm.isContinuous()){ this->img=binIm; From 8015055f0a9eee86a8f4e423baf7c2ab672efcf7 Mon Sep 17 00:00:00 2001 From: Kelvin Ly Date: Fri, 21 Oct 2016 08:35:18 -0400 Subject: [PATCH 2/3] Require nThreads to be positive --- library/ComponentLabeling.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/library/ComponentLabeling.cpp b/library/ComponentLabeling.cpp index 020cde4..18fd7eb 100644 --- a/library/ComponentLabeling.cpp +++ b/library/ComponentLabeling.cpp @@ -454,9 +454,7 @@ myCompLabelerGroup::~myCompLabelerGroup() void myCompLabelerGroup::set( int nThreads, Mat binIm ) { - if (nThreads <= 0) { - nThreads = 1; - } + CV_Assert(nThreads > 0); this->numThreads=nThreads; if(binIm.isContinuous()){ this->img=binIm; From 834691c5bce7b0b7c824315d352a89ca8aaf0236 Mon Sep 17 00:00:00 2001 From: Kelvin Ly Date: Fri, 21 Oct 2016 08:37:45 -0400 Subject: [PATCH 3/3] Style fix --- library/ComponentLabeling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ComponentLabeling.cpp b/library/ComponentLabeling.cpp index 18fd7eb..e83682a 100644 --- a/library/ComponentLabeling.cpp +++ b/library/ComponentLabeling.cpp @@ -454,7 +454,7 @@ myCompLabelerGroup::~myCompLabelerGroup() void myCompLabelerGroup::set( int nThreads, Mat binIm ) { - CV_Assert(nThreads > 0); + CV_Assert(nThreads > 0); this->numThreads=nThreads; if(binIm.isContinuous()){ this->img=binIm;