Commit Graph

7 Commits

Author SHA1 Message Date
wzy712
6fed49ef20 core: prefer int64_t over bool in FileStorage::write
The Python binding tries FileStorage::write() overloads in declaration
order. pyopencv_to(bool&) accepts any integer scalar, so values outside
the int32 range were consumed by the bool overload and stored as `true`
in YAML, and as 1 in XML/JSON, even though write(int64_t) is exposed and
all three formats support 64-bit integers.

Declare the int64_t overload before bool.

Add a Python test that writes int32/int64 boundary values and checks the
serialized text for YAML, XML and JSON.
2026-11-25 01:33:14 +08:00
Maxim Smolskiy
77eb6ed52d Merge pull request #26937 from MaximSmolskiy:support-bool-type-for-filestorage-base64
Support bool type for FileStorage Base64 #26937

### Pull Request Readiness Checklist

OpenCV extra: https://github.com/opencv/opencv_extra/pull/1238

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-03-07 08:35:44 +03:00
MaximSmolskiy
1623576a88 Support 32-bit unsigned type for FileStorage Base64 2025-02-06 21:13:34 +03:00
Alexander Alekhin
7ba26ada12 Merge branch 4.x 2021-10-15 21:53:39 +00:00
Smirnov Egor
b42623ff9d port base64 encoding from 3.4 2021-07-08 10:42:44 +03:00
Alexander Alekhin
fc628014bb Merge branch 4.x 2021-04-10 18:03:01 +00:00
Vadim Pisarevsky
5489735258 Merge pull request #17436 from vpisarev:fix_python_io
* fixed #17044
1. fixed Python part of the tutorial about using OpenCV XML-YAML-JSON I/O functionality from C++ and Python.
2. added startWriteStruct() and endWriteStruct() methods to FileStorage
3. modifed FileStorage::write() methods to make them work well inside sequences, not only mappings.

* try to fix the doc builder

* added Python regression test for FileStorage I/O API ([TODO] iterating through long sequences can be very slow)

* fixed yaml testing
2020-06-01 11:33:09 +00:00