QGIS Mean Shift Segmentation
Mantis Issue 891, reported by cbrenner, assigned to jmichel, created: 2014-02-14
I wanted to do a Mean Shift Segmentation (large-scale) using the Orfeo Toolbox within QGIS. The process stopps and gives me this error:
2014 Feb 14 13:19:16 : Application.logger (FATAL) The following error occurred during application execution : ..\\..\\..\\..\\src\\OTB\\Applications\\Segmentation\\otbSegmentation.cxx:503:
itk::ERROR: Fatal error caught. Aborting...
I installed QGIS and the otb_bin from OSGEO4W. Is it possible that there is some part or link missing?
2014-02-14 13:36 - jguinet: Please give us little bit more details related to your problem (inputimage type , processing parameters, ... )
2014-02-14 13:46 - cbrenner: I had a .jp2 image which i first converted to a .tif using sdkshell.bat. then i imported the .tif file and wanted to do a mean shif segmentation (large scale, vector output). I left all parameters with their default values and ran the segmentation. a error window pops up saying that the output vector file could be opened "which probably indicates that they were not correctly produced by the executed algorithm". The log file shows the following:
Algorithm Mean Shift segmentation (large-scale, vector output) starting...
C:/OSGeo4W\\bin\\otbcli_Segmentation
-filter meanshift -in
"C:/Users/h0540603/Orthofoto.tif"
-filter.meanshift.spatialr
5
-filter.meanshift.thres
0.1
-filter.meanshift.ranger
15
-filter.meanshift.minsize
100
-filter.meanshift.maxiter
100
-mode.vector.stitch
true
-mode.vector.minsize
1
-mode.vector.simplify
0
-mode.vector.layername
layer
-mode.vector.tilesize
1024
-mode.vector.startlabel
1
-mode.vector.outmode
ulco
-mode vector -mode.vector.out
"C:\Users\h0540603\AppData\Local\Temp\processing\5f7d32f8c4ac417baf8f12b9870b30e3\modevectormode.vector.out.shp"
2014 Feb 14 13:43:37 : Application.logger (FATAL) Image projection reference
LOCAL_CS["This file was created with the ECW JPEG 2000 SDK build 3.3.0.160 copyright 1998-2005 by ER Mapper. This GeoJP2 header was translated from the following ER Mapper style registration information:
fOriginX: 55000.000000
fOriginY: 360000.000000
fCellIncrementX: 0.200000
fCellIncrementY: ",
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
2014 Feb 14 13:43:37 : Application.logger (FATAL) The following error occurred during application execution : ..\..\..\..\src\OTB\Applications\Segmentation\otbSegmentation.cxx:503:
itk::ERROR: Fatal error caught. Aborting...
Converting outputs
Loading resulting layers
Algorithm Mean Shift segmentation (large-scale, vector output) finished
2014-02-14 13:51 - cbrenner: In the processing options the Orfeo Toolbox is activated. There are four subfolders of which two have a specified path.
Toolbox:
- Geoid file
- OTB applications folder --> C:/OSGeo4W/apps\orfeotoolbox\applications
- OTB command line tools folder --> C:/OSGeo4W\bin
- SRTM tiles folder
2014-02-14 14:01 - jguinet: could it be possible to try with .sqlite outvector format:
-mode vector -mode.vector.out "C:\Users\h0540603\AppData\Local\Temp\processing\5f7d32f8c4ac417baf8f12b9870b30e3\modevectormode.vector.out.sqlite"
and give gdalinfo C:/Users/h0540603/Orthofoto.tif output
2014-02-17 09:53 - cbrenner: first, thanks for your help.
I changed the output format to .squite. by running mean shift segmentation the same error occured. Can you explain me what you mean by giving gdalinfo C:/Users/h0540603/Orthofoto.tif output? if I open the prompt I can display the gdalinfo of C:/Users/h0540603/Orthofoto.tif. how can I give gdalinfo the path above? do i have to give it the path in advance?
is it possible that there is missing some component? I downloaded QGIS via OSGEO4W and included the three otb-packages.
thanks
2014-02-26 16:48 - cbrenner: I still get an error with mean shift segmentation. if i extract a ROI using OTB the new image looses its correct position and is displayed with an origin of 0,0. in this case mean shift segmentation works. if i use the "original" image (tif) i get an error, which could be related to the .tif formt. my orginal data format is jp2 and i uncompressed it using the ECW JPEG 2000 SDK. now the log shows this error: 2014 Feb 26 16:38:59 : Application.logger (FATAL) Image projection reference
LOCAL_CS["This file was created with the ECW JPEG 2000 SDK build 3.3.0.160 copyright 1998-2005 by ER Mapper. This GeoJP2 header was translated from the following ER Mapper style registration information:
fOriginX: 25000.000000
fOriginY: 335000.000000
fCellIncrementX: 0.200000
fCellIncrementY: ",
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
2014 Feb 26 16:38:59 : Application.logger (FATAL) The following error occurred during application execution : ..\..\..\..\src\OTB\Applications\Segmentation\otbSegmentation.cxx:503:
itk::ERROR: Fatal error caught. Aborting...
2014-02-26 16:49 - cbrenner: is there a possibiity to work directly with the jp2 format?
2014-03-03 14:17 - msavinaud: Could you send us the output of otbcli_ReadImageInfo on your original image please?
2014-03-05 09:40 - cbrenner:
Image general informations:
Number of bands : 3
Start index : [0,0]
Size : [12500,12500]
Origin : [55000,360000]
Spacing : [0.2,-0.2]
Estimated ground spacing (in meters): [3303.91,1364.13]
Image acquisition informations:
Sensor :
Image identification number:
Image projection : LOCAL_CS["This file was created with the ECW JPEG 2000 SDK build 3.3.0.160 copyright 1998-2005 by ER Mapper. This GeoJP2 header was translated from the following ER Mapper style registration information:
fOriginX: 55000.000000
fOriginY: 360000.000000
fCellIncrementX: 0.200000
fCellIncrementY: ",
UNIT["unknown",1]]
Image default RGB composition:
[R, G, B] = [0,1,2]
Ground control points information:
Number of GCPs = 0
GCPs projection =
Output parameters value:
indexx: 0
indexy: 0
sizex: 12500
sizey: 12500
spacingx: 0.200000003
spacingy: -0.200000003
originx: 55000
originy: 360000
estimatedgroundspacingx: 3303.908691
estimatedgroundspacingy: 1364.13147
numberbands: 3
sensor:
id:
time:
ullat: 0
ullon: 0
urlat: 0
urlon: 0
lrlat: 0
lrlon: 0
lllat: 0
lllon: 0
town:
country:
rgb.r: 0
rgb.g: 1
rgb.b: 2
projectionref: LOCAL_CS["This file was created with the ECW JPEG 2000 SDK build 3.3.0.160 copyright 1998-2005 by ER Mapper. This GeoJP2 header was translated from the following ER Mapper style registration information:
fOriginX: 55000.000000
fOriginY: 360000.000000
fCellIncrementX: 0.200000
fCellIncrementY: ",
UNIT["unknown",1]]
keyword:
gcp.count: 0
gcp.proj:
gcp.ids:
gcp.info:
gcp.imcoord:
gcp.geocoord:
2014-03-05 09:51 - cbrenner: this is the ImageInfo of the original image. the problem must be related to the local coordinate system? do you have any idea how to overcome this problem? thanks
2014-03-05 10:03 - msavinaud: Indeed, your projection is quite strange, I am not sure that we support it. You can use the extended filename mechanism to unused it in OTB. Take a look to ExtendedFileName. You can try for example: Path/Image.ext?&skipcarto=true in the filename input
2014-03-05 13:46 - cbrenner: Do you mean that I can write:
otbcli_Segmentation -input.jp2?&skipcarto=true -mode vector -mode.vector.out output.sqlite -filter meanshift
I tried this but it returns that skipcarto is not known.
2014-03-05 13:50 - jmalik: Better try :
otbcli_Segmentation -in "input.jp2?&skipcarto=true" -mode vector -mode.vector.out output.sqlite -filter meanshift
2014-03-05 14:57 - cbrenner: The segmentation works with the quotes, but the segmented image now has a much bigger extent than the original image. the input covers an area of 2,5 x 2,5 km but the output vector covers an area of 12,5 x 12,5 km. so, the image somehow expanded. can this be related to the compression of the input image? i had a jp2 image which i uncompressed to tif (both have the same extent).
2014-03-05 15:08 - jmalik: When using skipcarto=true, you are telling OTB to forget about coordinate system and work in image pixel coordinates.
Your output vector does not cover 12,5 km². Its geometries have coordinates corresponding to your input image pixels (from 0 to 12500).
I guess your image is 12500 pixels x 12500 pixels.
Seeing the metadata in your CRS :
fCellIncrementX: 0.200000
I understand your image has pixels of 0.2 meters square.
12500 pixels then amounts to 2.5 km.
The issue is in the configuration of the tool you use to display the image and the vector data.
2014-03-05 17:47 - cbrenner: if i use qgis is it possible to define the origin and the cellsize? should i do this in qgis or in advance using otb (if possible)?
2015-04-17 10:07 - jmichel: Do you still have the issue with new versions of OTB and Qgis ?