Fahimeh Orvati Nia commited on
Commit
970a1c0
·
1 Parent(s): 981de0a

increase resolution for texture

Browse files
Files changed (1) hide show
  1. sorghum_pipeline/pipeline.py +4 -4
sorghum_pipeline/pipeline.py CHANGED
@@ -268,16 +268,16 @@ class SorghumPipeline:
268
  pdata['texture_features'] = {}
269
  spectral = pdata.get('spectral_stack', {})
270
 
271
- # Only compute essential texture on very downsampled green band for speed
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 64x64 max for very fast texture computation
278
  h, w = green_band.shape[:2]
279
- if h > 64 or w > 64:
280
- scale = 64 / 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)
 
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)