Hi,
Here is a minimal code that reproduce the error.
The exact commands I typed for my testings are following:
otbcli_ExtractROI -in 20120814_ZE_FUS_sudest_24bitscolor.img -out
crop_0_0.tif -startx 0 -starty 0 -sizex 1701 -sizey 1782
otbcli_Rasterization -in MR_160sh5.shp -out test2.tif -im crop_0_0.tif
-mode attribute -mode.attribute.field "ID"
Where 20120814_ZE_FUS_sudest_24bitscolor.img is a Pleiades image
and MR_160sh5.shp is one of the two shapefiles. Both shapefiles and the
image were produced by colleagues, I can ask them about how they did the
segmentations.
I also tried to do the same processes with ogr/gdal, the commands are:
ogr2ogr -clipsrc 1050016 6847483 1050116 6847583 extract.shp
sertit_classification_2012_ZoneSE.shp
gdal_rasterize -a ID -te 1050016 6847483 1050116 6847583 -ts 200 200 -ot
Uint32 sertit_classification_2012_ZoneSE.shp crop.tif
Coordinates are given in the same projection as the input image, and the
results are consistent in both Monteverdi and QGIS.
Le mardi 6 mai 2014 20:29:43 UTC+2, Rashad a écrit :
>
>
>
>
> On Tue, May 6, 2014 at 3:03 AM, Bruno Belarte
> <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> Here is a short extract of one of the shapefiles. I tested it again with
>> my code and it still failed with the error itk::ERROR:
>> LabelObjectToPolygonFunctor(0x7fff1701bc00): End point not with +/-1
>> line from line
>>
>> I am not able to reproduce this error. Could you post a more complete
> code.?
> and the exact command line you used for:
> rasterization
> segmentaion
>
>
>> Le vendredi 2 mai 2014 19:12:01 UTC+2, Rashad a écrit :
>>>
>>>
>>> Hi,
>>>
>>> On Fri, May 2, 2014 at 8:51 AM, Bruno Belarte <[email protected]>wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> I have a piece of code that behaves differently with differents
>>>> segmentations. The problematic piece of code can be found here:
>>>> http://pastebin.com/Gfa9TdPb
>>>>
>>>> Segmentation 1: LabelImage generated with the large scale meanshift
>>>> framework from a Pleiades image (pan-ms fusion)
>>>> Segmentation 2 and 3: two LabelImage generated with the
>>>> otbcli_Rasterization application from two different shapefiles
>>>>
>>>>
>>> Is it possible for you to provide your data to test?. shapefiles would
>>> be fine.
>>>
>>>
>>>> With segmentation 1 everything works fine: the LabelMap and the
>>>> corresponding polygons are computed and can be used further in the code.
>>>> With segmentation 2 and 3 the code failed at line 19 with the following
>>>> error:
>>>> /home/belarte/OTB/src/OTB/Utilities/ITK/Modules/Core/
>>>> Common/src/itkMultiThreader.cxx:359:
>>>> itk::ERROR: MultiThreader(0x1cdcf90): Exception occurred during
>>>> SingleMethodExecute
>>>> /home/belarte/OTB/src/OTB/Code/OBIA/otbLabelObjectToPolygonFunctor
>>>> .txx:559:
>>>> itk::ERROR: LabelObjectToPolygonFunctor(0x7fff1701bc00): End point not
>>>> with +/-1 line from line
>>>>
>>>> The program crashes while computing the polygons from the LabelImage.
>>>> My guess was that some of the polygons in the shapefile were problematic,
>>>> so I tried to simplify the polygons with the ogr2ogr application with
>>>> different *simplify* parameters (0.001 0.01 0.1 0.5 and 0.75) and then
>>>> use the rasterization application but it did not change the result. I also
>>>> try to use the otbcli_LSMSSmallRegionsMerging with different mininmum
>>>> region sizes (10 15 20 100 and 1000) after the rasterization, but again no
>>>> changes.
>>>>
>>>> Does someone have an idea of what could be the problem here?
>>>>
>>>> Thanks for your help,
>>>>
>>>> Bruno
>>>>
>>>> --
>>>> --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Rashad
>>>
>> --
>> --
>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Regards,
> Rashad
>
--
--
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.
/**
* \file test.cpp
*
* \date 7 mai 2014
* \author Bruno Belarte
*/
#include "otbImageFileReader.h"
#include "otbLabelImageToLabelMapWithAdjacencyFilter.h"
#include "otbShapeAttributesLabelMapFilter.h"
#include "otbLabelImageToOGRDataSourceFilter.h"
#include "otbImage.h"
#include "otbAttributesMapLabelObjectWithClassLabel.h"
#include "otbLabelMapWithAdjacency.h"
int main()
{
static const unsigned int Dimension = 2;
typedef unsigned int LabelType;
typedef otb::Image<LabelType, Dimension> LabelImageType;
typedef otb::AttributesMapLabelObjectWithClassLabel<LabelType, Dimension, double, int> LabelObjectType;
typedef otb::LabelMapWithAdjacency<LabelObjectType> LabelMapWithAdjacencyType;
std::string m_SegName("/mnt/data2/bruno/crop.tif");
LabelMapWithAdjacencyType::Pointer m_LabelMap;
m_LabelMap = LabelMapWithAdjacencyType::New();
OGRRegisterAll();
typedef otb::ImageFileReader<LabelImageType> FileReaderType;
FileReaderType::Pointer reader = FileReaderType::New();
reader->SetFileName(m_SegName);
typedef otb::LabelImageToLabelMapWithAdjacencyFilter<LabelImageType, LabelMapWithAdjacencyType> LabelImageToLabelMapWithAdjacencyFilterType;
LabelImageToLabelMapWithAdjacencyFilterType::Pointer adjacencyConverter = LabelImageToLabelMapWithAdjacencyFilterType::New();
adjacencyConverter->SetInput(reader->GetOutput());
typedef otb::ShapeAttributesLabelMapFilter<LabelMapWithAdjacencyType> LabelMapWithAdjacencyFilterType;
LabelMapWithAdjacencyFilterType::Pointer labelMap = LabelMapWithAdjacencyFilterType::New();
labelMap->SetInput(adjacencyConverter->GetOutput());
labelMap->SetReducedAttributeSet(false);
// Copy the output into the local label map.
labelMap->Update();
m_LabelMap->Graft(labelMap->GetOutput());
m_LabelMap->SetAdjacencyMap(adjacencyConverter->GetOutput()->GetAdjacencyMap());
typedef otb::LabelImageToOGRDataSourceFilter<LabelImageType> LabelImageToOGRDataSource;
LabelImageToOGRDataSource::Pointer i2ogr = LabelImageToOGRDataSource::New();
i2ogr->SetInput(reader->GetOutput());
i2ogr->Update();
otb::ogr::Layer result = i2ogr->GetOutput()->GetLayerChecked(0);
return 0;
}