Skip to content
Snippets Groups Projects
Commit 2de12933 authored by Antoine Regimbeau's avatar Antoine Regimbeau
Browse files

TEST : new test for compute histo filter

parent c141fb3d
No related branches found
No related tags found
No related merge requests found
......@@ -280,7 +280,7 @@ void ComputeHistoFilter < TInputImage , TOutputImage >
oit.Get()[i] = agreg;
total += agreg;
}
if ( m_Threshold != -1 )
if ( m_Threshold > 0 )
ApplyThreshold( oit , total );
}
}
......
......@@ -23,6 +23,7 @@ otb_module_test()
set(OTBContrastTests
otbContrastTestDriver.cxx
otbComputeHistoFilterNew.cxx
otbComputeHistoFilter.cxx
otbApplyGainFilterNew.cxx
otbComputeGainLutFilterNew.cxx
otbCLHistogramEqualizationFilterNew.cxx
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbImage.h"
#include "otbImageFileWriter.h"
#include "otbImageFileReader.h"
#include "otbVectorImage.h"
#include "otbComputeHistoFilter.h"
int otbComputeHistoFilter(int itkNotUsed(argc), char * itkNotUsed(argv) [])
{
typedef int InputPixelType;
typedef int OutputPixelType;
const unsigned int Dimension = 2;
typedef otb::Image< InputPixelType , Dimension > InputImageType;
typedef otb::VectorImage< OutputPixelType , Dimension > HistoImageType;
typedef otb::ComputeHistoFilter< InputImageType , HistoImageType > FilterType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef otb::ImageFileWriter< HistoImageType > WriterType;
ReaderType::Pointer reader ( ReaderType::New() );
WriterType::Pointer writer ( WriterType::New() );
reader->SetFileName( "/home/antoine/dev/my_data/test/smallinput.tif" );
writer->SetFileName( "/home/antoine/dev/my_data/test/small_glob_histo.tif" );
reader->UpdateOutputInformation();
FilterType::Pointer computeHisto ( FilterType::New() );
computeHisto->SetInput( reader->GetOutput() );
computeHisto->SetMin(0);
computeHisto->SetMax(255);
computeHisto->SetNbBin(256);
// computeHisto->SetThreshol(256);
auto size = reader->GetOutput()->GetLargestPossibleRegion().GetSize();
computeHisto->SetThumbSize(size);
writer->SetInput( computeHisto->GetHistoOutput() );
writer->Update();
auto index = computeHisto->GetHistoOutput()->GetLargestPossibleRegion().GetIndex();
std::cout << computeHisto->GetHistoOutput()->GetPixel(index) << std::endl;
return EXIT_SUCCESS;
}
\ No newline at end of file
......@@ -23,6 +23,7 @@
void RegisterTests()
{
REGISTER_TEST(otbComputeHistoFilterNew);
REGISTER_TEST(otbComputeHistoFilter);
REGISTER_TEST(otbComputeGainLutFilterNew);
REGISTER_TEST(otbApplyGainFilterNew);
REGISTER_TEST(otbCLHistogramEqualizationFilterNew);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment