I installed Opencv in a Docker container so that I can upload the linux binaries for support a git project that isn't mine. I need it to run python 3.6 and opencv 3.x, which all seems to be working fine. However, the directory containing the cv2 folder only has one .so file: cv2.cpython-36m-x86_64-linux-gnu.so . The project I'm trying to contribute to has the build for opencv py2.7, and that folder has dozens of .so files for many relevant opencv packages, so I feel like something is wrong. Can anyone help?
And here's the link to the project I am trying to add support to.
https://github.com/Miserlou/lambda-packages/tree/master/lambda_packages/OpenCV
Assuming you don't want to unpack the tar, here's how the inside looks for the python 2.7 package
There is nothing wrong as long as you can import it in python and utilize it's functionality. I'm using ROS Kinetic for my research, which comes with a built in release of opencv. It also has just one cv2.so file and it's working perfectly fine.
Related
I am a beginner in Linux and I am trying to do something very basic (yet it does not seem to work).
I have installed a python3 package. I wish to run this Python package on a specific folder from my linux machine. The idea is that this package should restructure all my files in a specific format (this is the link to the package https://github.com/SIMEXP/Data2Bids ).
In the demo of the tutorial, it is mentioned that once I install the package:
pip3 install data2bids
I should just use cd on my desired folder that needs restructuring and then simply run data2bids.
After doing so, I received a command not found error.
I have tried to run the package using the python data2bids command (thinking that maybe I should mention it is a python package. I have tried to use the full path of where the package was installed in the command, yet it did not work. I even tried to install the package in the same folder as my directory that needs restructuring, with no results.
I believe that this is a very basic problem, and the solution may be very simple. Within a linux machine, how does one exactly run a python module in a specific folder?
I am also a rookie in Linux, here's what i can think of.
First, the input is:
A directory containing some files in any extension, with names containing at minimum the information of modality and patient number. A .JSON configuration file explaining how the filenames should be read.
I assume you ran the command without the configuration file.
Second, Linux has built-in python whose version is 2.x, try to type python in command line and print python version, if it's 3.x, try to query pip installed list to see if the package was installed successfully, if not, see if the installed python 3.x directory is contained in PATH.
I am super new to the field of object detection.
I was wondering if anyone can help me somehow on how I can download and use the object detection datasets such as coco or pascal. When I go to their website even after downloading the datasets i feel like i dont know what should i do with them...
I know this question is stupid, but a hint to start can be super useful.
Thanks
I'm using: python 3.5 on Ubuntu 16.04
Firstly, there are three things you'd want to download and unzip:
1) Cocoapi - I tried using the official version but it doesn't work (for me, probably some version issues). So I'm using one of these versions (I can't rmb which one I've used):https://github.com/philferriere/cocoapi https://github.com/cocodataset/cocoapi (official)
2) Download COCO images. I'd recommend downloading a valuation set just to try things out first.
3) Download the corresponding annotations for that image set that you've downloaded.
*Both 2) and 3) can be downloaded from the COCO official site.
Installing:
Unzip the cocoapi to a folder of your choice. Then, unzip the annotations and images into that unzipped cocoapi folder. And name them as "annotations" and "images". I'm using Ubuntu 16.04 so I used the terminal to navigate to the .../cocoapi-master/PythonAPI folder. Then, run make. Note that the "..." part is the path to the folder you unzipped your cocoapi to. For me, the unzipped folder is called cocoapi-master. But depending on the version you downloaded, it could be named something else.
Next, I had my own python scripts nested in the PythonAPI folder. These scripts are copied and then edited from the python demos which they've provided on their official Github page.
Potential issues - because of some backend compatibility issues with matplotlib, the images might not display properly. If you have that issue you might want to refer to this:No image pop-up or display for plt.imshow() and plt.show()
Hope this works for you! :)
I am new in Python, and I wonder if I can release my program in some kind of compiled build project with all modules and librarys included, so I can run it on diffrent systems? I don't want to install opencv on every pc.
You can specify a requirements.txt file which lists the dependencies used by your program. Python pip can read this file to bundle and package your application. See the docs here: https://pip.pypa.io/en/stable/user_guide/#requirements-files.
Also, I believe that OpenCV requires some native extensions installed which are not packaged with Python. Unfortunately, you'll need to install native extensions on each new machine you use.
I am writing code for a number of other people, none of whom are particularly computer savvy. I installed python 2.7 for all of them, but I really do not want to have to install anything else.
To get around installing every library that I wanted to use, I've simply been including the library source code in the same folder as my project source code. Python automatically searches for the necessary files in the working directory, and all goes well.
The problem came when I tried to install pandas. Pandas is a library that includes .pyx and .c files that are compiled on install. I cannot just include these files in with my source code, because they are not in the proper form.
How can I either compile these on launch or pre-compile them for ease of transfer? (And the kicker, I need a solution that works cross platform--I work on Windows 7, my colleagues work on OSX.)
Thank you in advance.
I can't seem to find a way to create a standalone package for image recognition. I have a project I'm writing in python, and I found a way to do what I need using OpenCV, but I can't find a way to import the library into my project unless it is installed at the system level on Ubuntu. In other words, I can't seem to plop the build folder into my project after building the OpenCV library. And I can't find the equivalent of cv2.matchTemplate() in PIL or Pillow. So really there are two questions here.
1) How can I attach the build folder to my project, in order to avoid installing the OpenCV at the system level.
2) Is there an equivalent of cv2.matchTemplate() in PIL or Pillow that I can't seem to find?
Thanks.
You need to:
Download OpenCV
Use CMake to tell it to compile statically and to tell it to compile the Python module
Compile, and install into a directory you want.
Find in that directory the file under a directory called python, called cv2.so
Distribute that file with your Python code.
Now that I told you how to do it, let me tell you why your approach isn't a very good idea:
If the version of Python changes, you need to recompile (the so file) and redistribute your entire application
If the version of OpenCV changes you will need to recompile (the so file) and redistribute your entire application
You don't control what version of Python your users have
There can be important subtleties in version of libjpg, libtiff, zlib and others that could prevent your application from working, all outside your control.
You are converting a multi-platform application into a platform specific solution.