Commit 194d87a8 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: appropriateCenterDC AUTO level from the reference buffer render

getCenterAverage() is null in the pose flow, so the auto DC level silently
no-op'd (composite virtual sky stayed at -4511). Derive the level from the
reference buffer render itself - perSensorImagesFromTD(gpuQuad, true)[0]
sky-half median - i.e. the exact data being zeroed, right after
setReferenceGPU uploads it. Failure-safe warnings preserved; explicit
curt.dc_center and adoption/persistence semantics unchanged.

Verify: pose run -> console 'AUTO center DC level', composite virtual sky ~0.
Co-Authored-By: 's avatarClaude Fable 5 <noreply@anthropic.com>
parent 024b3bda
...@@ -449,9 +449,11 @@ public class CuasPoseRT { ...@@ -449,9 +449,11 @@ public class CuasPoseRT {
* TD points and costs float32 mantissa bits; LWIR is ADDITIVE: day/night and seasons * TD points and costs float32 mantissa bits; LWIR is ADDITIVE: day/night and seasons
* shift the level, they do not scale it - the borrowed center reflects its own * shift the level, they do not scale it - the borrowed center reflects its own
* footage vintage). * footage vintage).
* Level: curt.dc_center; 0 = AUTO - median of the top (sky) half of the borrowed * Level: curt.dc_center; 0 = AUTO - median of the top (sky) half of the reference
* center average image, then ADOPTED into curt.dc_center (persisted on the next * buffer render itself (the exact data being zeroed; the borrowed center average
* configuration save - borrowable later, like the photometric calibration). * image is NOT available in the pose flow), then ADOPTED into curt.dc_center
* (persisted on the next configuration save - borrowable later, like the
* photometric calibration).
* Mechanics: the CLT of a UNIFORM image (the DC pattern - identical for every * Mechanics: the CLT of a UNIFORM image (the DC pattern - identical for every
* converted tile) is obtained through the existing back-propagation convert * converted tile) is obtained through the existing back-propagation convert
* (setImageCenter + no_kernels + use_center_image, the CorrectionFPN recipe), then * (setImageCenter + no_kernels + use_center_image, the CorrectionFPN recipe), then
...@@ -468,27 +470,30 @@ public class CuasPoseRT { ...@@ -468,27 +470,30 @@ public class CuasPoseRT {
final int debugLevel) { final int debugLevel) {
final GpuQuad gpuQuad = center_CLT.getGPUQuad(); final GpuQuad gpuQuad = center_CLT.getGPUQuad();
double level = clt_parameters.curt.dc_center; double level = clt_parameters.curt.dc_center;
if (level == 0.0) { // auto: median of the top (sky) half of the borrowed center average if (level == 0.0) { // auto: median of the top (sky) half of the reference buffer render
final ImagePlus imp_avg = center_CLT.getCenterAverage(); // Level from the reference render ITSELF (the exact data being zeroed):
if (imp_avg == null) { // getCenterAverage() is null in the pose flow, which silently no-op'd the
System.out.println("appropriateCenterDC(): no center average image - reference NOT offset"); // appropriation (composite virtual sky stayed at the raw center level).
// The reference CLT was just uploaded by setReferenceGPU. By Claude on 07/05/2026.
final float [] apx = com.elphel.imagej.cuas.CuasMotion.perSensorImagesFromTD(gpuQuad, true)[0];
if (apx == null) {
System.out.println("appropriateCenterDC(): reference render unavailable - reference NOT offset");
return; return;
} }
final float [] apx = (float []) imp_avg.getProcessor().getPixels(); final int width = gpuQuad.getImageWidth(); // valid after the imclt above
final int width = imp_avg.getWidth(); final int top_pix = (gpuQuad.getImageHeight() / 2) * width;
final int top_pix = (imp_avg.getHeight() / 2) * width;
final float [] samples = new float [top_pix]; final float [] samples = new float [top_pix];
int n = 0; int n = 0;
for (int i = 0; i < top_pix; i++) if (!Float.isNaN(apx[i])) samples[n++] = apx[i]; for (int i = 0; i < top_pix; i++) if (!Float.isNaN(apx[i])) samples[n++] = apx[i];
if (n == 0) { if (n == 0) {
System.out.println("appropriateCenterDC(): center average all-NaN in the sky half - reference NOT offset"); System.out.println("appropriateCenterDC(): reference render all-NaN in the sky half - reference NOT offset");
return; return;
} }
Arrays.sort(samples, 0, n); Arrays.sort(samples, 0, n);
level = samples[n/2]; level = samples[n/2];
clt_parameters.curt.dc_center = level; // adopt: persisted on the next config save clt_parameters.curt.dc_center = level; // adopt: persisted on the next config save
System.out.println("appropriateCenterDC(): AUTO center DC level = "+level+ System.out.println("appropriateCenterDC(): AUTO center DC level = "+level+
" (median of the sky half of the borrowed center average), adopted into curt.dc_center"); " (median of the sky half of the reference buffer render), adopted into curt.dc_center");
} }
// the DC pattern: CLT of a uniform image through the back-propagation convert // the DC pattern: CLT of a uniform image through the back-propagation convert
final int [] wh = center_CLT.getGeometryCorrection().getSensorWH(); final int [] wh = center_CLT.getGeometryCorrection().getSensorWH();
......
...@@ -31,7 +31,7 @@ public class CuasRtParameters { ...@@ -31,7 +31,7 @@ public class CuasRtParameters {
public boolean rend_test = false; // MINIMAL RT ingest+render test (CuasRender.testRenderSequence, takes precedence over pose test): per scene raw /jp4/ -> conditionSceneToGpu -> virtual-grid render at BORROWED stored pose+ERS rates -> -CUAS-RT-RENDER hyperstack [s00..s15, merged][scenes], comparable to -CUAS-INDIVIDUAL/MERGED-CUAS-DBG. Certify THIS before the pose test. // By Claude on 07/05/2026 public boolean rend_test = false; // MINIMAL RT ingest+render test (CuasRender.testRenderSequence, takes precedence over pose test): per scene raw /jp4/ -> conditionSceneToGpu -> virtual-grid render at BORROWED stored pose+ERS rates -> -CUAS-RT-RENDER hyperstack [s00..s15, merged][scenes], comparable to -CUAS-INDIVIDUAL/MERGED-CUAS-DBG. Certify THIS before the pose test. // By Claude on 07/05/2026
public double fz_inter = 10000.0; // RT fat zero, INTER (pose/motion: scene x virtual-center correlation). DECOUPLED from the legacy gpu_fatz*/AUX switches (which stay untouched for non-RT/FOPEN). Value is for a single physical-pair amplitude; FZ ~ amplitude^2 in the GPU normalize - scale down x4..x16 for consolidated-average applications as needed. 10000 = the proven oracle INTER operating point (the lean code erroneously used the INTRA value before). // By Claude on 07/05/2026 public double fz_inter = 10000.0; // RT fat zero, INTER (pose/motion: scene x virtual-center correlation). DECOUPLED from the legacy gpu_fatz*/AUX switches (which stay untouched for non-RT/FOPEN). Value is for a single physical-pair amplitude; FZ ~ amplitude^2 in the GPU normalize - scale down x4..x16 for consolidated-average applications as needed. 10000 = the proven oracle INTER operating point (the lean code erroneously used the INTRA value before). // By Claude on 07/05/2026
public double fz_intra = 2000.0; // RT fat zero, INTRA (ranging/disparity: sensor-pair correlations within one scene). Reserved for the RT ranging path; same decoupling/scaling notes as fz_inter. // By Claude on 07/05/2026 public double fz_intra = 2000.0; // RT fat zero, INTRA (ranging/disparity: sensor-pair correlations within one scene). Reserved for the RT ranging path; same decoupling/scaling notes as fz_inter. // By Claude on 07/05/2026
public double dc_center = 0.0; // DC level of the BORROWED center (CLT-RESTORED/average): subtracted from the reference CLT at appropriation so it matches the zero-sky conditioned scenes (MCLT has no clean DC/AC split - a DC constant costs float32 accuracy). 0 = AUTO: compute as the median of the top (sky) half of the borrowed center average, adopt the value here (persisted on config save - borrowable later without our data, like the photometric calibration). Slow targets do not influence this shift. // By Claude on 07/05/2026 public double dc_center = 0.0; // DC level of the BORROWED center (CLT-RESTORED/average): subtracted from the reference CLT at appropriation so it matches the zero-sky conditioned scenes (MCLT has no clean DC/AC split - a DC constant costs float32 accuracy). 0 = AUTO: compute as the median of the top (sky) half of the reference buffer render (the borrowed center as uploaded), adopt the value here (persisted on config save - borrowable later without our data, like the photometric calibration). Slow targets do not influence this shift. // By Claude on 07/05/2026
public double psf_radius = 1.0; // sensor PSF radius for LoG pre-filter public double psf_radius = 1.0; // sensor PSF radius for LoG pre-filter
public double n_sigma = 4.0; // cutoff LoG kernel array, number of sigmas public double n_sigma = 4.0; // cutoff LoG kernel array, number of sigmas
public int pyramid = 7; // temporal pyramid levels public int pyramid = 7; // temporal pyramid levels
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment