Skip to content

Python code examples for file IO in xml and yml format - #14666

Merged
alalek merged 12 commits into
opencv:3.4from
ihsan314:file_io_xml_yml
Jan 12, 2020
Merged

alalek merged 12 commits into
opencv:3.4from
ihsan314:file_io_xml_yml

Conversation

@ihsan314

@ihsan314 ihsan314 commented May 28, 2019 •

Copy link
Copy Markdown
Contributor

resolves #14665

This pullrequest changes

the fact that Python tutorials do not exist for File Input Output with XML and YML.

force_builders=Docs

@alalek

alalek commented May 31, 2019

Copy link
Copy Markdown
Member

Thank you for contribution!

Please add fixes to make "Docs" builder green.

@asmorkalov
asmorkalov requested a review from alalek November 6, 2019 06:41
@asmorkalov

Copy link
Copy Markdown
Contributor

@alalek Docs build is green. Could you look at the patch.

@asmorkalov asmorkalov changed the title File io xml yml Python code examples for file IO in xml and yml format Nov 6, 2019

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

Please follow template of Python samples (wrap this code into "main()" function): https://github.com/opencv/opencv/wiki/Coding_Style_Guide#python-samples

As a documentation/samples improvement this patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

So, please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

import sys

def help(filename):
print (filename, 'shows the usage of the OpenCV serialization functionality.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use normal print from Python3 (+ from __future__ import print_function for Python 2.7).

Also it is better to use docstring.

@ihsan314

ihsan314 commented Nov 6, 2019

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing the pull request. I will work on all the changes by the end of this week.

@asmorkalov

Copy link
Copy Markdown
Contributor

@ihsan314 Do you have any progress on the patch?

@ihsan314
ihsan314 changed the base branch from master to 3.4 November 22, 2019 17:02
@ihsan314

Copy link
Copy Markdown
Contributor Author

I didn't have that much time in the last two weeks, so here they are today. The docstrings will be added hopefully by tomorrow.

@asmorkalov

Copy link
Copy Markdown
Contributor

@ihsan314 Please pay attention on CI status, it still reports some issues with the code.

@ihsan314

ihsan314 commented Dec 23, 2019 •

Copy link
Copy Markdown
Contributor Author

The CI status had only one failed build, and that failed build was on Mac. I fast-forwarded my branch and tried the failed build on my machine. It worked on mine, so I hope it will pass. I also changed the strings to a docstring in the help() method.

@asmorkalov

Copy link
Copy Markdown
Contributor

@ihsan314 Please remove "WIP" from the PR description to trigger CI builds automatically.

@asmorkalov

Copy link
Copy Markdown
Contributor

@alalek could you look at it again.

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Thank you 👍


@add_toggle_python
You can [download this from here
](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/core/file_input_output/file_input_output.py) or find it in the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master

Please use "3.4" in URLs (as patch is targeted to 3.4 branch).

@alalek
alalek merged commit 2c21ea2 into opencv:3.4 Jan 12, 2020
@alalek alalek mentioned this pull request Jan 12, 2020
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Python code examples for file IO in xml and yml format

* Initial "Pythonization" of file_input_output.cpp

* Moved file_input_output.py to correct location

* Nearly done Pythonizing file_input_output.cpp

* Python equivalent of file_input_output.py created

* Started Pythonizing camera_calibration.cpp

* Completed Python tutorial/sample code for file_input_output

* Resolved whitespace issues

* Removed tabs in file_input_output.cpp

* Patched import order and wrapped code in main function

* Changed string to docstring format in help file

* Updated link to Python example code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants