From 0737bdd85a355448066305eb66bd60cc2e7265d3 Mon Sep 17 00:00:00 2001 From: Adrian Sieber Date: Thu, 8 Oct 2015 20:50:59 +0200 Subject: [PATCH] Use "else if" to clarify mutual exclusivity --- src/Matrix.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Matrix.cc b/src/Matrix.cc index fb6a145..dd53681 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -1632,24 +1632,24 @@ NAN_METHOD(Matrix::Threshold) { double threshold = info[0]->NumberValue(); double maxVal = info[1]->NumberValue(); - int typ = cv::THRESH_BINARY; + if (info.Length() == 3) { - // typ = info[2]->IntegerValue(); Nan::Utf8String typstr(info[2]); + if (strcmp(*typstr, "Binary") == 0) { typ = 0; } - if (strcmp(*typstr, "Binary Inverted") == 0) { + else if (strcmp(*typstr, "Binary Inverted") == 0) { typ = 1; } - if (strcmp(*typstr, "Threshold Truncated") == 0) { + else if (strcmp(*typstr, "Threshold Truncated") == 0) { typ = 2; } - if (strcmp(*typstr, "Threshold to Zero") == 0) { + else if (strcmp(*typstr, "Threshold to Zero") == 0) { typ = 3; } - if (strcmp(*typstr, "Threshold to Zero Inverted") == 0) { + else if (strcmp(*typstr, "Threshold to Zero Inverted") == 0) { typ = 4; } }