imquery() and overloaded imread() functions#17753
imquery() and overloaded imread() functions#17753sturkmen72 wants to merge 2 commits intoopencv:4.xfrom
Conversation
|
@sturkmen72, thank you for the contribution! I think, we should discuss the API. Can you provide a little code snippet how people would use this new functionality? In C++ one of the best approaches would be to create an image iterator. For Python it could be possible to use a similar approach, even though it would not look as idiomatic. Something like that: of course, it would also be possible to create more Pythonic wrapper on top of it, like suggested here, for example: |
|
@vpisarev thank you for your feedback. let me work on the PR a bit more |
|
@sturkmen72 Do you have a chance to finish the PR in meantime? |
|
@asmorkalov , @vpisarev i am still thinking of an effective usage way considering #8511 |
f993d08 to
8613543
Compare
|
A simple review is required before continuing. please forgive my sloppiness i did not look codes of #8511 before. now i am aware both PR has basely similar changes. @brian-armstrong-discord do you have time to look my changes |
0b598c7 to
fd04510
Compare
618f9dd to
0fa2201
Compare
|
@vpisarev, @alalek please take a look at this PR. I know it still need more work but i need to know if i am on the right path. sample usage C++ Python |
8632ad3 to
78364cf
Compare
|
@sturkmen72, thank you for keep working on it. Could you, please, provide some sample code and the test for the functionality? |
|
@sturkmen72, yes, let's discuss it. I sent you e-mail |
samples/python/imquery.py
Outdated
| row = int((page_info1.height - page_info3.height)/2) | ||
|
|
||
| roi = img1[row:row+page_info3.height, column:column+page_info3.width] | ||
| #ret,roi = cv.imread("images.tif", None, cv.IMREAD_REDUCED_COLOR_2, i) |
There was a problem hiding this comment.
you can try the following:
ret,roi = cv.imread("images.tif", None, cv.IMREAD_REDUCED_COLOR_2, i)
img1[row:row+page_info3.height, column:column+page_info3.width] = roi
modules/imgcodecs/src/loadsave.cpp
Outdated
| mats.push_back(page); | ||
| } | ||
| } | ||
| return !mats.empty(); |
There was a problem hiding this comment.
mats shoud not be empty before calling this function
| } | ||
| } | ||
| return !mats.empty(); | ||
| return counter == count; |
There was a problem hiding this comment.
If we asked for more images than multipage page count and we successfully read existing images should this be false ?
modules/imgcodecs/src/grfmt_gdal.cpp
Outdated
| /** | ||
| * try to go to next page | ||
| */ | ||
| bool GdalDecoder::nextPage(){ |
There was a problem hiding this comment.
i think GDAL driver loads only first page of multipage images. i will try to implement GdalDecoder::nextPage() after actual changes seems good.
|
@vpisarev I think I've made significant progress after our meeting. could you review the actual code. |
|
What was expected from this PR was done in #27496 |
proposed solution to #6574 #17862
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.