Commit 35fd4536 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

CLAUDE: renderNadirSequence(): add -NADIR-SCENE-PXPYD-NULLCAM debug dump



Second per-scene grid computed with scene_QuadClt=null - the exact camera
model used inside Cuas.transformFromVirtual()'s refinement loop. Its
non-uniformity isolates the refinement residual; its difference from
-NADIR-SCENE-PXPYD isolates the scene-ERS-instance effect. Saved only on
the first (non-undistorted) pass.

Context: 2026-07-10 analysis of the first -NADIR-SCENE-PXPYD dump showed
the sampling grid contains rotation ~0.31x scene roll (R2=0.77) plus
correlated scale (~0.955) and shift_y (to -24 px) concentrated in the
high-roll-rate half of the graveyard segment - explaining the ~0.6x
in-plane content rotation and COLMAP's f=1000/k1=-0.38 self-calibration.

Co-authored-by: default avatarClaude <claude@elphel.com>
parent 8157473b
Loading
Loading
Loading
Loading
+30 −0
Original line number Original line Diff line number Diff line
@@ -10955,6 +10955,12 @@ java.lang.NullPointerException
    	// Debug: collect the actual per-scene sampling grids fed to renderGPUFromDSI
    	// Debug: collect the actual per-scene sampling grids fed to renderGPUFromDSI
    	// (scene-frame pXpYD after transformToScenePxPyD and optional undistort).
    	// (scene-frame pXpYD after transformToScenePxPyD and optional undistort).
    	double[][][] dbg_scene_pXpYD = new double[selected_scenes.length][][];
    	double[][][] dbg_scene_pXpYD = new double[selected_scenes.length][][];
    	// Debug: same transform but with scene_QuadClt=null - the exact camera model
    	// used inside Cuas.transformFromVirtual()'s refinement loop.  Non-uniformity
    	// of this grid = pure refinement residual; difference from dbg_scene_pXpYD =
    	// pure effect of the scene's own ERS instance. Saved only on the first
    	// (non-undistorted) pass.
    	double[][][] dbg_nullcam_pXpYD = undistort ? null : new double[selected_scenes.length][][];
    	ImageStack stack_scenes = null;
    	ImageStack stack_scenes = null;
    	for (int nscene = 0; nscene < selected_scenes.length; nscene++) {
    	for (int nscene = 0; nscene < selected_scenes.length; nscene++) {
    		if (nadir_pXpYD[nscene] == null) continue;
    		if (nadir_pXpYD[nscene] == null) continue;
@@ -10985,6 +10991,14 @@ java.lang.NullPointerException
    			undistortPxPy(pXpYD_scene, selected_scenes[nscene].getErsCorrection());
    			undistortPxPy(pXpYD_scene, selected_scenes[nscene].getErsCorrection());
    		}
    		}
    		dbg_scene_pXpYD[nscene] = pXpYD_scene;
    		dbg_scene_pXpYD[nscene] = pXpYD_scene;
    		if (dbg_nullcam_pXpYD != null) {
    			dbg_nullcam_pXpYD[nscene] = transformToScenePxPyD(
    					nadir_pXpYD[nscene], // final double [][] reference_pXpYD,
    					scene_xyz,           // final double []   scene_xyz,
    					scene_atr,           // final double []   scene_atr,
    					ref_scene,           // final QuadCLT     reference_QuadClt,
    					null);               // final QuadCLT     scene_QuadClt (as in transformFromVirtual refinement)
    		}
    		// Render from scene's own position: ZERO3 offset, scene is its own reference
    		// Render from scene's own position: ZERO3 offset, scene is its own reference
    		ImagePlus imp_scene = QuadCLT.renderGPUFromDSI(
    		ImagePlus imp_scene = QuadCLT.renderGPUFromDSI(
    				-1,                               // final int       sensor_mask (-1 = merge all)
    				-1,                               // final int       sensor_mask (-1 = merge all)
@@ -11041,6 +11055,22 @@ java.lang.NullPointerException
    					null,             // String    suffix,
    					null,             // String    suffix,
    					imp_scene_pxpyd); // ImagePlus imp
    					imp_scene_pxpyd); // ImagePlus imp
    		}
    		}
    		if (dbg_nullcam_pXpYD != null) {
    			double [][][] nullcam_maps = ShowDoubleFloatArrays.transposeJagged(
    					dbg_nullcam_pXpYD, 3, tilesX * tilesY);
    			ImagePlus imp_nullcam = ShowDoubleFloatArrays.showArraysHyperstack(
    					nullcam_maps,                                    // double [][][]  pixels,
    					tilesX,                                          // int            width,
    					ref_scene.getImageName() + "-NADIR-SCENE-PXPYD-NULLCAM", // String title,
    					slice_titles,                                    // String []      titles,
    					frame_titles,                                    // String []      frame_titles,
    					false);                                          // boolean        show
    			if (imp_nullcam != null) {
    				ref_scene.saveImagePlusInModelDirectory(
    						null,          // String    suffix,
    						imp_nullcam);  // ImagePlus imp
    			}
    		}
    	}
    	}
    	if (stack_scenes == null) return null;
    	if (stack_scenes == null) return null;
    	ImagePlus imp_result = new ImagePlus(suffix, stack_scenes);
    	ImagePlus imp_result = new ImagePlus(suffix, stack_scenes);