Commit 624f1144 authored by Andrey Filippov's avatar Andrey Filippov

Orthographic videos generation

parent 8a9605a5
......@@ -109,6 +109,7 @@ import com.elphel.imagej.ims.EventLogger;
import com.elphel.imagej.ims.Imx5;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import com.elphel.imagej.lwir.LwirReader;
import com.elphel.imagej.orthomosaic.ComboMap;
import com.elphel.imagej.orthomosaic.ComboMatch;
import com.elphel.imagej.readers.ChangeImageResolution;
import com.elphel.imagej.readers.DumpImageMetadata;
......@@ -847,6 +848,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
addButton("Warp pair", panelLWIRWorld, color_process);
addButton("Read Tiff", panelLWIRWorld, color_process);
addButton("Set pair GPS", panelLWIRWorld, color_process);
addButton("Test video", panelLWIRWorld, color_process);
plugInFrame.add(panelLWIRWorld);
}
......@@ -5705,21 +5707,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
} else if (label.equals("Set pair GPS")) {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
/*
boolean run_pre = true; // false;
if (run_pre) {
String path = loadProperties(null, CORRECTION_PARAMETERS.resultsDirectory, true, PROPERTIES);
if (path != null) {
getAllProperties(PROPERTIES);
if (DEBUG_LEVEL > -3)
System.out.println("Configuration parameters are restored from " + path);
} else {
if (DEBUG_LEVEL > -10)
System.out.println("Failed to restore configuration parameters");
return;
}
}
*/
if (GPU_TILE_PROCESSOR == null) {
try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu);
......@@ -5730,23 +5717,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
return;
} // final int debugLevel);
}
/*
if (!run_pre) {
String path = loadProperties(null, CORRECTION_PARAMETERS.resultsDirectory, true, PROPERTIES);
if (path != null) {
getAllProperties(PROPERTIES);
if (DEBUG_LEVEL > -3)
System.out.println("Configuration parameters are restored from " + path);
} else {
if (DEBUG_LEVEL > -10)
System.out.println("Failed to restore configuration parameters");
return;
}
}
*/
//////////////////////
// Temporarily initialize on scene GPU
boolean init_scene = false; // true;
if (init_scene) {
......@@ -5756,6 +5726,13 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
CLT_PARAMETERS, // CLTParameters clt_parameters,
GPU_TILE_PROCESSOR,
DEBUG_LEVEL);
} else if (label.equals("Test video")) {
ImagePlus imp_sel = WindowManager.getCurrentImage();
if (imp_sel == null) {
IJ.showMessage("Error", "No images selected");
return;
}
ComboMap.testVideo(imp_sel);
}
}
......
......@@ -43,29 +43,9 @@ public class ComboMatch {
GPUTileProcessor gpu_tile_processor, // initialized by the caller
final int debugLevel) {
GPU_TILE_PROCESSOR = gpu_tile_processor;
String [] image_paths_pre_0 = {
// "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-b/1697877410_420287/1697877410_420287-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
// "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-b/1697877412_004148/1697877412_004148-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877409_353265/1697877409_353265-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877410_403615/1697877410_403615-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877411_987476/1697877411_987476-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877413_137859/1697877413_137859-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877414_404948/1697877414_404948-RECT-PIX0.01-FLAT_CLN-VERT-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877415_521986/1697877415_521986-RECT-PIX0.01-FLAT_CLN-VERT-GEO"
};
String [] image_paths_pre = {
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877409_353265/1697877409_353265-RECT-PIX0.01-FLAT_CLN-VERT-GCORR-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877410_403615/1697877410_403615-RECT-PIX0.01-FLAT_CLN-VERT-GCORR-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877411_987476/1697877411_987476-RECT-PIX0.01-FLAT_CLN-VERT-GCORR-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877413_137859/1697877413_137859-RECT-PIX0.01-FLAT_CLN-VERT-GCORR-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877414_404948/1697877414_404948-RECT-PIX0.01-FLAT_CLN-VERT-GCORR-GEO",
"/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-c/1697877415_521986/1697877415_521986-RECT-PIX0.01-FLAT_CLN-VERT-GCORR-GEO"
};
// find -L /media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-b/ -type f -name "*-GCORR-GEO.tiff" | sort > GCORR-GEO.list
String files_list_path = "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/linked/linked_1697875868-1697879449-b/maps_01.list";
String files_list_path = "/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/maps_berdich2.list";
double [][][] image_enuatr = {{{0,0,0},{0,0,0}},{{0,0,0},{0,0,0}}};
int gpu_width= clt_parameters.imp.rln_gpu_width; // 3008;
......@@ -122,10 +102,6 @@ public class ComboMatch {
show_centers = gd.getNextBoolean();
use_alt = gd.getNextBoolean();
String [] full_paths = new String[image_paths_pre.length];
for (int n = 0; n < full_paths.length; n++) {
full_paths[n] = image_paths_pre[n]+".tiff";
}
// ComboMap[] combo_maps = ComboMap.initializeComboMaps(
// full_paths); // String [] image_paths);
ComboMap[] combo_maps = ComboMap.initializeComboMaps(
......@@ -170,14 +146,14 @@ public class ComboMatch {
true,
"gpu_pair-zoom"+zoom_lev+"-"+combo_maps[gpu_pair[0]].getName()+"-"+combo_maps[gpu_pair[1]].getName(),
map_names);
if (image_paths_pre.length > 2) {
if (debugLevel <1000) {
return true;
}
/* */
int [] widths = new int[imp_src.length];
int [] heights = new int[imp_src.length];
for (int n = 0; n < imp_src.length; n++) {
imp_src[n] = new ImagePlus(image_paths_pre[n]+".tiff"); // may use +"-ALT.tiff"
// imp_src[n] = new ImagePlus(image_paths_pre[n]+".tiff"); // may use +"-ALT.tiff"
widths[n] = imp_src[n].getWidth();
heights[n] = imp_src[n].getHeight();
}
......@@ -187,12 +163,14 @@ public class ComboMatch {
double [][] xy_pix_centers = new double [2][];
double [] pix_sizes = new double[2]; // ElphelTiffReader.getPixelSize(imp_prop[0])[0];
for (int n = 0; n < imp_src.length; n++) {
/*
try {
imp_prop[n] = ElphelTiffReader.getTiffMeta(image_paths_pre[n]+".tiff");
// imp_prop[n] = ElphelTiffReader.getTiffMeta(image_paths_pre[n]+".tiff");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
llas[n] = ElphelTiffReader.getLLA(imp_prop[n]);
dts[n] = ElphelTiffReader.getLocalDateTime(imp_prop[n]);
xy_pix_centers[n] = ElphelTiffReader.getXYOffsetPixels(imp_prop[n]);
......
......@@ -5907,7 +5907,7 @@ public class OpticalFlow {
imp_scenes_pair[nstereo].getProcessor().setMinAndMax(-mono_range/2, mono_range/2);
}
ImageConverter imageConverter = new ImageConverter(imp_scenes_pair[nstereo]);
imageConverter.convertToRGB(); // Did it convert imp_scenes ?
imageConverter.convertToRGB(); // Did it convert imp_scenes ? YES
}
final Color fcolor = toRGB ? annotate_color_color: annotate_color_mono;
......@@ -6079,13 +6079,13 @@ public class OpticalFlow {
//https://ffmpeg.org/ffmpeg-formats.html
//ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
//anaglyph_cyan_red
String streo_meta = "";
String stereo_meta = "";
if ((webm_path.contains("-STEREO-")) || (webm_path.contains("-SBS-"))) {
if (stereo_gap == 0) {
if (debugLevel > -3) {
System.out.println("Adding 3D meta: stereo_mode=left_right");
}
streo_meta = " -metadata:s:v:0 stereo_mode=left_right ";
stereo_meta = " -metadata:s:v:0 stereo_mode=left_right ";
} else {
if (debugLevel > -3) {
System.out.println("stereo_gap !=0, skipping 3D meta as firefox/vlc halves display width");
......@@ -6095,11 +6095,11 @@ public class OpticalFlow {
if (debugLevel > -3) {
System.out.println("Adding 3D meta: stereo_mode=anaglyph_cyan_red");
}
streo_meta = " -metadata:s:v:0 stereo_mode=anaglyph_cyan_red ";
stereo_meta = " -metadata:s:v:0 stereo_mode=anaglyph_cyan_red ";
}
String shellCommand = String.format("ffmpeg -y -i %s -c %s -b:v 0 -crf %d %s %s",
avi_path, video_codec, video_crf, streo_meta, webm_path);
avi_path, video_codec, video_crf, stereo_meta, webm_path);
Process p = null;
if (generate_mapped) {
int exit_code = -1;
......
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