Commit 8234aee3 authored by Julien Michel's avatar Julien Michel
Browse files

TEST: Udpating test to test the new background/forground/mode features in rasterization filter

parent 24cde55a
......@@ -1218,8 +1218,21 @@ ADD_TEST(coTvOGRDataSourceToLabelImageFilterSHP ${COMMON_TESTS14}
${INPUTDATA}/QB_Toulouse_ortho_labelImage.tif
${INPUTDATA}/QB_Toulouse_ortho.shp
${TEMP}/bfTvOGRDataSourceToLabelImageFilter_Output.tif
1 0 255
)
ADD_TEST(bfTvOGRDataSourceToLabelImageFilterSHPForegroundMode ${COMMON_TESTS14}
--compare-image 0.0
${INPUTDATA}/bfTvOGRDataSourceToLabelImageFilter_Output_ForegroundMode.tif
${TEMP}/bfTvOGRDataSourceToLabelImageFilter_Output_ForegroundMode.tif
otbOGRDataSourceToLabelImageFilter
${INPUTDATA}/QB_Toulouse_ortho_labelImage.tif
${INPUTDATA}/QB_Toulouse_ortho_partial.shp
${TEMP}/bfTvOGRDataSourceToLabelImageFilter_Output_ForegroundMode.tif
0 0 255
)
# --------------------- otbPolygonizationRasterizationTest ---------------------
# bijectivity tests
ADD_TEST(bfTvPolygonizationRasterization_UTM ${COMMON_TESTS14}
......
......@@ -45,13 +45,20 @@ int otbOGRDataSourceToLabelImageFilter(int argc, char* argv[])
reader->SetFileName(argv[1]);
reader->UpdateOutputInformation();
otb::ogr::DataSource::Pointer ogrDS = otb::ogr::DataSource::New(argv[2], otb::ogr::DataSource::Modes::write);
bool mode = atoi(argv[4]);
unsigned char background = atoi(argv[5]);
unsigned char foreground = atoi(argv[6]);
otb::ogr::DataSource::Pointer ogrDS = otb::ogr::DataSource::New(argv[2], otb::ogr::DataSource::Modes::read);
// rasterize
RasterizationFilterType::Pointer rasterization = RasterizationFilterType::New();
rasterization->AddOGRDataSource(ogrDS);
rasterization->SetOutputParametersFromImage(reader->GetOutput());
rasterization->SetBurnAttribute("DN");
rasterization->SetBurnAttributeMode(mode);
rasterization->SetBackgroundValue(background);
rasterization->SetForegroundValue(foreground);
/*otb::StandardOneLineFilterWatcher * watch = new otb::StandardOneLineFilterWatcher(rasterization.GetPointer(),
"rasterization"); */
......
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