New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ld: library not found for -lopencvcapi #1
Comments
I got it to pass that point by linking directly to the repo build folder (rather than the .dub/packages folder) but now it's having problems location -lopencv |
Can you try -lopencv4. |
Do you have a pkgconfig file pointing to your opencv build? |
You mean like this: This returns an error too unfortunately: Thanks for the quick reply! |
No pkgconfig file, but maybe I should create one.. thanks! |
If you build and run any example code with success, can you please share your configuration* and steps to do it on OSX? |
Yes ok cool I will, how do I go about adding an extra directory in the dub.json for -lopencv4 or -lopencv? Like this? |
I ve just booted my pc from ubuntu partition. this is my exact and entire dub.json for compiling my tests: { and there are copies of both libopencvcapi.a and libopencvcapi_contrib.a in the root folder of mytest app (right next to dub.json). While building opencv from source I forgot adding a cmake flag to generate a pkgconfig file so I created one in /usr/lib/pkgconfig/opencv.pc like: prefix=/usr/local Name: opencv These are enough for linux. But I have never tried it on OSX. It's been some time since I touched a mac. And the idea is that in opencvd's dub.json there is a key "libs-posix": ["opencv", "opencvcapi", "opencvcapi_contrib"]. I assume that this covers osx also (I am not sure if libs-osx or libs-mac are also valid keys). In this key, "opencv" value is handled by pkgconfig. so, if you have opencv4.pc file in /usr/lib/pkgconfig/ then it should be "opencv4". Thats what I know so far. |
This is slowly killing me, I might just program in C++ or install Linux :( Eventually, after not being able to find opencv(4).pc I installed opencv with homebrew then I could find it in: /usr/local/lib/pkgconfig/opencv4.pc But, alas, I have no idea how to link to it in the dub.json file :( |
I could find access to a mac temporarily. I am building opencv now. I will try to run an example, and report my experience soon. |
Look in the |
I have successfully compiled and run a test example on Sierra 10.12.5. I followed opencv build guide from https://www.learnopencv.com/install-opencv-4-on-macos/. I skipped the steps related with python and virtual env. Please note that this guide doesn't install opencv to the systems locations. My cmake command was like: I installed dub and ldc using homebrew. Before compiling any code:
Than build opencvcapi and opencvcapi_contrib using cmake and make commands following the ubuntu guide replace this line in dub.json of opencvd: Copy libopencvcapi_contrib.a and libopencvcapi.a to the root of your example app. This is dub.json of example app:
|
Hey guys, thanks again for all the help (I've reinstalled OpenCV on OSX & also on a Devuan system) and the examples are running it's just the linking that I'm having problems with... When you say above
Do you mean this part?
Because as far as I can tell the very first long CMake command in your comment above includes the contrib directory! |
I am still getting library not found :/ And the contents of that folder:
|
I think I'll just move over to Ubuntu and use this tutorial: https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/ Thanks for all the help thus far in any case. |
I want to learn if you succeded to compile c api of opencvd located in "opencvd/c" using commands:
I am sorry for asking. At some point, I cannot understand your situation, maybe due to my poor English. Meanwhile I changed dub.json on the git repo to be ""libs-posix": ["opencv4", "opencvcapi", "opencvcapi_contrib"]", please note that it is now "opencv4", not "opencv". And, sometimes when you change some configuration, you may need to manually delete .dub folder in root of both opencvd and your test app. |
Sure, I am using this script currently to install OpenCV: https://github.com/spmallick/learnopencv/blob/master/InstallScripts/installOpenCV-4-on-Ubuntu-18-04.sh However, I added the flag which you gave me Hopefully it will work this time and I can report back when it does (or does not). Unfortunately OpenCV takes a long time to compile on this system, but I do want to be able to use D lang for the first time on this project. Thanks again for all your help! |
Ok, I was still having problems with the last line here: The error is the same as before:
So I had to specify it directly to the cmake call (rather than export OpenCV_DIR=/...): That worked so I could run the final Which also worked. So then in my example application I ran dub init, added opencvd as a package then, simply, to test I ran But it failed with these errors: So I went to the README.md and made the additions to the dub.json: But the build also failed again with the same error, so I changed the .dub/packages directory to point to the actual opencvd directory: And it removed 2 errors leaving only 1: So, FINALLY, after figuring out what was going on by running: So I simply copied the opencv4.pc file over to one of those directories: And BOOM But, unfortunately, when I copy the contents of opencvd/examples/convexhull.d into my example app.d and try to build it IT WORKS however when it runs I get an error: Which I am not sure about, can I run the examples from the opencvd folder directly? Perhaps I should test a bit more! |
Ok, I got it all working thanks be to God! I stumbled upon this unix command "ldconfig" from here: https://unix.stackexchange.com/questions/67781/use-shared-libraries-in-usr-local-lib Finally I ran: And my example app.d containing the convexhull.d code compiles and runs! Thanks a million, I hope this troubleshooting helps the project moving forward 👍 |
Congrats, awesome news! |
Hey buddy, I guess you will do something like a text detection app. Here I put a working example https://github.com/aferust/opencvd/blob/master/examples/text_detection.d. You will need to update opencvd from master, since I ve just pushed some code to run it. |
Thanks man, could be handy, although I am using it for screenshots and somebody has mentioned it was not very good at screenshots here: https://www.pyimagesearch.com/2018/08/20/opencv-text-detection-east-text-detector/ I was using "dhanushka"'s answer from here: https://stackoverflow.com/questions/23506105/extracting-text-opencv/23557702 |
You can use
I have also another project (regionpropsford) that can be used to calculate region properties in binary image (there is an example usage with opencvd on readme of it). |
Thanks for this! I have been enjoying this. There are opencv2 functions which are not exposed in your D wrapper (as far as I can tell). If you gave me brief instructions I could attempt to implement them (if possible). Then, if I accomplished that I could try expose the rest and make a pull request! The two functions I was looking at but could not find in opencvd are: fastNlMeansDenoisingColored & createCLAHE For example when I grep for the first in the opencvd directory: It returns no results however the second does: I can help bring these into the library as payment for the help you have given me if you like? I do not even need them anymore to be frank! If you could point towards something that's similarly exposed in opencvd I'm sure I'd be able to use it to translate more features. 👍 **I see neither of them are in the github.com/hybridgroup/gocv wrapper either unfortunately :( |
Ok, first of all, please share your email 'cause it is redundant to grow this page unnecessarily. You can search opencv function names using github's search in the project feature, although grep is also nice.
in photo_helper.cpp capitalize initial of the func name:
I have named it FastNlMeansDenoising2, because I may wrap the first oveload in the future and just reserve the "FastNlMeansDenoising1".
As you can see, we have set default parameters in d function: That's it. |
Ok perfect, there is no private message function on this is there? Anyway, I will make an attempt at those two functions tomorrow morning and you can take my email from my next message, which I will delete! |
Hey dude, thanks for the wrapper. I'm just coming to terms with D for the first time and in the README of your repository you state "Your build experience may vary. I also need help for automating this. "
I am building on OSX so I'm not sure how to get around my build error but I have put this in my dub.json:
"lflags": ["-L/Users/XXX/.dub/packages/opencvd-0.0.2/opencvd", "-lopencvcapi", "-lopencvcapi_contrib"],
And it seems to be finding the directory just fine (as if I intentionally mistype the directory it throws an error) so I'm wondering if you might have a quick solution? Sorry for making my poor intelligence an issue on your project :/
The text was updated successfully, but these errors were encountered: