Open JanMarvin opened 4 years ago
From the CI, it looks like some of these API's are quite recent and need to be included conditionally to make sure the package can still be built against older versions of libopencv...
I could have a look if my limited c++ knowledge allows me to fix this. I wasn't really sure if this was something you wanted in opencv after all. Just let me know what you're thinking the next steps should be and I'll see what I can do. After all closing and ignoring the pr is always an option 😉
You would have to do a little bit of research or trial-and-error on when the given headers or API calls were introduced and wrap them in macros like so:
Fixed the build. Requires OpenCV 3.4.3 or newer and a build with DNN enabled
But you're not setting HAVE_OPENCV_DNN
anywhere now? So it is disabled for all builds?
It's defined in opencv.hpp.
Note: Since the c++ part is mostly based on a sample file of a BSD licensed library required for linking with your package anyways, I did not add the BSD header to the package LICENSE.md.
Oh sorry I didn't know HAVE_OPENCV_DNN
was defined by the library! So if the library defines that macro, do you still need to check for the version?
Yeah, didn't realize it at first too, but you do not include it in r-backports on windows
So if the library defines that macro, do you still need to check for the version?
Yes, the version check is still required. OpenCV 3.4.1 introduced Have_OPENCV_DNN
, but
cv::dnn::readNet()
was introduced in 3.4.2. Possibly that version is sufficient, but iirc the sample code was included in 3.4.3 and since I didn't want to build 3.4.2 … :smile:
OK. I tried to run the example but I can't find the frozen_east_text_detection.pb
file? Where does this come from?
It's a tensorflow model provided via this dropbox link
Similar to the face detection I created R functions for text_detection, mostly copying around this sample code.
In a fun coding project I use it to obtain positions of text in images. These positions I can use to crop the larger image with
magick
to then usetesseract
socr()
on smaller pieces of the original image. (For more preprocessing amagick2opencv()
and vice versa function would be nice to have!) [Edit:] A conversion function was added in https://github.com/JanMarvin/opencv/tree/conversion