Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/basic_shape_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def extract_style_colors(image: np.ndarray, bbox: list) -> tuple:
counts = np.bincount(labels.flatten())
dominant_idx = np.argmax(counts)
fill_rgb = centers[dominant_idx].astype(int)
except:
except Exception:
pass # 保持中位数结果

# --- 2. 提取描边色 (Stroke Color) ---
Expand Down Expand Up @@ -540,7 +540,7 @@ def extract_color_with_mask(image: np.ndarray, bbox: list, mask: np.ndarray,
counts = np.bincount(labels.flatten())
dominant_idx = np.argmax(counts)
fill_rgb = centers[dominant_idx].astype(int)
except:
except Exception:
fill_rgb = np.median(fill_pixels, axis=0).astype(int)
else:
fill_rgb = np.median(fill_pixels, axis=0).astype(int)
Expand Down Expand Up @@ -1311,7 +1311,7 @@ def detect_rectangles_robust(cv2_image: np.ndarray, existing_elements: dict, con
counts = np.bincount(labels.flatten())
dominant_idx = np.argmax(counts)
fill_rgb = centers[dominant_idx].astype(int)
except:
except Exception:
fill_rgb = np.median(pixels, axis=0).astype(int)
else:
fill_rgb = np.median(pixels, axis=0).astype(int) if len(pixels) > 0 else np.array([255, 255, 255])
Expand Down
2 changes: 1 addition & 1 deletion modules/xml_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def merge_with_text_xml(self,
x2=int(float(geom.get("x", 0))) + int(float(geom.get("width", 0))),
y2=int(float(geom.get("y", 0))) + int(float(geom.get("height", 0)))
)
except:
except Exception:
pass

fragments.append(XMLFragment(
Expand Down