<https://lh5.googleusercontent.com/-OOj3Bx-I6X8/VAYQYMyiC6I/AAAAAAAAA_g/FhMieKpKL-0/s1600/rr.jpg>
Hi,
I took a snippet from ExtractRoadsByStepExample and altered it slightly.
My aim was to get a natural look copy of my multispectral input image,
viewable as usual 8 BIT RGB-TIFF in any picture viewer. So I selected bands
3,2,1 as RGB and gave it to the writer. But since the image is quite big, I
can watch the resulting TIFF being written in its thumbnail ... it's
streamed in blocks. The problem: each block is differently thresholded!
Here's an example and the snippet:
typedef otb::VectorImage<OutputPixelType, Dimension>
OutputVectorImageType;
typedef otb::ImageFileWriter<OutputVectorImageType>
VectorWriterType2;
typedef otb::VectorRescaleIntensityImageFilter
<MultiSpectralImageType, OutputVectorImageType> VectorRescalerType
;
typedef otb::MultiChannelExtractROI<unsigned char,
unsigned char> ChannelExtractorType;
multispectralReader->GenerateOutputInformation();
OutputVectorImageType::PixelType minimum, maximum;
minimum.SetSize(
multispectralReader->GetOutput()->GetNumberOfComponentsPerPixel
());
maximum.SetSize(
multispectralReader->GetOutput()->GetNumberOfComponentsPerPixel
());
minimum.Fill(0);
maximum.Fill(255);
VectorRescalerType::Pointer vr = VectorRescalerType::New();
vr->SetInput(multispectralReader->GetOutput());
vr->SetOutputMinimum(minimum);
vr->SetOutputMaximum(maximum);
vr->SetClampThreshold(0.01);
ChannelExtractorType::Pointer selecter = ChannelExtractorType::New
();
selecter->SetInput(vr->GetOutput());
selecter->SetExtractionRegion(
multispectralReader->GetOutput()->GetLargestPossibleRegion());
selecter->SetChannel(3);
selecter->SetChannel(2);
selecter->SetChannel(1);
VectorWriterType2::Pointer vect1Writer = VectorWriterType2::New();
vect1Writer->SetFileName(tmpname);
vect1Writer->SetInput(selecter->GetOutput());
vect1Writer->Update();
Would be happy to know if I can avoid this ...
Regards,
Robin
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.