瀏覽代碼

- area deleting now works
- areas without color won't cause crash

gapchich 13 年之前
父節點
當前提交
2e23610b83
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 4 1
      ImageHolder.cpp
  2. 1 1
      functions.cpp

+ 4 - 1
ImageHolder.cpp

@@ -92,7 +92,10 @@ ImageHolder::drawBoundingBoxes(
 	for (int i = 0; i < list_bounding_box_->size(); i++) {
 	for (int i = 0; i < list_bounding_box_->size(); i++) {
 		int labelID = list_bounding_box_->at(i).label_ID_;
 		int labelID = list_bounding_box_->at(i).label_ID_;
 
 
-		aPen->setColor(QColor(list_label_color_->at(labelID)));
+		if (labelID < list_label_color_->count())
+			aPen->setColor(QColor(list_label_color_->at(labelID)));
+		else
+			aPen->setColor(QColor(Qt::white));
 
 
 		/* checking whether labeled area is of main object or not */
 		/* checking whether labeled area is of main object or not */
 		if (labelID == *main_label_)
 		if (labelID == *main_label_)

+ 1 - 1
functions.cpp

@@ -24,7 +24,7 @@ getNumFromString(
 {
 {
 	int numPos = aString->indexOf(aFirstStr) + aFirstStr.size();
 	int numPos = aString->indexOf(aFirstStr) + aFirstStr.size();
 
 
-	if (-1 <= numPos) {
+	if (numPos < 0) {
 		*anOkFlag = 0;
 		*anOkFlag = 0;
 		return -1;
 		return -1;
 		/* NOTREACHED */
 		/* NOTREACHED */