Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Youssefi
otb
Commits
4dce63d8
Commit
4dce63d8
authored
Jan 29, 2018
by
Guillaume Pasero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DOC: corner cases with Python API
parent
60f840a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
1 deletion
+49
-1
Documentation/Cookbook/rst/recipes/python.rst
Documentation/Cookbook/rst/recipes/python.rst
+49
-1
No files found.
Documentation/Cookbook/rst/recipes/python.rst
View file @
4dce63d8
...
...
@@ -214,4 +214,52 @@ setting the ``field`` parameter:
No metadata in Numpy arrays
^^^^^^^^^^^^^^^^^^^^^^^^^^^
TODO
With the Numpy module, it is possible to convert images between OTB and Numpy
arrays. For instance, when converting from OTB to Numpy array:
* An ``Update()`` of the underlying ``otb::VectorImage`` is requested. Be aware
that the full image is generated.
* The pixel buffer is copied into a ``numpy.array``
As you can see, there is no export of the metadata, such as origin, spacing,
projection WKT. It means that if you want to import back a Numpy array into OTB,
the image won't have any of these metadata. It can be a problem for applications
doing geometry, projections, and also calibration.
Future developments will probably offer a more adapted structure to import and
export images between OTB and Python world.
Setting of boolean parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most of the parameters are set using functions ``SetParameterXXX()``. The boolean
parameters are handled differently (also called Empty parameter). Let's take an example with the application
``ReadImageInfo``:
.. code-block:: python
import otbApplication as otb
app = otb.Registry.CreateApplication("ReadImageInfo")
If you want the get the state of parameter ``keywordlist``, a boolean, use:
.. code-block:: python
app.IsParameterEnabled("keywordlist")
To set this parameter ON / OFF, use the functions:
.. code-block:: python
app.EnableParameter("keywordlist")
app.DisableParameter("keywordlist")
Don't try to use other functions to set the state of a boolean. For instance,
try the following commands:
.. code-block:: python
app.SetParameterInt("keywordlist", 0)
app.IsParameterEnabled("keywordlist")
You will get a state ``True`` even if you asked the opposite.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment