endoscopy-specular 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- endoscopy_specular-0.1.0/LICENSE +0 -0
- endoscopy_specular-0.1.0/PKG-INFO +31 -0
- endoscopy_specular-0.1.0/README.md +18 -0
- endoscopy_specular-0.1.0/pyproject.toml +22 -0
- endoscopy_specular-0.1.0/setup.cfg +4 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular/__init__.py +2 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular/core.py +22 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular/utils.py +0 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular.egg-info/PKG-INFO +31 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular.egg-info/SOURCES.txt +12 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular.egg-info/dependency_links.txt +1 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular.egg-info/requires.txt +2 -0
- endoscopy_specular-0.1.0/src/endoscopy_specular.egg-info/top_level.txt +1 -0
- endoscopy_specular-0.1.0/test/test_core.py +12 -0
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: endoscopy_specular
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Hessian-based specular reflection detection in endoscopy images
|
|
5
|
+
Author: Khaled ELKarazle
|
|
6
|
+
Project-URL: Homepage, https://github.com/KhaledELKarazle97/endoscopy-specular
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: opencv-python
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
This is a re-implementation of a Hessian-guided
|
|
17
|
+
specular reflection detection method in HSV color space, originally
|
|
18
|
+
described in IEEE JBHI (2024).
|
|
19
|
+
|
|
20
|
+
## Method
|
|
21
|
+
|
|
22
|
+
- HSV conversion
|
|
23
|
+
- S-channel smoothing
|
|
24
|
+
- Hessian eigenvalue analysis
|
|
25
|
+
- Photometric constraints (S, V thresholds)
|
|
26
|
+
- Binary mask output
|
|
27
|
+
|
|
28
|
+
## Reference
|
|
29
|
+
If you use this package, please cite:
|
|
30
|
+
|
|
31
|
+
ElKarazle, K., Raman, V., Chua, C., Then, P. "A Hessian-Based Technique for Specular Reflection Detection and Inpainting in Colonoscopy Images" IEEE Journal of Biomedical and Health Informatics, 2024. DOI: 10.1109/JBHI.2024.3404955
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
This is a re-implementation of a Hessian-guided
|
|
4
|
+
specular reflection detection method in HSV color space, originally
|
|
5
|
+
described in IEEE JBHI (2024).
|
|
6
|
+
|
|
7
|
+
## Method
|
|
8
|
+
|
|
9
|
+
- HSV conversion
|
|
10
|
+
- S-channel smoothing
|
|
11
|
+
- Hessian eigenvalue analysis
|
|
12
|
+
- Photometric constraints (S, V thresholds)
|
|
13
|
+
- Binary mask output
|
|
14
|
+
|
|
15
|
+
## Reference
|
|
16
|
+
If you use this package, please cite:
|
|
17
|
+
|
|
18
|
+
ElKarazle, K., Raman, V., Chua, C., Then, P. "A Hessian-Based Technique for Specular Reflection Detection and Inpainting in Colonoscopy Images" IEEE Journal of Biomedical and Health Informatics, 2024. DOI: 10.1109/JBHI.2024.3404955
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "endoscopy_specular"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Hessian-based specular reflection detection in endoscopy images"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
"numpy",
|
|
14
|
+
"opencv-python"
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
authors = [
|
|
18
|
+
{name = "Khaled ELKarazle"}
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/KhaledELKarazle97/endoscopy-specular"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import numpy as np
|
|
3
|
+
import cv2
|
|
4
|
+
|
|
5
|
+
def detect_specular_reflection(image_bgr: np.ndarray) -> np.ndarray:
|
|
6
|
+
orig_h, orig_w = image_bgr.shape[:2]
|
|
7
|
+
img_resized = cv2.resize(image_bgr, (128, 128))
|
|
8
|
+
img_float = img_resized.astype(np.float32) / 255.0
|
|
9
|
+
img_hsv = cv2.cvtColor(img_float, cv2.COLOR_BGR2HSV)
|
|
10
|
+
_, S, V = img_hsv[..., 0], img_hsv[..., 1], img_hsv[..., 2]
|
|
11
|
+
S_smooth = cv2.GaussianBlur(S, (0, 0), sigmaX=5.0)
|
|
12
|
+
Sxx = cv2.Sobel(S_smooth, cv2.CV_32F, dx=2, dy=0, ksize=5) / 16.0
|
|
13
|
+
Syy = cv2.Sobel(S_smooth, cv2.CV_32F, dx=0, dy=2, ksize=5) / 16.0
|
|
14
|
+
Sxy = cv2.Sobel(S_smooth, cv2.CV_32F, dx=1, dy=1, ksize=5) / 16.0
|
|
15
|
+
trace = Sxx + Syy
|
|
16
|
+
disc = np.sqrt(np.maximum((Sxx - Syy) ** 2 + 4.0 * Sxy ** 2, 0.0))
|
|
17
|
+
lambda1 = (trace + disc) / 2.0
|
|
18
|
+
lambda2 = (trace - disc) / 2.0
|
|
19
|
+
hessian_gate = (lambda1 >= 0) & (lambda2 >= 0)
|
|
20
|
+
base_mask = hessian_gate & (V > 0.35) & (S < 0.25)
|
|
21
|
+
mask_rescaled = (base_mask.astype(np.uint8) * 255)
|
|
22
|
+
return cv2.resize(mask_rescaled, (orig_w, orig_h), interpolation=cv2.INTER_NEAREST)
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: endoscopy_specular
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Hessian-based specular reflection detection in endoscopy images
|
|
5
|
+
Author: Khaled ELKarazle
|
|
6
|
+
Project-URL: Homepage, https://github.com/KhaledELKarazle97/endoscopy-specular
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: opencv-python
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
This is a re-implementation of a Hessian-guided
|
|
17
|
+
specular reflection detection method in HSV color space, originally
|
|
18
|
+
described in IEEE JBHI (2024).
|
|
19
|
+
|
|
20
|
+
## Method
|
|
21
|
+
|
|
22
|
+
- HSV conversion
|
|
23
|
+
- S-channel smoothing
|
|
24
|
+
- Hessian eigenvalue analysis
|
|
25
|
+
- Photometric constraints (S, V thresholds)
|
|
26
|
+
- Binary mask output
|
|
27
|
+
|
|
28
|
+
## Reference
|
|
29
|
+
If you use this package, please cite:
|
|
30
|
+
|
|
31
|
+
ElKarazle, K., Raman, V., Chua, C., Then, P. "A Hessian-Based Technique for Specular Reflection Detection and Inpainting in Colonoscopy Images" IEEE Journal of Biomedical and Health Informatics, 2024. DOI: 10.1109/JBHI.2024.3404955
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/endoscopy_specular/__init__.py
|
|
5
|
+
src/endoscopy_specular/core.py
|
|
6
|
+
src/endoscopy_specular/utils.py
|
|
7
|
+
src/endoscopy_specular.egg-info/PKG-INFO
|
|
8
|
+
src/endoscopy_specular.egg-info/SOURCES.txt
|
|
9
|
+
src/endoscopy_specular.egg-info/dependency_links.txt
|
|
10
|
+
src/endoscopy_specular.egg-info/requires.txt
|
|
11
|
+
src/endoscopy_specular.egg-info/top_level.txt
|
|
12
|
+
test/test_core.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
endoscopy_specular
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import cv2
|
|
3
|
+
from endoscopy_specular import detect_specular_reflection
|
|
4
|
+
|
|
5
|
+
def test_runs_without_crashing():
|
|
6
|
+
img = np.random.randint(0, 255, (256, 256, 3), dtype=np.uint8)
|
|
7
|
+
|
|
8
|
+
mask = detect_specular_reflection(img)
|
|
9
|
+
|
|
10
|
+
assert mask is not None
|
|
11
|
+
assert mask.shape == (256, 256)
|
|
12
|
+
assert mask.dtype == np.uint8
|