How do I minimize opencv build after installation? - opencv

It's been a long time since I last built opencv, contrib and all. The last installation I did, I recall being able to shrink the size of the installation after it was done; presently the file "build" is 28 gigabytes. My previous installation was able to be reduced in size to about 12 gigabytes after installation by removing files that are only necessary for installing and building, but not running. I have since forgotten what these files are that can be removed, and the installation tutorial that told me which ones were able to be removed. Can some shed some light on which files in my build folder can be removed after my release and debug builds have been installed?

If your intention is to extract the "bin/ include/ lib/ share/" QUAD and remove the entire cmake build tree, there is a simple thing you can do:
cd /path/to/cv/build
DESTDIR=/tmp/lalala make install -j7
Then you'll find what the QUAD in /tmp/lalala/path/to/your/original/install/dir. If that's all you need, rm -rf /path/to/cv/build.
If you are not using Linux/Unix & make however, let me know in the comment and I'll edit the answer.
Love your spiderman movies, btw. :-)

Related

How to install CTAN packages after downloading from http://ctan.org/mirrors mirrors?

I have download CTAN packages from https://www.tug.org/texlive/acquire-mirror.html with wget --mirror --no-parent ctan.imsc.res.in.
In the installation document they have mentioned install-tl* to install the downloaded package. But I couldn't find the install-tl* in the downloaded files. And the downloaded file size is about 2.73GB
Someone suggest me how to install CTAN latex packages after downloading it.
tl might stand for the texlive distribution; it has its own packaging that contains many available also on CTAN, you may use the command tlmgr (here in a GNU/Linux Debian) to manage them.
it depends… some packages might give you instructions, some not. they lack a common format. some you first need to compile others you can just put into the texmf path etc.
you would need to be more specific on what package you want to install in which system and what problem this is supposed to solve. also you should knw the better place for such questions is: https://tex.stackexchange.com/ .
https://www.ctan.org/pkg/acrotex?lang=en provides sources (e.g. dtx, ins) to be compiled first (e.g. sty)… and then I placed into ~/texmf/tex/latex/acrotex to have them in my path.

How do I install a project built with bazel?

I am working on a project that is transitioning from CMake to Bazel. One critical feature that we are apparently losing in the bargain is the ability to install the project, so that it can be used by other (not necessarily Bazel) projects.
AFAICT, there is currently no built in support for installing a project?!
I need to create a portable (must work on at least Linux and MacOS) way to install the project. Specifically:
I need to be able to specify libraries, headers, executables, and other files (e.g. LICENSE) that need to be installed.
The user needs to be able to specify an absolute prefix where things should be installed.
I really, really should be able to execute the "install" step more than once, giving different prefixes each time, without Bazel getting confused (i.e. it must not try to "remember" what files it already installed, or if it does, must understand when the prefix is different from last time).
Libraries should be installed to the right place (e.g. lib64), or at least it should be possible for the user to specify the correct libdir.
The install step MUST NOT touch the time stamp on any file from a previous install that has not changed. (Ideally, Bazel itself would handle this; using the install command is tricky and has potential portability issues. Note platform requirements, above.)
What is the best way to go about doing this?
Unless you want to do specific package (e.g. deb or rpm), you probably want to create an executable rule that does the install for you.
You can create a rule that would create an executable (e.g. a shell script) that does the install for you (e.g. do checksums to check if there are change to the installed file and does the actual copy of the files if they have changed). You would have to use the extension language to do, that would look similar to what the docker rules does to load an image with the incremental loader
Addition: I forgot to say that the install itself would be run by using the run command: bazel run install if the rule is named install in the top level BUILD file.

Why is createBackgroundSubtractorGMG considered obsolete, and how can I use it

I am rather new to OpenCV and image processing in general. I am looking into background subtraction to facilitate motion tracking (people counting). Looking at the openCV documentation on background subtracting, GMG gives rather nice results. Also when looking at a video comparing the methods, I feel that GMG gives the best results, at least for my purpose.
I installed the latest version of opencv to use with python3 thus:
git clone --depth=1 https://github.com/Itseez/opencv.git
cd opencv
mkdir build
cd build
cmake -DBUILD_opencv_python3=YES -DBUILD_opencv_python2=NO -DINSTALL_PYTHON_EXAMPLES=YES -DPYTHON3_EXECUTABLE=/usr/local/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4.dylib -DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.4/site-packages/numpy/core/include/ -DPYTHON3_PACKAGES_PATH=/usr/local/lib/python3.4/site-packages/ ..
make -j8
make install
python3 -c "import cv2; print(cv2.__version__)"
the last line tells me I'm now running 3.0.0-dev. According to this question, cv2.createBackgroundSubtractorGMG ought to be available in this version, however it's not; and indeed, it seems to have been moved to obsolete in opencv master.
Interestingly enough, in my own tests the current (3.0.0-dev) versions of createBackgroundSubtractorKNN and createBackgroundSubtractorMOG2 work much better than the ones I tested before (MOG and MOG2) in opencv2. So possibly the GMG algorithm got moved into those. Or, if not, why is the GMG version considered obsolete now? And how can I get the obsolete version to work (on python3), to compare the results?
I don't think it is obsolete... it was just moved to the contrib repository. You have to install it with OpenCV and then it is available under cv2.bgsegm. Follow the link for build instructions.

Downloading JUST the iOS Facebook SDK, not the freaky package?

We all love the Facebook SDK for iOS, if you go here to download it,
https://developers.facebook.com/docs/ios/getting-started
for some reason you get this sort of insane .pkg file,
which APPEARS TO ONLY create the "FacebookSDK" folder in your "Documents" folder.
Then you just move it where you want, wondering "Why the hell do they do that?"
Does anyone know
Is there on Facebook.com an official link somewhere to simply a zip of the library?
Is there a reason they use the package system? (Does it -- check on versions, or something - does it check you have needed stuff on your Mac maybe?)
Does it drop any crap anywhere that one has to clean up? Is it mildly malicious at all?
The installer also installs the docset.
You can check in Terminal to see what's going on:
First, expand the installer from inside your Downloads directory:
$ mkdir facebook_sdk
$ cd facebook_sdk
$ xar -xf ../facebook-ios-sdk-3.15.1.pkg
This will create a new pkg file which is just a directory. cd into that and unzip the Payload:
$ cd FacebookSDK.pkg
$ cat Payload | gunzip -dc |cpio -i
Then open the directory in Finder to browse the contents:
$ open -a finder .
You'll be able to see what gets copied where, and you can just pull out whatever you want:
To answer your questions more specifically:
Is there on Facebook.com an official link somewhere to simply a zip of the library?
To my knowledge, no, but you can use CocoaPods to get it.
Is there a reason they use the package system? (Does it -- check on versions, or something - does it check you have needed stuff on your Mac maybe?)
It might remove old deprecated files when installing new versions, and it makes it easier to install the docs.
Does it drop any crap anywhere that one has to clean up? Is it mildly malicious at all?
It's not malicious. You might not want the docs if you're tight on space.

ImageMagick Needs a Dependency That Doesn't Exist?

In attempting to install the latest ImageMagick (and devel) RPM from http://www.imagemagick.org/download/linux/CentOS/x86_64/ I receive this message
ImageMagick-libs = 6.8.5-8 is needed by ImageMagick-devel-6.8.5-8.x86_64
Confusingly, there is no ImageMagick-libs RPM listed, and searching has yet to yield a solution. Is there a way around this existential dependency?
Neither I nor Google know where ImageMagick-libs lives nor what it contains, but for posterity this gets things up and running on CentOS 5.8 (the distribution listed on imagemagick.org):
>: rpm -Uvh --nodeps ImageMagick-6.8.5-8.x86_64.rpm ImageMagick-devel-6.8.5-8.x86_64.rpm
>: ln -s /usr/include/ImageMagick-6 /usr/include/ImageMagick
The symbolic link was necessary for software relying on ImageMagick header files.
If someone were to stumble upon this, the ImageMagick-libs RPM are now downloadable from the link in the question.
I ran into the same thing when building the RPMs myself.
line 66 of the SRPM's included ImageMagick spec file includes:
Requires: %{name}-libs = %{version}-%{release}
I just commented out that line and the build completes; the resultant RPM satisfies the requirement cleaner. In sum, I believe it a bug in the SPEC file bundled in the SRPM. It isn't necessary for functionality even when building against php magickwand and similar finicky tools that require headers from ImageMagick.

Resources