Skip to content

Commit 3f3f515

Browse files
committed
Fix mode selection logic
1 parent 4a59dae commit 3f3f515

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cpp/models/src/segmentation_model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ std::vector<Contour> SegmentationModel::getContours(const ImageResultWithSoftPre
292292
std::vector<Contour> combined_contours = {};
293293
cv::Mat label_index_map;
294294
cv::Mat current_label_soft_prediction;
295-
int find_contours_mode = include_nested_contours ? cv::RETR_EXTERNAL : cv::RETR_CCOMP;
295+
int find_contours_mode = include_nested_contours ? cv::RETR_CCOMP : cv::RETR_EXTERNAL;
296296
for (int index = 1; index < imageResult.soft_prediction.channels(); index++) {
297297
cv::extractChannel(imageResult.soft_prediction, current_label_soft_prediction, index);
298298
cv::inRange(imageResult.resultImage,

src/python/model_api/models/segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def get_contours(
203203
msg = "Cannot get contours from soft prediction with 1 layer"
204204
raise RuntimeError(msg)
205205

206-
find_contours_mode = cv2.RETR_CCOMP if not include_nested_contours else cv2.RETR_EXTERNAL
206+
find_contours_mode = cv2.RETR_CCOMP if include_nested_contours else cv2.RETR_EXTERNAL
207207
combined_contours = []
208208
for layer_index in range(1, n_layers): # ignoring background
209209
label = self.get_label_name(layer_index - 1)

0 commit comments

Comments
 (0)