Fahimeh Orvati Nia
commited on
Commit
·
970a1c0
1
Parent(s):
981de0a
increase resolution for texture
Browse files
sorghum_pipeline/pipeline.py
CHANGED
|
@@ -268,16 +268,16 @@ class SorghumPipeline:
|
|
| 268 |
pdata['texture_features'] = {}
|
| 269 |
spectral = pdata.get('spectral_stack', {})
|
| 270 |
|
| 271 |
-
#
|
| 272 |
if 'green' in spectral:
|
| 273 |
green_band = np.asarray(spectral['green'], dtype=np.float64)
|
| 274 |
if green_band.ndim == 3 and green_band.shape[-1] == 1:
|
| 275 |
green_band = green_band[..., 0]
|
| 276 |
|
| 277 |
-
# Downsample to
|
| 278 |
h, w = green_band.shape[:2]
|
| 279 |
-
if h >
|
| 280 |
-
scale =
|
| 281 |
green_band = cv2.resize(green_band, None, fx=scale, fy=scale, interpolation=cv2.INTER_LINEAR)
|
| 282 |
if mask is not None:
|
| 283 |
mask_resized = cv2.resize(mask, (green_band.shape[1], green_band.shape[0]), interpolation=cv2.INTER_NEAREST)
|
|
|
|
| 268 |
pdata['texture_features'] = {}
|
| 269 |
spectral = pdata.get('spectral_stack', {})
|
| 270 |
|
| 271 |
+
# Compute texture on green band with good quality (256x256)
|
| 272 |
if 'green' in spectral:
|
| 273 |
green_band = np.asarray(spectral['green'], dtype=np.float64)
|
| 274 |
if green_band.ndim == 3 and green_band.shape[-1] == 1:
|
| 275 |
green_band = green_band[..., 0]
|
| 276 |
|
| 277 |
+
# Downsample to 256x256 for good texture quality
|
| 278 |
h, w = green_band.shape[:2]
|
| 279 |
+
if h > 256 or w > 256:
|
| 280 |
+
scale = 256 / max(h, w)
|
| 281 |
green_band = cv2.resize(green_band, None, fx=scale, fy=scale, interpolation=cv2.INTER_LINEAR)
|
| 282 |
if mask is not None:
|
| 283 |
mask_resized = cv2.resize(mask, (green_band.shape[1], green_band.shape[0]), interpolation=cv2.INTER_NEAREST)
|