Skip to content

Commit 05df177

Browse files
committed
initial work towards enabling video files (mp4, avi) in DICe
1 parent 162fc56 commit 05df177

File tree

12 files changed

+359
-193
lines changed

12 files changed

+359
-193
lines changed

src/base/DICe.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ const char* const gauss_filter_images = "gauss_filter_images";
148148
/// String parameter name
149149
const char* const time_average_cine_ref_frame = "time_average_cine_ref_frame";
150150
/// String parameter name
151+
const char* const time_average_video_ref_frame = "time_average_video_ref_frame";
152+
/// String parameter name
151153
const char* const gauss_filter_mask_size = "gauss_filter_mask_size";
152154
/// String parameter name
153155
const char* const correlation_routine = "correlation_routine";
@@ -684,6 +686,7 @@ enum Image_File_Type{
684686
NETCDF,
685687
CINE,
686688
BMP,
689+
VIDEO,
687690
MAX_IMAGE_FILE_TYPE,
688691
NO_SUCH_IMAGE_FILE_TYPE
689692
};
@@ -1249,6 +1252,11 @@ const Correlation_Parameter time_average_cine_ref_frame_param(time_average_cine_
12491252
false,
12501253
"Select the number of frames over which to time average the reference frame of a cine file");
12511254
/// Correlation parameter and properties
1255+
const Correlation_Parameter time_average_video_ref_frame_param(time_average_video_ref_frame,
1256+
SIZE_PARAM,
1257+
false,
1258+
"Select the number of frames over which to time average the reference frame of a video file");
1259+
/// Correlation parameter and properties
12521260
const Correlation_Parameter compute_def_gradients_param(compute_def_gradients,
12531261
BOOL_PARAM,
12541262
false,
@@ -1283,7 +1291,7 @@ const Correlation_Parameter remove_outlier_pixels_param(remove_outlier_pixels,
12831291
// TODO don't forget to update this when adding a new one
12841292
/// The total number of valid correlation parameters
12851293
/// Vector of valid parameter names
1286-
const int_t num_valid_correlation_params = 90;
1294+
const int_t num_valid_correlation_params = 91;
12871295
/// Vector oIf valid parameter names
12881296
const Correlation_Parameter valid_correlation_params[num_valid_correlation_params] = {
12891297
correlation_routine_param,
@@ -1365,6 +1373,7 @@ const Correlation_Parameter valid_correlation_params[num_valid_correlation_param
13651373
convert_cine_to_8_bit_param,
13661374
remove_outlier_pixels_param,
13671375
time_average_cine_ref_frame_param,
1376+
time_average_video_ref_frame_param,
13681377
global_regularization_alpha_param,
13691378
global_stabilization_tau_param,
13701379
global_formulation_param,

src/base/DICe_Image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ template <typename S>
12441244
bool
12451245
Image_<S>::is_video_frame()const{
12461246
Image_File_Type type = utils::image_file_type(file_name_.c_str());
1247-
if(type==CINE||type==NETCDF)
1247+
if(type==CINE||type==NETCDF||type==VIDEO)
12481248
return true;
12491249
else
12501250
return false;

src/base/DICe_Image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ Image_ {
405405
return has_gradients_;
406406
}
407407

408-
/// returns true if the image is a frame from a video sequence cine or netcdf file
408+
/// returns true if the image is a frame from a video sequence file
409409
bool is_video_frame()const;
410410

411411
/// returns true if the image was created from a file not array

src/core/DICe_Parser.cpp

Lines changed: 113 additions & 95 deletions
Large diffs are not rendered by default.

src/core/DICe_Parser.h

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,39 @@ const char* const stereo_left_suffix = "stereo_left_suffix";
127127
/// Input parameter
128128
const char* const stereo_right_suffix = "stereo_right_suffix";
129129
/// Input parameter
130-
const char* const stereo_cine_file = "stereo_cine_file";
131-
/// Input parameter
132130
const char* const stereo_reference_image = "stereo_reference_image";
133131
/// Input parameter
134132
const char* const stereo_deformed_images = "stereo_deformed_images";
135133
/// Input parameter
136134
const char* const netcdf_file = "netcdf_file";
137135
/// Input parameter
138-
const char* const cine_file = "cine_file";
136+
const char* const stereo_video_file = "stereo_video_file";
137+
/// Input parameter
138+
const char* const video_file = "video_file";
139+
/// Input parameter
140+
const char* const video_ref_index = "video_ref_index";
141+
/// Input parameter
142+
const char* const video_start_index = "video_start_index";
143+
/// Input parameter
144+
const char* const video_preview_index = "video_preview_index";
145+
/// Input parameter
146+
const char* const video_end_index = "video_end_index";
147+
/// Input parameter
148+
const char* const video_skip_index = "video_skip_index";
149+
/// Input parameter
150+
const char* const stereo_cine_file = "stereo_cine_file"; // legacy option
151+
/// Input parameter
152+
const char* const cine_file = "cine_file"; // legacy option
139153
/// Input parameter
140-
const char* const cine_ref_index = "cine_ref_index";
154+
const char* const cine_ref_index = "cine_ref_index"; // legacy option
141155
/// Input parameter
142-
const char* const cine_start_index = "cine_start_index";
156+
const char* const cine_start_index = "cine_start_index"; // legacy option
143157
/// Input parameter
144-
const char* const cine_preview_index = "cine_preview_index";
158+
const char* const cine_preview_index = "cine_preview_index"; // legacy option
145159
/// Input parameter
146-
const char* const cine_end_index = "cine_end_index";
160+
const char* const cine_end_index = "cine_end_index"; // legacy option
147161
/// Input parameter
148-
const char* const cine_skip_index = "cine_skip_index";
162+
const char* const cine_skip_index = "cine_skip_index"; // legacy option
149163
/// Input parameter (multiple deformed images not allowed)
150164
const char* const deformed_images = "deformed_images";
151165
// For image sequences

src/core/DICe_Schema.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ Schema::set_def_image(const std::string & defName){
218218
const int_t num_buffer_frames = !has_extents_ || has_motion_window ? CINE_BUFFER_NUM_FRAMES : 1; // the extents update after each frame so can only put one frame in the buffer
219219
if((frame_id_-first_frame_id_)%num_buffer_frames==0){
220220
if(DICe::utils::image_file_type(defName.c_str())==CINE){
221-
std::string undecorated_cine_file = DICe::utils::cine_file_name(defName.c_str());
221+
std::string undecorated_cine_file = DICe::utils::video_file_name(defName.c_str());
222222
// test if this is a cross-correlation (if so, don't use a buffer since only one frame is needed)
223223
// if it is a cross-correlation setting the def image, the ref and def images will come from different files
224224
// hence the check below on the cine file name
225225
assert(ref_img_!=Teuchos::null);
226-
std::string undecorated_ref_cine_file = DICe::utils::cine_file_name(ref_img_->file_name().c_str());
226+
std::string undecorated_ref_cine_file = DICe::utils::video_file_name(ref_img_->file_name().c_str());
227227
if(undecorated_cine_file==undecorated_ref_cine_file){ // assumes ref image has already been set
228228
// check if the window params are already set and just the frame needs to be updated
229229
const hypercine::HyperCine::Bit_Depth_Conversion_Type conversion_type = convert_cine_to_8_bit_ ? hypercine::HyperCine::TO_8_BIT :

0 commit comments

Comments
 (0)