improving functionality of imread
hi all, i want to share my way to use libjpeg loading options. here my addition to source https://github.com/Itseez/opencv/pull...
by this change i can set "scale_denom" parameter and load jpeg images scaled 1/2 - 1/4 - 1/8
also i wonder if it worth to merge to opencv library after revised by opencv gurus here. any comment is welcome
i see 2 problems with that approach:
(major:) a global variable is used to store the scale factor. now, you can never be sure, in what state it is, also, which other part of the codebase has tried to set it before, so you will have to set it every time you try to imread() something. (you might not even know, what's in the filename)
(minor:) your cvSetJpegScale() function is hidden in the deprecated c-api. [in my case, i mostly try to avoid including any of those headers]
@berak thank you for your valuable critique. i changed something. your comments are very welcome
yea, i've seen, that you're trying to move it into an additional param for imread()
but this again has the drawback, that the interfaces will have to change, which breaks binary compatibility (which does not go well with the opencv devs)
also, the param is only valid for jpg images
(again, your effort there is highly appreciated, please don't take this all too negative !!)
@berak did you delete your last comment. i saw it but did not read
well, yes, - temporarily(sorry for confusion) ;) using the imread flags for this seems to be the best idea so far, imho.
(then i was not sure, if the size/allocation would work, but atm, it seems so.)
do you think, there's a way to get rid of the global var and the setter function ?
@berak it is easy to get rid of the global var and the setter function, then BaseImageDecoder class need a new method to set scale_denom value.
@StevenPuttemans Can i get your opinion
@sturkmen, I think @berak somewhat pointed all the critical problems out. But maybe adding an overload function on the imread operation is a better way? This ensures that binary compatibility is not broken.