# Otb segmentation

**URL:** <https://forum.orfeo-toolbox.org/t/otb-segmentation/89>\
**Category:** OTB Usage\
**Created:** [January 24, 2019, 11:10am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89 "2019-01-24T11:10:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![vana](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vana](https://forum.orfeo-toolbox.org/u/vana)\
**Post date:** [January 24, 2019, 11:10am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/1 "2019-01-24T11:10:51Z")

</div>

Dear all,

i want to perform a object-based-image analysis within QGIS 3.4.4 (Madeira). Therefore i installed and configured the OTB plugin. It is available in my toolbox in QGIS, but each time when i try to run the tool segmentation i receive the error message: wrong or missing parameter value: condition.

I tried to modify my parameters but it doesn’t work.

Might this be due to false chosen parameters, installation problems or the fact that the plugin is still experimental?

I would be very glad to receive an answer soon because time is running (master thesis ☹ )

Thanks in advance,

Vana

---

<div class="post-metadata">

**Author:** ![vana](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vana](https://forum.orfeo-toolbox.org/u/vana)\
**Post date:** [January 24, 2019, 11:16am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/2 "2019-01-24T11:16:03Z")

</div>

@ Julien: Do you mean the tab ‘log’ of the tool segmentation with algorithm configuration window?  
Thw log window is empty (see screenshot)

 ![seg2](https://forum.orfeo-toolbox.org/uploads/default/original/1X/7605302d804a6b6637a886dd7b7efd7b3c10be9f.png)

---

<div class="post-metadata">

**Author:** ![vana](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vana](https://forum.orfeo-toolbox.org/u/vana)\
**Post date:** [January 24, 2019, 11:16am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/3 "2019-01-24T11:16:42Z")

</div>

![seg1](https://forum.orfeo-toolbox.org/uploads/default/original/1X/9f6feb6e8d2bf29fb88318780ab47f614377780d.png)

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [January 24, 2019, 1:07pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/4 "2019-01-24T13:07:12Z")

</div>

Hi Vana,

Yes this is an issue we are trying to solve. You need to manually change the descriptor file!

It should be in PathWhereIsOTB/share/otb/description/Segmentation.txt then change this line :

QgsProcessingParameterString|filter.cc.expr|Condition|None|False|False  
to  
QgsProcessingParameterString|filter.cc.expr|Condition|None|False|True

And you should be good to go!

Antoine

---

<div class="post-metadata">

**Author:** ![vana](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vana](https://forum.orfeo-toolbox.org/u/vana)\
**Post date:** [January 24, 2019, 1:48pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/5 "2019-01-24T13:48:59Z")

</div>

Hej Antoine,  
so the previous error message doesn’t occur anymore. The calculation runs, but there is no result in the end. I attach the algorithm log. Seems that there is a problem with the installation (module missing)?  
Regards,

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [January 24, 2019, 1:58pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/6 "2019-01-24T13:58:58Z")

</div>

It seems that you are giving the wrong path to OTB\_APPLICATION\_PATH. Where is your installation of OTB?  
OTB\_APPLICATION\_PATH should look like this :  
`path_where_is_otb/lib/otb/applications/`

---

<div class="post-metadata">

**Author:** ![vana](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vana](https://forum.orfeo-toolbox.org/u/vana)\
**Post date:** [January 24, 2019, 3:26pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/7 "2019-01-24T15:26:17Z")

</div>

Thank you Antoine for all your support,  
i modified the paths. Now there is no error message anymore, but it runs super long without progress. I think there’s still a installation problem.

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [January 24, 2019, 3:39pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/8 "2019-01-24T15:39:53Z")

</div>

Well that is weird… What is the platform you are using and what version of OTB are you using? Also do you have the error with other application? If you try the Pixelvalue application for instance?

---

<div class="post-metadata">

**Author:** ![vana](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vana](https://forum.orfeo-toolbox.org/u/vana)\
**Post date:** [January 24, 2019, 4:23pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/9 "2019-01-24T16:23:52Z")

</div>

Yes i tried other otb applications, they also don’t work or actually QGIS runs without progress.  
I am using Windows 7 and i downloaded OTB-6.6.1-Win64 from [https://www.orfeo-toolbox.org/download/](https://www.orfeo-toolbox.org/download/)  
and qgis-otb-plugin-master from [https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin](https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin).  
I decompressed both and copied them to C:. The qgis-otb-plugin has been stored in a new folder qgis-plugins.  
Than as in the cookbook [https://www.orfeo-toolbox.org/CookBook/QGIS-interface.html?highlight=qgis](https://www.orfeo-toolbox.org/CookBook/QGIS-interface.html?highlight=qgis) described, i modified the environment variables by creating a new variable QGIS\_PLUGINPATH and set the path to C:\qgis-plugins\qgis-otb-plugin.  
Once QGIS has started, i modified the application folder and otb folder path (Settings \> Options \> Processing \>Provider).  
Did i miss a important step?

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [January 24, 2019, 4:35pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/10 "2019-01-24T16:35:52Z")

</div>

I don’t think so… Have you tried to run directly OTB? like monteverdi or any other application?  
And also are you sure to use the right package for your architecture (x86 or x64)?

---

<div class="post-metadata">

**Author:** ![Helena](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@Helena](https://forum.orfeo-toolbox.org/u/Helena)\
**Post date:** [February 6, 2019, 7:39am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/11 "2019-02-06T07:39:02Z")

</div>

Hi Vana & Antoine,  
did you manage to resolve the issues? I’m having exactly the same problems!

I am trying to run a segmentation meanshift on a tiff image with QGIS and OTB plugin. I downloaded and installed the latest versions of both yesterday.

I was getting the error message the same as Vana, “wrong or missing parameter value:condition” and I have changed the text as suggested by Antoine. That has resolved the error, but I’m not getting a result. When I click on run I get the following log file

Processing algorithm…  
Algorithm ‘Segmentation’ starting…  
Input parameters:  
{ ‘in’ : ‘Y:/GIS/\_WorkingProjects/2018\_PROJECTS/18084\_Drone imagery/Landell41\_Orthomosaic\_FriApr20063532/Landell41\_Orthomosaic\_export\_FriApr20.tif’, ‘filter’ : ‘meanshift’, ‘filter.meanshift.spatialr’ : 5, ‘filter.meanshift.ranger’ : 15, ‘filter.meanshift.thres’ : 0.1, ‘filter.meanshift.maxiter’ : 100, ‘filter.meanshift.minsize’ : 100, ‘mode’ : ‘vector’, ‘mode.vector.out’ : ‘C:/Users/helena.nermut/AppData/Local/Temp/processing\_a5a20cb71194425989dce8f4db5390da/5ea1964361154d7b97ffc4974475bb54/mode.vector.out.file’, ‘mode.vector.outmode’ : ‘ulco’, ‘mode.vector.inmask’ : None, ‘mode.vector.neighbor’ : False, ‘mode.vector.stitch’ : True, ‘mode.vector.minsize’ : 1, ‘mode.vector.simplify’ : 0.1, ‘mode.vector.layername’ : ‘’, ‘mode.vector.fieldname’ : ‘’, ‘mode.vector.tilesize’ : 1024, ‘mode.vector.startlabel’ : 1, ‘mode.vector.ogroptions’ : ‘’ }

I left it running over night (just in case) and it did not progress beyond this point.

The OTB application folder is set to C:/OTB-6.6.1/lib/otb/applications & the OTB folder is set to C:/OTB-6.6.1

Any ideas??  
thanks  
Helena

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [February 6, 2019, 8:58am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/12 "2019-02-06T08:58:00Z")

</div>

Hi Helena,  
Have you tried running directly the Segmentation application in OTB to see whether it is a problem between QGIS and OTB or just OTB?  
Which windows are you on? And what architecture?

---

<div class="post-metadata">

**Author:** ![Helena](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@Helena](https://forum.orfeo-toolbox.org/u/Helena)\
**Post date:** [February 7, 2019, 12:16am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/13 "2019-02-07T00:16:41Z")

</div>

Hi Antoine,  
I’m running windows 10, 64bit. I’ll try running OTB separately and let you know how I go

thanks  
Helena

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [February 7, 2019, 9:08am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/14 "2019-02-07T09:08:09Z")

</div>

Great! I’ll try to reproduce your problem, but I only have a windows 8 and QGIS 3.2.0.

**EDIT** : I have no problem running it with this configuration.  
**EDIT2** : Problem identified with QGIS 3.4.4  
**EDIT3** : The issue is on the qgis\_otb\_cli.bat file. The variable OTB\_LOGGER\_INFO introduce a bug and prevent the plugin to work correctly… This bat file is regenerated by QGIS every time, so we need to modify how it is generated by the otb plugin.

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [February 7, 2019, 6:55pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/15 "2019-02-07T18:55:21Z")

</div>

I have a quick and dirty workaround for now. It seems that the plugin does not behave correctly because of an environment variable…  
To solve the issue what you can do is:

- Find the file `OtbAlgorithmProvider.py` it should be in your otb plugin directory under `otb`.
- Comment line 197 and 198 : they are about a looger :

```python
if OtbUtils.loggerLevel():
  otb_cli_file.write(export_cmd + "OTB_LOGGER_LEVEL=" + "\"" + OtbUtils.loggerLevel() + "\"" + os.linesep)

```

Once those lines are commented re open QGIS and you should be good to go.  
We will find a fix soon and the new master branch of the plugin will be flawless (I hope so!!).

---

<div class="post-metadata">

**Author:** ![Helena](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@Helena](https://forum.orfeo-toolbox.org/u/Helena)\
**Post date:** [February 7, 2019, 11:46pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/16 "2019-02-07T23:46:02Z")

</div>

Hi Antonie,  
thanks so much for your help! I won’t be able to test till next week, but I will let you know how I go.

I also tested segmentation in Monteverdi and it all worked correctly

Thanks again for your help  
Helena.

---

<div class="post-metadata">

**Author:** ![Helena](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@Helena](https://forum.orfeo-toolbox.org/u/Helena)\
**Post date:** [February 11, 2019, 2:21am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/17 "2019-02-11T02:21:40Z")

</div>

Hi Antonie,  
I have the changes you suggested to OtbAlgorithmProvider.py. The OTB segmentation tool now works correctly in QGIS 3.4.4.

thank you very much for your help!

Helena

---

<div class="post-metadata">

**Author:** ![rashad.kanavath](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/r/aeb1de/32.png) [@rashad.kanavath](https://forum.orfeo-toolbox.org/u/rashad.kanavath)\
**Post date:** [February 14, 2019, 1:23pm UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/18 "2019-02-14T13:23:32Z")

</div>

Hi Helena,

You can remove QGIS\_PLUGINPATH variable and re-install plugin from cnes qgis plugin repository. This contains above fix from Antonie and works with QGIS 3.4 upto 3.8

> **[README.md · master · Main Repositories / qgis-otb-plugin](https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin/blob/master/README.md)**
>
> Orfeo ToolBox

Let me if it works for you.

---

<div class="post-metadata">

**Author:** ![Helena](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@Helena](https://forum.orfeo-toolbox.org/u/Helena)\
**Post date:** [February 18, 2019, 12:26am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/19 "2019-02-18T00:26:28Z")

</div>

Thanks Rasad. I will try and get to it in the next couple of days (sorry busy week at work) and let you know how I go  
Helena

---

<div class="post-metadata">

**Author:** ![Helena](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/h/c68b51/32.png) [@Helena](https://forum.orfeo-toolbox.org/u/Helena)\
**Post date:** [February 20, 2019, 2:55am UTC](https://forum.orfeo-toolbox.org/t/otb-segmentation/89/20 "2019-02-20T02:55:43Z")

</div>

Hi Antoine & Rashad,  
I have reinstalled the QGIS plugin and all is working well. Thank you to you both for the quick turn around on this issue. Very much appreciated!!

Cheers  
Helena

[Next page](https://forum.orfeo-toolbox.org/t/otb-segmentation/89.md?page=2)
