Commit 8157473b authored by Andrey Filippov's avatar Andrey Filippov
Browse files

CLAUDE: renderNadirSequence(): dump per-scene sampling grids as -NADIR-SCENE-PXPYD



Save the actual scene-frame pXpYD fed to renderGPUFromDSI (after
transformToScenePxPyD and optional undistort) as a pX/pY/D hyperstack at
tile resolution, one frame per scene, suffix -NADIR-SCENE-PXPYD[-RECTILINEAR].
For offline verification of the nadir render geometry: the grid should be
near-uniform (tile centers + ERS displacement); any residual rotation
proportional to scene roll would explain the halved in-plane rotation
observed in the 2026-07-10 graveyard COLMAP test.

Co-authored-by: default avatarClaude <claude@elphel.com>
parent a3f665e2
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -10952,6 +10952,9 @@ java.lang.NullPointerException
    	boolean toRGB     = false;
    	String  suffix    = ref_scene.getImageName()
    			+ (undistort ? "-NADIR-MERGED-RECTILINEAR" : "-NADIR-MERGED");
    	// Debug: collect the actual per-scene sampling grids fed to renderGPUFromDSI
    	// (scene-frame pXpYD after transformToScenePxPyD and optional undistort).
    	double[][][] dbg_scene_pXpYD = new double[selected_scenes.length][][];
    	ImageStack stack_scenes = null;
    	for (int nscene = 0; nscene < selected_scenes.length; nscene++) {
    		if (nadir_pXpYD[nscene] == null) continue;
@@ -10981,6 +10984,7 @@ java.lang.NullPointerException
    		if (undistort) {
    			undistortPxPy(pXpYD_scene, selected_scenes[nscene].getErsCorrection());
    		}
    		dbg_scene_pXpYD[nscene] = pXpYD_scene;
    		// Render from scene's own position: ZERO3 offset, scene is its own reference
    		ImagePlus imp_scene = QuadCLT.renderGPUFromDSI(
    				-1,                               // final int       sensor_mask (-1 = merge all)
@@ -11011,6 +11015,33 @@ java.lang.NullPointerException
    			stack_scenes.addSlice(ts, imp_scene.getStack().getPixels(i));
    		}
    	}
    	// Save the scene-frame sampling grids as a hyperstack for offline verification
    	// (same layout as *-NADIR-DISPARITY-MAPS: pX/pY/D per scene at tile resolution)
    	{
    		int tilesX = ref_scene.getTilesX();
    		int tilesY = ref_scene.getTilesY();
    		String [] slice_titles = {"pX", "pY", "D"};
    		String [] frame_titles = new String[selected_scenes.length];
    		for (int ns = 0; ns < selected_scenes.length; ns++) {
    			frame_titles[ns] = selected_scenes[ns].getImageName();
    		}
    		double [][][] disp_maps = ShowDoubleFloatArrays.transposeJagged(
    				dbg_scene_pXpYD, 3, tilesX * tilesY);
    		ImagePlus imp_scene_pxpyd = ShowDoubleFloatArrays.showArraysHyperstack(
    				disp_maps,                                       // double [][][]  pixels,
    				tilesX,                                          // int            width,
    				ref_scene.getImageName() + (undistort ?
    						"-NADIR-SCENE-PXPYD-RECTILINEAR" :
    						"-NADIR-SCENE-PXPYD"),                   // String         title,
    				slice_titles,                                    // String []      titles,
    				frame_titles,                                    // String []      frame_titles,
    				false);                                          // boolean        show
    		if (imp_scene_pxpyd != null) {
    			ref_scene.saveImagePlusInModelDirectory(
    					null,             // String    suffix,
    					imp_scene_pxpyd); // ImagePlus imp
    		}
    	}
    	if (stack_scenes == null) return null;
    	ImagePlus imp_result = new ImagePlus(suffix, stack_scenes);
    	// Apply unsharp mask to enhance SIFT features in LWIR nadir images