Added resize flag handlers for imread and imdecode | Issue #16203#16309
Added resize flag handlers for imread and imdecode | Issue #16203#16309alalek merged 2 commits intoopencv:3.4from
Conversation
|
Hi @sturkmen72, I have added the handlers as discussed. In addition to this I noticed that color resize was not taking place in case of imread, I fixed that as well. |
|
i believe your addition is not correct ( or unnecessary) |
|
also see https://github.com/opencv/opencv/blob/master/modules/imgcodecs/src/loadsave.cpp#L494 should be added in imdecode |
|
Hi @sturkmen72 thanks for the response, so the addition to imread is not needed? Or even imdecode is not necessary? As mentioned in last comment, do I add that to imdecode? |
alalek
left a comment
There was a problem hiding this comment.
Please add corresponding test for this feature - check that result image size is reduced properly.
|
|
|
@sturkmen72, thanks for that, shall I add that to imdecode as well as you showed earlier? |
|
@ganesh-k13 Please fix warnings from Win32 builder (add |
|
@alalek let me do some tests before merge |
@sturkmen72, do we make this in a different PR, or shall I add it to |
|
Hey @sturkmen72 / @alalek, I'm getting cores if we add that if conditions and try other formats, if that if is not there then resize does not happen but no crash. It involves some work, can I raise a different PR for that, might involve more work. Please advise. |
|
you can add end of imdecode_ |
|
Ohh thanks, I didn't see it was getting freed. I'll add that and test. |
|
@sturkmen72 thanks for the fix, it works. @alalek I have added a case for the same by resizing a PNG to hit that code path. |
|
@sturkmen72 / @alalek, any updates on this one? any changes needed? |
|
Hello @ganesh-k13 The patch looks good to me. I can propose some test code enhancement: OpenCV TS module like Google Test supports parameterized tests (https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#value-parameterized-tests). It means that you can get rid of duplicated blocks of code and run the same test body for JPEG and other image formats. You can look on example in |
|
Thanks for the link @asmorkalov, I'll make those changes |
|
Parametrized tests look like overkill here. Duplicated code and checks may be moved into common function, like this (important note, that return value should be 'void'). |
|
Hi @alalek , @sturkmen72 , @asmorkalov, we can see that imread and imdecode have duplicate code in both test and src. I would suggest we make it a different PR as we have digressed from the initial issue. I can raise a new issue and PR for that. |
|
Hi @alalek , @asmorkalov , I went ahead with refactor of tests anyways. I went with |
|
@ganesh-k13 Well done! Please squash your commits to have clean history and we can merge the patch. @alalek What do you think? |
Undo imread change Added Imread resize tests Added imdecode flags check Added imdecode tests for resize Removed trailing whitespace Removed IMREAD_IGNORE_ORIENTATION check Added else condition Removed IMREAD_IGNORE_ORIENTATION check in decode Added HAVE_JPEG guards Added static_cast for Win32 Added resize for non jpegs Added tests for non jpeg resize case Fixed resize value in assert Changed tests to Value-Parameterized Tests Changed tests to Value-Parameterized Tests | handled >> in cpp Changed tests to Value-Parameterized Tests | removed trailing whitespace
9f4e7ff to
3614b0b
Compare
This pullrequest changes
resolves #16203