# Cross-Section Measurement & Distortion Analysis of Multi-Filament Fibers using OpenCV / OpenCvSharp

**URL:** <https://forum.opencv.org/t/cross-section-measurement-distortion-analysis-of-multi-filament-fibers-using-opencv-opencvsharp/24685>\
**Category:** Python\
**Created:** [August 13, 2026, 9:00pm UTC](https://forum.opencv.org/t/cross-section-measurement-distortion-analysis-of-multi-filament-fibers-using-opencv-opencvsharp/24685 "2026-08-13T21:00:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hasan\_Bas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/hasan_bas/32/14409_2.png) [@Hasan\_Bas](https://forum.opencv.org/u/Hasan_Bas)\
**Post date:** [August 13, 2026, 9:00pm UTC](https://forum.opencv.org/t/cross-section-measurement-distortion-analysis-of-multi-filament-fibers-using-opencv-opencvsharp/24685/1 "2026-08-13T21:00:38Z")

</div>

Hi OpenCV Community,

I am developing an industrial desktop application (.NET 8 C# with **OpenCvSharp4** ) for analyzing cross-sectional microscope images of multi-filament synthetic fibers (e.g., Spandex/Elastane).

The goal of the project is twofold:

1. **Filament Counting & Segmentation:** Detect, count, and mark each filament centroid in a fiber pack.

2. **Quality & Distortion Metrics (Y-BOT / Laboratory Standard Alignment):** Measure individual filament geometry and cross-sectional error across multiple filaments.

I would like to share my current approach, mathematical model, and ask for advice on improving the segmentation accuracy when filaments are tightly packed or partially touching.

### **1. Mathematical Model & Geometry Pipeline**

For each detected filament contour in a cross-section image, we extract two core quality metrics:

#### **A. Distorted ROI (Circularity / Deformation)**

Instead of relying solely on standard circularity (4\pi \cdot \text{Area} / \text{Perimeter}^2), we measure width chords along the filament’s principal axis:

- **Long Axis (C):** The length of the bounding rotated rectangle (`Cv2.MinAreaRect`).

- **Short Axis Chords:**

- **Average Diameter:** D\_{\text{avg}} = \frac{\frac{w\_{25} + w\_{75}}{2} + w\_{50}}{2}

- **Distortion Ratio Formula:**

#### **B. C-Section ROI (Cross-Section Area Ratio / Multi-Filament Error)**

For a group of N filaments in a cross-section:

1. Calculate the pixel area A\_i for each filament contour (i = 1 \dots N).

2. Compute the ratio between the smallest and largest filament area:

### **2. Current OpenCV Pipeline**

Our current image processing workflow (`OpenCvSharp4`) consists of:

1. **Preprocessing:** Downscale to max 1600px \rightarrow Grayscale \rightarrow CLAHE \rightarrow Small Gaussian Blur.

2. **Binarization:** Pack-region restricted Adaptive Thresholding (Mean/Gaussian) combined with an Otsu intensity gate.

3. **Morphology:** Small 3\times 3 opening followed by max 5\times 5 closing to fill internal voids without merging adjacent filaments.

4. **Distance Transform & Watershed Segmentation:**

5. **Contour Analysis:** Extract contours, fit `MinAreaRect`, compute axis chords (25\%, 50\%, 75\%), and validate candidates using aspect ratio, circularity, and solidity thresholds.

### **3. Challenges & Questions for the Community**

1. **Over-segmentation / Double-Seed Issue in Watershed:**

2. **Accurate Axis Chord Measurement (%25, %50, %75):**

3. **Handling Touching Filament Boundaries:**

Any insights, code snippets, or suggested OpenCV functions would be greatly appreciated!

Thanks in advance,

**Hasan Baş**
