Loading src/main/java/com/elphel/imagej/correction/EyesisCorrections.java +11 −4 Original line number Diff line number Diff line Loading @@ -233,18 +233,22 @@ public class EyesisCorrections { public ImagePlus getJp4Tiff( String path, int [] woi_tops) { return getJp4Tiff(path, false, woi_tops); int [] woi_tops, int [] camera_heights ) { return getJp4Tiff(path, false, woi_tops, camera_heights); } public ImagePlus getJp4Tiff( String path) { return getJp4Tiff(path, false, null); return getJp4Tiff(path, false, null, null); } public ImagePlus getJp4Tiff( String path, boolean ignore_alien, // open image even if it does not belong to the current camera int [] woi_tops) { int [] woi_tops, int [] camera_heights ) { // get source file channel int src_channel = correctionsParameters.getChannelFromSourceTiff(path); int sub_camera = src_channel - correctionsParameters.firstSubCamera; Loading Loading @@ -279,6 +283,9 @@ public class EyesisCorrections { if (imp.getProperty("WOI_TOP") != null) woi_tops[sensor_number] = Integer.parseInt((String) imp.getProperty("WOI_TOP")); } if ((camera_heights != null) && (sensor_number< camera_heights.length)) { // actually acquired height (not padded) camera_heights[sensor_number] = imp.getHeight(); } } else if (!ignore_alien) { return null; } Loading src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +77 −1 Original line number Diff line number Diff line Loading @@ -703,6 +703,7 @@ private Panel panel1, addButton("Inter Pairs", panelClt5, color_process); addButton("Inter LMA", panelClt5, color_stop); addButton("Inter Series", panelClt5, color_process); addButton("Inter Accumulate", panelClt5, color_process); plugInFrame.add(panelClt5); } Loading Loading @@ -5125,6 +5126,14 @@ private Panel panel1, interSeriesLMA(); return; /* ======================================================================== */ } else if (label.equals("Inter Accumulate")) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); CLT_PARAMETERS.batch_run = true; intersceneAccumulate(); return; /* ======================================================================== */ } else if (label.equals("Inter LMA")) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; Loading Loading @@ -5646,7 +5655,7 @@ private Panel panel1, if (DEBUG_LEVEL > -2){ System.out.println("++++++++++++++ Running initSensorFiles for the main camera ++++++++++++++"); } EYESIS_CORRECTIONS.initSensorFiles( EYESIS_CORRECTIONS.initSensorFiles( // long DEBUG_LEVEL+2, false, // true, true, // false, Loading Loading @@ -6716,6 +6725,73 @@ private Panel panel1, return true; } public boolean intersceneAccumulate() { long startTime=System.nanoTime(); // load needed sensor and kernels files if (!prepareRigImages()) return false; String configPath=getSaveCongigPath(); if (configPath.equals("ABORT")) return false; setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated, others should be set here if (DEBUG_LEVEL > -2){ System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++"); } if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (GPU_TILE_PROCESSOR == null) { try { GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); } catch (Exception e) { System.out.println("Failed to initialize GPU class"); // TODO Auto-generated catch block e.printStackTrace(); return false; } //final int debugLevel); } if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed try { GPU_QUAD = GPU_TILE_PROCESSOR.new GpuQuad( QUAD_CLT, 4, 3); } catch (Exception e) { System.out.println("Failed to initialize GpuQuad class"); // TODO Auto-generated catch block e.printStackTrace(); return false; } //final int debugLevel); QUAD_CLT.setGPU(GPU_QUAD); } } try { TWO_QUAD_CLT.intersceneAccumulate( QUAD_CLT, // QuadCLT quadCLT_main, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters, COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters, CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters, RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters, EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters, PROPERTIES, // Properties properties, THREADS_MAX, //final int threadsMax, // maximal number of threads to launch UPDATE_STATUS, //final boolean updateStatus, DEBUG_LEVEL); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //final int debugLevel); if (configPath!=null) { saveTimestampedProperties( // save config again configPath, // full path or null null, // use as default directory if path==null true, PROPERTIES); } System.out.println("batchRig(): Processing finished at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+ Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")"); return true; } Loading src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java +46 −26 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.concurrent.CopyOnWriteArrayList; Loading Loading @@ -2718,19 +2719,33 @@ public class GPUTileProcessor { * by the caller. They are calculated by recalculating from the reference scene after appropriate transformation (shift, rotation * and ERS correction) * @param pXpYD Array of per-tile pX, pY and disparity triplets (or nulls for undefined tiles). * @param task_code Put this value (typically 512?) for each tile in task field. * @param geometryCorrection GeometryCorrection instance for the camera. * @param disparity_corr Disparity correction at infinity * @param margin Skip tile if at least one channel tile center is closer to the image edge than this margin. * @param valid_tiles Optional (if not null) should be initialized as boolean [tiles] - will contain valid tiles * @param threadsMax Maximal number of threads to run concurrently. * @return Array of TpTask instances (fully prepared) to be fed to the GPU */ public TpTask[] setInterTasks( double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls) int task_code, // code to use for active tiles final double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls) final GeometryCorrection geometryCorrection, final double disparity_corr, final int margin, // do not use tiles if their centers are closer to the edges final boolean [] valid_tiles, final int threadsMax) // maximal number of threads to launch { final int task_code = ((1 << NUM_PAIRS)-1) << TASK_CORR_BITS; // correlation only final double min_px = margin; final double max_px = img_width - 1 - margin; final double [] min_py = new double[num_cams] ; final double [] max_py = new double[num_cams] ; for (int i = 0; i < num_cams; i++) { min_py [i] = margin + geometryCorrection.getWOITops()[i]; max_py [i] = geometryCorrection.getWOITops()[i] + geometryCorrection.getCameraHeights()[i] - 1 - margin; } if (valid_tiles!=null) { Arrays.fill(valid_tiles, false); } final int tilesX = img_width / DTT_SIZE; final int tiles = pXpYD.length; final Matrix [] corr_rots = geometryCorrection.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices Loading @@ -2738,33 +2753,23 @@ public class GPUTileProcessor { final Thread[] threads = ImageDtt.newThreadArray(threadsMax); final AtomicInteger ai = new AtomicInteger(0); final AtomicInteger aTiles = new AtomicInteger(0); final int [] tile_indices = new int [tiles]; for (int ithread = 0; ithread < threads.length; ithread++) { threads[ithread] = new Thread() { public void run() { for (int nTile = ai.getAndIncrement(); nTile < tiles; nTile = ai.getAndIncrement()) if (pXpYD[nTile] != null) { tile_indices[aTiles.getAndIncrement()] = nTile; } } }; } ImageDtt.startAndJoin(threads); ai.set(0); final TpTask[] tp_tasks = new TpTask[aTiles.get()]; final TpTask[] tp_tasks = new TpTask[tiles]; // aTiles.get()]; for (int ithread = 0; ithread < threads.length; ithread++) { threads[ithread] = new Thread() { @Override public void run() { for (int indx = ai.getAndIncrement(); indx < tp_tasks.length; indx = ai.getAndIncrement()) { int nTile = tile_indices[indx]; // for (int indx = ai.getAndIncrement(); indx < tp_tasks.length; indx = ai.getAndIncrement()) { // int nTile = tile_indices[indx]; for (int nTile = ai.getAndIncrement(); nTile < tiles; nTile = ai.getAndIncrement()) if (pXpYD[nTile] != null) { TpTask tp_task = new TpTask(); int tileY = nTile / tilesX; int tileX = nTile % tilesX; tp_tasks[nTile].ty = tileY; tp_tasks[nTile].tx = tileX; tp_tasks[nTile].task = task_code; tp_task.ty = tileY; tp_task.tx = tileX; tp_task.task = task_code; double disparity = pXpYD[nTile][2] + disparity_corr; tp_tasks[nTile].target_disparity = (float) disparity; // will it be used? tp_task.target_disparity = (float) disparity; // will it be used? double [][] disp_dist_main = new double[quad_main][]; // used to correct 3D correlations (not yet used here) double [][] centersXY_main = geometryCorrection.getPortsCoordinatesAndDerivatives( geometryCorrection, // GeometryCorrection gc_main, Loading @@ -2776,17 +2781,32 @@ public class GPUTileProcessor { pXpYD[nTile][0], pXpYD[nTile][1], disparity); // + disparity_corr); tp_tasks[nTile].xy = new float [centersXY_main.length][2]; tp_task.xy = new float [centersXY_main.length][2]; boolean bad_margins = false; for (int i = 0; i < centersXY_main.length; i++) { tp_tasks[nTile].xy[i][0] = (float) centersXY_main[i][0]; tp_tasks[nTile].xy[i][1] = (float) centersXY_main[i][1]; if ( (centersXY_main[i][0] < min_px) || (centersXY_main[i][0] > max_px) || (centersXY_main[i][1] < min_py[i]) || (centersXY_main[i][1] > max_py[i])) { bad_margins = true; break; } tp_task.xy[i][0] = (float) centersXY_main[i][0]; tp_task.xy[i][1] = (float) centersXY_main[i][1]; } if (bad_margins) { continue; } tp_tasks[aTiles.getAndIncrement()] = tp_task; if (valid_tiles!=null) { valid_tiles[nTile] = true; } } } }; } ImageDtt.startAndJoin(threads); return tp_tasks; final TpTask[] tp_tasks_out = new TpTask[aTiles.get()]; System.arraycopy(tp_tasks, 0, tp_tasks_out, 0, tp_tasks_out.length); return tp_tasks_out; } Loading src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java +3 −0 Original line number Diff line number Diff line Loading @@ -357,6 +357,7 @@ public class ErsCorrection extends GeometryCorrection { for (String ts:scenes_poses.keySet()) { scenes[i++] = ts; } Arrays.sort(scenes); return scenes; } Loading Loading @@ -678,6 +679,7 @@ public class ErsCorrection extends GeometryCorrection { extrinsic_corr = gc.extrinsic_corr; // ; rigOffset = gc.rigOffset; // = null; woi_tops = gc.woi_tops; // = null; // used to calculate scanline timing camera_heights = gc.camera_heights; // = null; // used to calculate scanline timing if (deep) { forward = clone1d(forward); right = clone1d(right); Loading @@ -692,6 +694,7 @@ public class ErsCorrection extends GeometryCorrection { extrinsic_corr = extrinsic_corr.clone(); if (rigOffset!=null) rigOffset = rigOffset.clone(); woi_tops = clone1d(woi_tops); camera_heights = clone1d(camera_heights); } resetScenes(); // no scenes yet // generate initial ers velocity and roll Loading src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java +11 −3 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ public class GeometryCorrection { public RigOffset rigOffset = null; public int [] woi_tops = null; // used to calculate scanline timing public int [] camera_heights = null; // actual acquired lines (from woi_tops) public float [] toFloatArray() { // for GPU comparison Loading Loading @@ -155,6 +156,7 @@ public class GeometryCorrection { (float) cameraRadius, // average distance from the "mass center" of the sensors to the sensors (float) disparityRadius, //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad woi_tops[0],woi_tops[1],woi_tops[2],woi_tops[3] // TODO: ADD camera_heights[0], camera_heights[1], camera_heights[2], camera_heights[3], }; } public static int arrayLength(int ncam) { Loading Loading @@ -199,12 +201,17 @@ public class GeometryCorrection { cameraRadius, // average distance from the "mass center" of the sensors to the sensors disparityRadius, //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad woi_tops[0],woi_tops[1],woi_tops[2],woi_tops[3] // TODO: ADD camera_heights[0], camera_heights[1], camera_heights[2], camera_heights[3], }; } public int [] getWOITops() {// not used in lwir return woi_tops; } public int [] getCameraHeights() { return camera_heights; } public double [][] getPXY0(){ return this.pXY0; Loading Loading @@ -349,6 +356,7 @@ public class GeometryCorrection { pXY0 = new double [numSensors][2]; rXY = new double [numSensors][2]; woi_tops = new int [numSensors]; camera_heights = new int [numSensors]; resetCorrVector(); } Loading Loading
src/main/java/com/elphel/imagej/correction/EyesisCorrections.java +11 −4 Original line number Diff line number Diff line Loading @@ -233,18 +233,22 @@ public class EyesisCorrections { public ImagePlus getJp4Tiff( String path, int [] woi_tops) { return getJp4Tiff(path, false, woi_tops); int [] woi_tops, int [] camera_heights ) { return getJp4Tiff(path, false, woi_tops, camera_heights); } public ImagePlus getJp4Tiff( String path) { return getJp4Tiff(path, false, null); return getJp4Tiff(path, false, null, null); } public ImagePlus getJp4Tiff( String path, boolean ignore_alien, // open image even if it does not belong to the current camera int [] woi_tops) { int [] woi_tops, int [] camera_heights ) { // get source file channel int src_channel = correctionsParameters.getChannelFromSourceTiff(path); int sub_camera = src_channel - correctionsParameters.firstSubCamera; Loading Loading @@ -279,6 +283,9 @@ public class EyesisCorrections { if (imp.getProperty("WOI_TOP") != null) woi_tops[sensor_number] = Integer.parseInt((String) imp.getProperty("WOI_TOP")); } if ((camera_heights != null) && (sensor_number< camera_heights.length)) { // actually acquired height (not padded) camera_heights[sensor_number] = imp.getHeight(); } } else if (!ignore_alien) { return null; } Loading
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +77 −1 Original line number Diff line number Diff line Loading @@ -703,6 +703,7 @@ private Panel panel1, addButton("Inter Pairs", panelClt5, color_process); addButton("Inter LMA", panelClt5, color_stop); addButton("Inter Series", panelClt5, color_process); addButton("Inter Accumulate", panelClt5, color_process); plugInFrame.add(panelClt5); } Loading Loading @@ -5125,6 +5126,14 @@ private Panel panel1, interSeriesLMA(); return; /* ======================================================================== */ } else if (label.equals("Inter Accumulate")) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); CLT_PARAMETERS.batch_run = true; intersceneAccumulate(); return; /* ======================================================================== */ } else if (label.equals("Inter LMA")) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; Loading Loading @@ -5646,7 +5655,7 @@ private Panel panel1, if (DEBUG_LEVEL > -2){ System.out.println("++++++++++++++ Running initSensorFiles for the main camera ++++++++++++++"); } EYESIS_CORRECTIONS.initSensorFiles( EYESIS_CORRECTIONS.initSensorFiles( // long DEBUG_LEVEL+2, false, // true, true, // false, Loading Loading @@ -6716,6 +6725,73 @@ private Panel panel1, return true; } public boolean intersceneAccumulate() { long startTime=System.nanoTime(); // load needed sensor and kernels files if (!prepareRigImages()) return false; String configPath=getSaveCongigPath(); if (configPath.equals("ABORT")) return false; setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated, others should be set here if (DEBUG_LEVEL > -2){ System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++"); } if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (GPU_TILE_PROCESSOR == null) { try { GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); } catch (Exception e) { System.out.println("Failed to initialize GPU class"); // TODO Auto-generated catch block e.printStackTrace(); return false; } //final int debugLevel); } if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed try { GPU_QUAD = GPU_TILE_PROCESSOR.new GpuQuad( QUAD_CLT, 4, 3); } catch (Exception e) { System.out.println("Failed to initialize GpuQuad class"); // TODO Auto-generated catch block e.printStackTrace(); return false; } //final int debugLevel); QUAD_CLT.setGPU(GPU_QUAD); } } try { TWO_QUAD_CLT.intersceneAccumulate( QUAD_CLT, // QuadCLT quadCLT_main, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters, COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters, CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters, RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters, EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters, PROPERTIES, // Properties properties, THREADS_MAX, //final int threadsMax, // maximal number of threads to launch UPDATE_STATUS, //final boolean updateStatus, DEBUG_LEVEL); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //final int debugLevel); if (configPath!=null) { saveTimestampedProperties( // save config again configPath, // full path or null null, // use as default directory if path==null true, PROPERTIES); } System.out.println("batchRig(): Processing finished at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+ Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")"); return true; } Loading
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java +46 −26 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.concurrent.CopyOnWriteArrayList; Loading Loading @@ -2718,19 +2719,33 @@ public class GPUTileProcessor { * by the caller. They are calculated by recalculating from the reference scene after appropriate transformation (shift, rotation * and ERS correction) * @param pXpYD Array of per-tile pX, pY and disparity triplets (or nulls for undefined tiles). * @param task_code Put this value (typically 512?) for each tile in task field. * @param geometryCorrection GeometryCorrection instance for the camera. * @param disparity_corr Disparity correction at infinity * @param margin Skip tile if at least one channel tile center is closer to the image edge than this margin. * @param valid_tiles Optional (if not null) should be initialized as boolean [tiles] - will contain valid tiles * @param threadsMax Maximal number of threads to run concurrently. * @return Array of TpTask instances (fully prepared) to be fed to the GPU */ public TpTask[] setInterTasks( double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls) int task_code, // code to use for active tiles final double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls) final GeometryCorrection geometryCorrection, final double disparity_corr, final int margin, // do not use tiles if their centers are closer to the edges final boolean [] valid_tiles, final int threadsMax) // maximal number of threads to launch { final int task_code = ((1 << NUM_PAIRS)-1) << TASK_CORR_BITS; // correlation only final double min_px = margin; final double max_px = img_width - 1 - margin; final double [] min_py = new double[num_cams] ; final double [] max_py = new double[num_cams] ; for (int i = 0; i < num_cams; i++) { min_py [i] = margin + geometryCorrection.getWOITops()[i]; max_py [i] = geometryCorrection.getWOITops()[i] + geometryCorrection.getCameraHeights()[i] - 1 - margin; } if (valid_tiles!=null) { Arrays.fill(valid_tiles, false); } final int tilesX = img_width / DTT_SIZE; final int tiles = pXpYD.length; final Matrix [] corr_rots = geometryCorrection.getCorrVector().getRotMatrices(); // get array of per-sensor rotation matrices Loading @@ -2738,33 +2753,23 @@ public class GPUTileProcessor { final Thread[] threads = ImageDtt.newThreadArray(threadsMax); final AtomicInteger ai = new AtomicInteger(0); final AtomicInteger aTiles = new AtomicInteger(0); final int [] tile_indices = new int [tiles]; for (int ithread = 0; ithread < threads.length; ithread++) { threads[ithread] = new Thread() { public void run() { for (int nTile = ai.getAndIncrement(); nTile < tiles; nTile = ai.getAndIncrement()) if (pXpYD[nTile] != null) { tile_indices[aTiles.getAndIncrement()] = nTile; } } }; } ImageDtt.startAndJoin(threads); ai.set(0); final TpTask[] tp_tasks = new TpTask[aTiles.get()]; final TpTask[] tp_tasks = new TpTask[tiles]; // aTiles.get()]; for (int ithread = 0; ithread < threads.length; ithread++) { threads[ithread] = new Thread() { @Override public void run() { for (int indx = ai.getAndIncrement(); indx < tp_tasks.length; indx = ai.getAndIncrement()) { int nTile = tile_indices[indx]; // for (int indx = ai.getAndIncrement(); indx < tp_tasks.length; indx = ai.getAndIncrement()) { // int nTile = tile_indices[indx]; for (int nTile = ai.getAndIncrement(); nTile < tiles; nTile = ai.getAndIncrement()) if (pXpYD[nTile] != null) { TpTask tp_task = new TpTask(); int tileY = nTile / tilesX; int tileX = nTile % tilesX; tp_tasks[nTile].ty = tileY; tp_tasks[nTile].tx = tileX; tp_tasks[nTile].task = task_code; tp_task.ty = tileY; tp_task.tx = tileX; tp_task.task = task_code; double disparity = pXpYD[nTile][2] + disparity_corr; tp_tasks[nTile].target_disparity = (float) disparity; // will it be used? tp_task.target_disparity = (float) disparity; // will it be used? double [][] disp_dist_main = new double[quad_main][]; // used to correct 3D correlations (not yet used here) double [][] centersXY_main = geometryCorrection.getPortsCoordinatesAndDerivatives( geometryCorrection, // GeometryCorrection gc_main, Loading @@ -2776,17 +2781,32 @@ public class GPUTileProcessor { pXpYD[nTile][0], pXpYD[nTile][1], disparity); // + disparity_corr); tp_tasks[nTile].xy = new float [centersXY_main.length][2]; tp_task.xy = new float [centersXY_main.length][2]; boolean bad_margins = false; for (int i = 0; i < centersXY_main.length; i++) { tp_tasks[nTile].xy[i][0] = (float) centersXY_main[i][0]; tp_tasks[nTile].xy[i][1] = (float) centersXY_main[i][1]; if ( (centersXY_main[i][0] < min_px) || (centersXY_main[i][0] > max_px) || (centersXY_main[i][1] < min_py[i]) || (centersXY_main[i][1] > max_py[i])) { bad_margins = true; break; } tp_task.xy[i][0] = (float) centersXY_main[i][0]; tp_task.xy[i][1] = (float) centersXY_main[i][1]; } if (bad_margins) { continue; } tp_tasks[aTiles.getAndIncrement()] = tp_task; if (valid_tiles!=null) { valid_tiles[nTile] = true; } } } }; } ImageDtt.startAndJoin(threads); return tp_tasks; final TpTask[] tp_tasks_out = new TpTask[aTiles.get()]; System.arraycopy(tp_tasks, 0, tp_tasks_out, 0, tp_tasks_out.length); return tp_tasks_out; } Loading
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java +3 −0 Original line number Diff line number Diff line Loading @@ -357,6 +357,7 @@ public class ErsCorrection extends GeometryCorrection { for (String ts:scenes_poses.keySet()) { scenes[i++] = ts; } Arrays.sort(scenes); return scenes; } Loading Loading @@ -678,6 +679,7 @@ public class ErsCorrection extends GeometryCorrection { extrinsic_corr = gc.extrinsic_corr; // ; rigOffset = gc.rigOffset; // = null; woi_tops = gc.woi_tops; // = null; // used to calculate scanline timing camera_heights = gc.camera_heights; // = null; // used to calculate scanline timing if (deep) { forward = clone1d(forward); right = clone1d(right); Loading @@ -692,6 +694,7 @@ public class ErsCorrection extends GeometryCorrection { extrinsic_corr = extrinsic_corr.clone(); if (rigOffset!=null) rigOffset = rigOffset.clone(); woi_tops = clone1d(woi_tops); camera_heights = clone1d(camera_heights); } resetScenes(); // no scenes yet // generate initial ers velocity and roll Loading
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java +11 −3 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ public class GeometryCorrection { public RigOffset rigOffset = null; public int [] woi_tops = null; // used to calculate scanline timing public int [] camera_heights = null; // actual acquired lines (from woi_tops) public float [] toFloatArray() { // for GPU comparison Loading Loading @@ -155,6 +156,7 @@ public class GeometryCorrection { (float) cameraRadius, // average distance from the "mass center" of the sensors to the sensors (float) disparityRadius, //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad woi_tops[0],woi_tops[1],woi_tops[2],woi_tops[3] // TODO: ADD camera_heights[0], camera_heights[1], camera_heights[2], camera_heights[3], }; } public static int arrayLength(int ncam) { Loading Loading @@ -199,12 +201,17 @@ public class GeometryCorrection { cameraRadius, // average distance from the "mass center" of the sensors to the sensors disparityRadius, //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad woi_tops[0],woi_tops[1],woi_tops[2],woi_tops[3] // TODO: ADD camera_heights[0], camera_heights[1], camera_heights[2], camera_heights[3], }; } public int [] getWOITops() {// not used in lwir return woi_tops; } public int [] getCameraHeights() { return camera_heights; } public double [][] getPXY0(){ return this.pXY0; Loading Loading @@ -349,6 +356,7 @@ public class GeometryCorrection { pXY0 = new double [numSensors][2]; rXY = new double [numSensors][2]; woi_tops = new int [numSensors]; camera_heights = new int [numSensors]; resetCorrVector(); } Loading