Commit Graph

302 Commits

Author SHA1 Message Date
Alexander Alekhin
1913482cf5 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-11-10 20:50:26 +00:00
Vadim Pisarevsky
11eafca3e2
removed C API in the following modules: photo, video, imgcodecs, videoio (#13060)
* removed C API in the following modules: photo, video, imgcodecs, videoio

* trying to fix various compile errors and warnings on Windows and Linux

* continue to fix compile errors and warnings

* continue to fix compile errors, warnings, as well as the test failures

* trying to resolve compile warnings on Android

* Update cap_dc1394_v2.cpp

fix warning from the new GCC
2018-11-09 00:52:09 +03:00
Alexander Alekhin
b74b05d1b3 Revert CV_TRY/CV_CATCH macros
This reverts commit 7349b8f5ce (partially).
2018-11-08 19:56:52 +03:00
Alexander Alekhin
687fa6a8ca Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-11-02 05:33:35 +00:00
Ilari Venäläinen
e6c41f0de6 Merge pull request #12989 from venalil:fix_thresholded_tiff_read
* Fix reading of black-and-white (thresholded) TIFF images

I recently updated my local OpenCV version to 3.4.3 and found out that
I could not read my TIFF images related to my project. After debugging I
found out that there has been some static analysis fixes made
that accidentally have broken reading those black-and-white TIFF images.

Commit hash in which reading of mentioned TIFF images has been broken:
cbb1e867e5

Basically the fix is to revert back to the same functionality that has been there before,
when black-and-white images are read bpp (bitspersample) is 1.
Without the case 1: this TiffDecoder::readHeader() function always return false.

* Added type and default error message

* Added stdexcept include

* Use CV_Error instead of throw std::runtime_error

* imgcodecs(test): add TIFF B/W decoding tests
2018-11-01 14:34:34 +03:00
Suleyman TURKMEN
4d0ed5c13c Merge pull request #12971 from sturkmen72:upd_imgproc_hpp
* Update imgproc.hpp

* update color conversion codes
2018-10-31 18:08:24 +03:00
Maksim Shabunin
0ccd810738 Fixed several issues found by static analysis 2018-10-25 10:45:59 +03:00
Alexander Alekhin
5115e5decb Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-10-13 16:19:05 +00:00
drkoller
978ad4981e Clean up documentation for imread and imwrite 2018-10-12 17:08:01 -04:00
Alexander Alekhin
690fb0544c Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-10-02 14:31:05 +03:00
Alexander Alekhin
9253e8bda2
Merge pull request #12705 from berak:imread_document_grayscale 2018-09-30 23:59:48 +03:00
berak
df4139d373 document imread grayscale behaviour 2018-09-30 15:22:26 +02:00
Alexander Alekhin
dca657a2fd Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-09-10 00:10:21 +03:00
cyy
286c2c236b Merge pull request #12458 from DEEPIR:3.4
* may be an typo fix

* remove identical branch,may be paste error

* add parentheses around macro parameter

* simplify if condition

* check malloc fail

* change the condition of branch removed by commit 3041502861
2018-09-07 18:43:47 +03:00
Alexander Alekhin
73bfe68821 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-09-07 12:40:27 +03:00
Alexander Alekhin
8a3c394d6a don't use constructors for C API structures 2018-09-06 14:34:16 +03:00
Alexander Alekhin
d74b98c3d9 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-09-04 18:39:03 +00:00
Alexander Alekhin
acce95f446 backport fixes for static analyzer warnings
Commits:
- 09837928d9
- 10fb88d027

Excluded changes with std::atomic (C++98 requirement)
2018-09-04 16:49:42 +03:00
cyy
10fb88d027 Merge pull request #12391 from DEEPIR:master
fix some errors found by static analyzer. (#12391)

* fix possible divided by zero and by negative values

* only 4 elements are used in these arrays

* fix uninitialized member

* use boolean type for semantic boolean variables

* avoid invalid array index

* to avoid exception and because base64_beg is only used in this block

* use std::atomic<bool> to avoid thread control race condition
2018-09-04 16:39:19 +03:00
Alexander Alekhin
20bf7b6a79 imgcodecs(webp): use safe cast to size_t on Win32 2018-09-02 10:00:52 +00:00
Jakub Golinowski
9f1218b00b Merge pull request #11897 from Jakub-Golinowski:hpx_backend
* Add HPX backend for OpenCV implementation
Adds hpx backend for cv::parallel_for_() calls respecting the nstripes chunking parameter. C++ code for the backend is added to modules/core/parallel.cpp. Also, the necessary changes to cmake files are introduced.
Backend can operate in 2 versions (selectable by cmake build option WITH_HPX_STARTSTOP): hpx (runtime always on) and hpx_startstop (start and stop the backend for each cv::parallel_for_() call)

* WIP: Conditionally include hpx_main.hpp to tests in core module
Header hpx_main.hpp is included to both core/perf/perf_main.cpp and core/test/test_main.cpp.
The changes to cmake files for linking hpx library to above mentioned test executalbles are proposed but have issues.

* Add coditional iclusion of hpx_main.hpp to cpp cpu modules

* Remove start/stop version of hpx backend
2018-08-31 16:23:26 +03:00
Vadim Pisarevsky
4b03a4a841 Merge pull request #12353 from alalek:imgcodecs_fix_webp 2018-08-31 13:03:10 +00:00
Alexander Alekhin
0d4fd20a73 imgcodecs: add null pointer check 2018-08-31 12:56:02 +03:00
Alexander Alekhin
0515f930e8 imgcodecs(webp): multiple fixes
- don't reallocate passed 'img' (test fixed - must use IMREAD_UNCHANGED / IMREAD_ANYCOLOR)
- avoid memory DDOS
- avoid reading of whole file during header processing
- avoid data access after allocated buffer during header processing (missing checks)
- use WebPFree() to free allocated buffers (libwebp >= 0.5.0)
- drop unused & undefined `.close()` method
- added checks for channels >= 5 in encoder
2018-08-30 20:42:33 +00:00
Alexander Alekhin
6356403964 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2018-08-22 17:38:51 +03:00
Colin Smith
76f47548b3 Add export macro for ios conversion functions 2018-08-20 14:10:54 -07:00
pasbi
76eb389761 Merge pull request #12240 from pasbi:pfm_fix
* fixed 64-float pfm auto conversion

* removed trailing whitespace
2018-08-17 18:53:09 +03:00
pasbi
9f5f64e14e Merge pull request #12192 from pasbi:pfm
* created new decoder and encoder for PFM

pfm file format stores binary RGB or grayscale float images.

* added test for pfm codec

* replaced large with short licence header

* little/big-endian-check is now compile time

* fixed width/height confusion, improved big/little endian recognition, fixed scaling issue and Improved signature check

* adapted tests to handle float images well

* removed data-dependency: lena.pfm

the lena image is now loaded is pam and converted to pfm.

* fixed bug in endianess detection macro

* Added endianess detection for android and win

* removed fancy endianess detection

endianess detection will be implemented in cmake scripts soonish.

* fixed minor warnings

* fixed stupid elif defined bug

* silenced some implicit cast warnings

* replaced std::to_string with std::stringstream solution

std::to_string variant did not build on android.

* replaced new endianess macros with existing ones

* improved readability
2018-08-13 13:14:12 +03:00
Maksim Shabunin
cbb1e867e5 More issues found by static analysis 2018-07-24 16:04:42 +03:00
Alexander Alekhin
b09a4a98d4 opencv: Use cv::AutoBuffer<>::data() 2018-07-04 19:11:29 +03:00
Alexander Alekhin
5557474467 imgcodecs(sunras): avoid buffer overrun
`src_pitch` may be large than data `step`
2018-07-02 12:56:50 +03:00
Alexander Alekhin
2f9b4439af Merge pull request #11565 from alalek:issue_11545 2018-05-22 16:00:37 +00:00
Alexander Enaldiev
84584002f2 Merge pull request #11417 from Turim:imgcodecs_cmake_decoders_customize_formats
* imgcodecs cmake: the option to customize supported formats list (WITH_IMGCODEC_HDR, WITH_IMGCODEC_SUNRASTER, WITH_IMGCODEC_PXM)

* imgcodecs: fixes

- fixed CMake scripts (=OFF doesn't really work)
- restore dropped GDCM block
- added _IMGCODEC_ prefix
- fixed tests
- include PAM format under WITH_IMGCODEC_PXM option
2018-05-22 15:10:15 +00:00
Alexander Alekhin
35a4551609 imgcodecs: fix imwrite handling of different OutputArray types 2018-05-22 13:57:51 +03:00
Alexander Alekhin
76ac7ab4ef imgcodecs: added test for imwrite parameter types
issue 11545
2018-05-22 13:55:14 +03:00
Alexander Alekhin
f8252702a8 3rdparty: integrate libjpeg-turbo build scripts into OpenCV 2018-05-11 18:29:57 +03:00
Alexander Alekhin
6b581c4e51 build: unreachable code after CV_Error() (part 2) 2018-04-24 16:03:40 +03:00
Alexander Alekhin
576d2dbac0 refactor: don't use CV_ErrorNoReturn() internally 2018-04-24 15:38:42 +03:00
Vadim Pisarevsky
72cb06abf0 Merge pull request #11231 from saskatchewancatch:tiff-dpi-feature 2018-04-09 13:28:08 +00:00
Alexander Alekhin
a22ee76b45 imgcodecs: exclude rle8.bmp from GDAL tests
GDAL message:
- ERROR 1: The BMP file is probably corrupted or too large. Image width = 480
2018-04-09 13:18:33 +03:00
Rajkiran Natarajan
4668836071 Support for setting TIFF DPI info in imwrite 2018-04-04 21:20:16 -07:00
catree
a885480c9e Remove temporary file used for test. 2018-03-29 18:34:30 +02:00
RAJKIRAN NATARAJAN
6d83a80385 Merge pull request #11176 from saskatchewancatch:issue-11165
* fix cv::imwrite to allow cv::UMat and vectors of it to be written

* cv::imwrite failure handling improvements

* Unit test for regression testing imwrite support for and fix whitespace
2018-03-29 16:47:31 +03:00
Alexander Alekhin
a91953b15c imgcodecs: apply CV_OVERRIDE/CV_FINAL 2018-03-28 17:57:59 +03:00
Maksim Shabunin
7c855aa3e1 Fixed two issues found by static analysis 2018-02-26 00:16:02 +03:00
Maksim Shabunin
92e9d4ec3a Fixed several issues detected by static analysis 2018-02-22 17:11:33 +03:00
Alexander Alekhin
6e8241b78d imgcodecs: fix RBaseStream hang on truncated inputs 2018-02-21 13:17:18 +03:00
Rostislav Vasilikhin
27b1f8f446 imwrite for multipage images implemented 2018-02-20 19:08:45 +03:00
Vadim Pisarevsky
120b7a61c3 Merge pull request #10745 from terfendail:tiff_fix 2018-02-20 14:47:13 +00:00
Vitaly Tuzov
24ee7b5080 Fix for vertically flipped tiff files reading 2018-02-19 18:49:19 +03:00
Alexander Alekhin
c020a7bb67 build: portable integer types 2018-02-15 23:43:02 +03:00
luz.paz
d05714995c Misc. modules/ cont. pt2
Found via `codespell`
2018-02-13 11:28:11 -05:00
Alexander Alekhin
4a297a2443 ts: refactor OpenCV tests
- removed tr1 usage (dropped in C++17)
- moved includes of vector/map/iostream/limits into ts.hpp
- require opencv_test + anonymous namespace (added compile check)
- fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions
- added missing license headers
2018-02-03 19:39:47 +00:00
Alexander Alekhin
f056e713c3 Merge pull request #10512 from sturkmen72:update_documentation 2018-01-18 04:44:59 +00:00
Maksim Shabunin
8b87c4b96a Fixed several warnings produced by clang 6 and static analyzers 2018-01-16 15:26:28 +03:00
Suleyman TURKMEN
dcd4f8f5db Update documentation 2018-01-12 22:21:14 +03:00
Alexander Alekhin
73316e10a0 java(test): fix test names 2018-01-12 19:14:00 +00:00
Alexander Alekhin
f943261847 Merge pull request #10566 from alalek:jasper_checks 2018-01-10 10:15:41 +00:00
Alexander Alekhin
435a3e337b imgcodecs: add more Jasper checks for supported and tested cases 2018-01-09 19:06:03 +03:00
Alexander Alekhin
8a76fadaa3 imgcodecs: add overflow checks 2018-01-09 18:05:24 +03:00
Alexander Alekhin
be5247921d imgcodecs: remove assert() usage 2018-01-09 17:49:38 +03:00
Alexander Alekhin
f0453bd853 build: eliminate warning
warning: 'layout.channel_layout::gchan' may be used uninitialized in this function [-Wmaybe-uninitialized]
2018-01-05 04:33:30 +00:00
Coralie RACHEX
16821b877c Merge pull request #10493 from RachexCoralie:tiff32FC1Codec
* Load and save tiff images in CV_32FC1 format (1 channel of floats).

* Add test

* Fix error handling and resources leak. Improve test.
2018-01-04 15:51:58 +03:00
Alexander Alekhin
4ca89db22d imgproc(hdr): fix bounds check in HdrDecoder::checkSignature() 2018-01-01 13:12:21 +00:00
Alexander Alekhin
ec32022bdf
Merge pull request #10444 from alalek:fix_asan_imgcodecs 2017-12-28 18:28:29 +03:00
Vinay Sharma
5aac909046 Merge pull request #10352 from vinay0410:write_pbm
* added write as pbm

* add tests for pbm

* imgcodecs: PBM support

- drop additional PBM parameters
- write: fix P1/P4 mode (no maxval 255 value after width/height)
- write: invert values for P1/P4
- write: P1: compact ASCII mode (no spaces)
- simplify pbm test
- drop .pxm extension (http://netpbm.sourceforge.net/doc/ doesn't know such extension)
2017-12-28 17:28:34 +03:00
Alexander Alekhin
4f6c493b87 imgcodecs(png): resolve ASAN issue with vars scope and setjmp() call 2017-12-28 02:43:07 +00:00
Tomoaki Teshima
fe7b3f1228 clean up the code
* disable the warning in CMake, not int the code using pragma
2017-12-22 08:42:21 +09:00
Alexander Alekhin
7bbe1a53cf imgcodecs(pxm): fix memcpy size 2017-12-21 01:10:24 +00:00
zhijackchen
6df8ac0342 Merge pull request #10283 from zhijackchen:exr_export
* Fix issue #10114
Convert table change
From:
CV_8U -> HALF
CV_8S -> HALF
CV_16U -> UINT
CV_16S -> UINT
CV_32S -> UINT
CV_32F -> FLOAT
To:
CV_8U -> HALF
CV_8S -> HALF
CV_16U -> UINT
CV_16S -> FLOAT
CV_32S -> FLOAT loss precision
CV_32F -> FLOAT
Signed integer can't be presented well with UINT. Even adjust bias, CV16S and CV32S will be confused when load from exr file.
Also fix CV_8S negative value incorrect bug

* EXR import and export
imread() from EXR returns CV_32F only
imwrite() accepts CV_32 cv::Mat only and stores FLOAT images by default. Add imwrite() flag to store in HALF format.

* fix compiling error

* clean up

* fix EXR import issues
2017-12-15 12:23:44 +03:00
Vitaly Tuzov
51cb56ef2c Implementation of bit-exact resize. Internal calls to linear resize updated to use bit-exact version. (#9468) 2017-12-13 15:00:38 +03:00
Maksim Shabunin
7349b8f5ce Build for embedded systems 2017-12-11 13:27:37 +03:00
Maksim Shabunin
7eb1065944 Fixed/disabled warnings produced by GCC 7 2017-11-29 17:21:22 +03:00
gdkessler
2674c6b5e0 Merge pull request #10093 from gdkessler/gdal_image_read_fix_10089
Fix GDAL image decoding color problems identified by issue #10089, by: (#10093)

* Fix GDAL image decoding color problems identified by issue #10089, by:

Fixing CV_8UC1 symbol, which should be CV_8UC3 for RGB GDAL color table images.

Fixing image.ptr<VecX>(row,col)[] to be (*image.ptr<VecX>(row,col))[] to correctly access VecX array elements, as ptr<VecX>() returns a pointer to the VecX, not the first element of VecX. This fixes the color problem with color table gif images, and avoids out-of-bounds memory access.

Respecting the color identification of raster bands provided by the GDAL image driver, and produce BGR or BGRA images. Note that color bands of images using the HSL, CMY, CMYK, or YCbCr color space are ignored, rather than converting them to BGR.

* When reading image files using the GDAL decoder, exit with an error if a color band is encountered that isn't used (eg. from CMYK or YCbCbr), rather than silently ignoring the band's data.
2017-11-20 15:07:24 +03:00
Suleyman TURKMEN
e51a8e047c update grfmt_gdal.cpp 2017-11-08 17:47:43 +03:00
Suleyman TURKMEN
d1c5e79ec3 Update grfmt_gdal.cpp 2017-10-22 19:01:34 +03:00
blendin
08a5fe3661 Fix out of bounds write 2017-10-21 12:12:53 -07:00
berak
089aac61f3 imgcodecs: fix 4 reading channel bmp images 2017-10-01 15:32:55 +02:00
blendin
c58152d94b Fix out of bounds write 2017-09-26 23:04:01 -07:00
Alexander Alekhin
08b5dc64af imgcodecs(tiff): drop legacy code
Drop code under *undefined* HAVE_TIFF
(violates several policies, like a way to turn off tiff support)
2017-09-24 22:36:17 +00:00
Alexander Alekhin
597b3f4456 Merge pull request #9580 from mshabunin:fix-static-6 2017-09-09 19:31:21 +00:00
Alexander Alekhin
9c973144d8 Merge pull request #9595 from paroj:imreadmulti_py 2017-09-08 14:03:03 +00:00
Pavel Rojtberg
2d34443834 python: imreadmulti - add CV_OUT so it is correctly wrapped 2017-09-08 15:09:25 +02:00
Maksim Shabunin
248e2c7d47 Fixed some issues found by static analysis 2017-09-08 12:22:12 +03:00
saskatchewancatch
4832c24ef7 Allow TIFF min=white PHOTOMETRIC interpretation images to be read unchanged 2017-09-05 21:43:33 -06:00
Alexander Alekhin
8f05126619 imgcodecs: fix regression 9376 2017-08-29 13:31:26 +03:00
Alexander Alekhin
91f680aff6 Merge pull request #9448 from alalek:issue_9443 2017-08-24 16:05:08 +00:00
Alexander Alekhin
cc5da83474 Merge pull request #9252 from jbms:fix/tiff-in-memory 2017-08-24 15:33:48 +00:00
Alexander Alekhin
c515e878ab build: eliminate Win32 warnings 2017-08-24 16:07:12 +03:00
Alexander Alekhin
aacae20657 imgcodesc: fix code problems with integer overflow / address arithmetic / UB 2017-08-23 17:27:27 +03:00
Alexander Alekhin
f0fb665407 Merge pull request #9376 from alalek:imgcodecs_refactoring 2017-08-22 16:32:47 +00:00
Alexander Alekhin
b6949c5088 cmake: CMP0022 NEW 2017-08-19 15:15:05 +00:00
Alexander Alekhin
78a310630f imgproc(test): add checks for remove() call 2017-08-16 18:56:42 +03:00
Alexander Alekhin
999f41fb4f imgcodecs: refactoring, improve code quality 2017-08-16 18:56:41 +03:00
Jeremy Maitin-Shepard
350d483a70 grfmt_tiff: support in-memory TIFF encoding and decoding
Previously, only file-based encoding and decoding were supported with
the libtiff library, leading to the possible use of temporary files.

This fixes issue #8483.
2017-07-31 10:22:11 -07:00
Jeremy Maitin-Shepard
2be955a0ef loadsave: check for errors when using temp file
Previously, the return value of fwrite and fclose were not properly
checked, leading to possible silent truncation of the data if writing
failed, e.g. due to lack of disk space.

Fixes issue #9251.
2017-07-31 09:02:42 -07:00
Alexander Alekhin
602f047fe8 build: replace WIN32 => _WIN32 2017-07-25 13:30:48 +03:00
Alexander Alekhin
a4a47b538c build: detect Android via '__ANDROID__' macro
https://sourceforge.net/p/predef/wiki/OperatingSystems
2017-07-10 12:43:59 +03:00
Maksim Shabunin
e0393f8557 Fixed some issues found by static analysis (4th round) 2017-06-30 12:26:53 +03:00
Maksim Shabunin
a769d69a9d Fixed several issues found by static analysis 2017-06-28 18:06:18 +03:00