-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitkVideoFilePipelineTest.cxx
More file actions
53 lines (41 loc) · 1.35 KB
/
itkVideoFilePipelineTest.cxx
File metadata and controls
53 lines (41 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "iostream"
#include "itkVideoFileReader.h"
#include "itkVideoFileWriter.h"
int test_pipeline (char* Input, char* Output,bool readerUseOpenCV, bool writerUseOpenCV)
{
typedef itk::Image< unsigned char, 2> OutputImageType;
itk::VideoFileReader< OutputImageType >::Pointer Reader = itk::VideoFileReader< OutputImageType >::New();
Reader->SetFileName(Input);
Reader->UseOpenCV(readerUseOpenCV);
Reader->LoadVideo();
unsigned long i;
itk::VideoFileWriter<OutputImageType>::Pointer VideoWriter = itk::VideoFileWriter<OutputImageType>::New();
VideoWriter->SetInput(Reader->GetOutput());
VideoWriter->SetFileName(Output);
VideoWriter->UseOpenCV(writerUseOpenCV);
for (i = 0; i < Reader->GetFrameTotal()-1 ; i ++ )
{
try
{
VideoWriter->Update();
}
catch (itk::ExceptionObject &e)
{
VideoWriter->Print(std::cout);
std::cerr<<e.GetFile()<<std::endl;
std::cerr<<e.GetLine()<<std::endl;
std::cerr<<e.GetLocation()<<std::endl;
std::cerr<<e.GetNameOfClass()<<std::endl;
std::cerr<<e.GetDescription()<<std::endl;
return EXIT_FAILURE;
}
Reader->KeepReading();
}
VideoWriter->EndVideo();
std::cout<<"Done !"<<std::endl;
return EXIT_SUCCESS;
}
int main (int argv, char **argc)
{
return test_pipeline(argc[1],argc[2],atoi(argc[3]),atoi(argc[4]));
}