Install OpenNi2 and Nite2 on Linux - openni

Im not able to find the website and instructions how to install openni2 and nite2 on linux. Does anyone know where i can find these libs and how to install them?

http://www.linuxdiyf.com/linux/25349.html
This link Have showed how to install Openni2 & NiTE2 in ubuntu 16.04
I reorganized it as follows
sudo apt-get install git g++ cmake libxi-dev libxmu-dev libusb-1.0-0-dev pkg-config freeglut3-dev build-essential
mkdir -p HandTrack/src
cd HandTrack/src
#install libfreenect
git clone https://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build; cd build
cmake .. -DBUILD_OPENNI2_DRIVER=ON
make
sudo make install
sudo mkdir -p /etc/udev/rules.d/
sudo cp ../platform/linux/udev/51-kinect.rules /etc/udev/rules.d/
#install Openni2
cd PATHTO/HandTrack/src
wget https://s3.amazonaws.com/com.occipital.openni/OpenNI-Linux-x64-2.2.0.33.tar.bz2
tar -xjvf OpenNI-Linux-x64-2.2.0.33.tar.bz2 && rm OpenNI-Linux-x64-2.2.0.33.tar.bz2
cd OpenNI-Linux-x64-2.2
sudo ./install.sh
#Test installation of Openni2
cd PATHTO/HandTrack/src
cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/
cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so OpenNI-Linux-x64-2.2/Tools/OpenNI2/Drivers/
sudo apt-get install usbutils
lsusb #You should see kinect devices
cd OpenNI-Linux-x64-2.2/Tools
./NiViewer
#Install NiTE2
cd PATHTO/HandTrack/src
wget http://jaist.dl.sourceforge.net/project/roboticslab/External/nite/NiTE-Linux-x64-2.2.tar.bz2
tar xjvf NiTE-Linux-x64-2.2.tar.bz2 && rm NiTE-Linux-x64-2.2.tar.bz2
cd NiTE-Linux-x64-2.2
sudo ./install.sh
cd ..
cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so NiTE-Linux-x64-2.2/Samples/Bin/OpenNI2/Drivers/
cp OpenNI-Linux-x64-2.2/Redist/libOpenNI2.so NiTE-Linux-x64-2.2/Samples/Bin
cd NiTE-Linux-x64-2.2/Samples/Bin
./UserViewer

The OpenNi2 (and Nite) project was discontiued when apple bought primesense. Using google you may find a million instructions of how or where to find them.
Then again, some other companies have done some updates that may help you. One of this companies is occipital structure:
https://github.com/occipital/openni2
In the github readme you will find the instructions of how to install it in different systems.
Nite2 is a little more difficult to find since the license is different and I think I can't post it here. For the installing instructions, it is similar to the ones of openni2 and are also in the readme file of the package.

Related

Unable to install Tesseract 5.0 version on AWS Lambda

I want to run Tesseract 4.0 or Tesseract 5.0 on my AWS Lambda function. So I have my docker file like so-
FROM public.ecr.aws/lambda/python:3.8
RUN mkdir app
# Copy function code
COPY / ${LAMBDA_TASK_ROOT}/app
# Install the function's dependencies using file requirements.txt
# from your project folder.
COPY requirements.txt .
RUN pip3 install -r requirements.txt --target ${LAMBDA_TASK_ROOT}
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y update
RUN yum -y install tesseract
RUN yum install -y poppler-utils
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "app.com.emlAndMsgParser.mail_parser_test.getEmail_from_msg" ]
but when i do DockerBuild-"docker build -t qa-lambda ." on my terminal, it says Tesseract 3.0 version is getting installed. When i deploy this built Docker image to AWS Lambda,it also says Tesseract 3.0 is installed.
But I want Tesseract 4.0 or preferably Tesserct 5.0.
I tried changing the "RUN yum -y install tesseract" in my Dockerfile to "RUN yum -y install tesseract 5.0.0-alpha-320-g8dc3" and "RUN yum -y install tesseract -y" or "RUN yum -y install tesseract*".
But all of them are installing Tesseract 3.0.
Please can anyone tell me where I am going wrong?
I am a bit new to Tesseract, so any help is appreciated..thanks!
Having the same problem, I finally created a Dockerfile myself:
FROM public.ecr.aws/lambda/java:11 q
# Prepare dev tools
RUN yum -y update
RUN yum -y install wget libstdc++ autoconf automake libtool autoconf-archive pkg-config gcc gcc-c++ make libjpeg-devel libpng-devel libtiff-devel zlib-devel
RUN yum group install -y "Development Tools"
# Build leptonica
WORKDIR /opt
RUN wget http://www.leptonica.org/source/leptonica-1.82.0.tar.gz
RUN ls -la
RUN tar -zxvf leptonica-1.82.0.tar.gz
WORKDIR ./leptonica-1.82.0
RUN ./configure
RUN make -j
RUN make install
RUN cd .. && rm leptonica-1.82.0.tar.gz
# Build tesseract
RUN wget https://github.com/tesseract-ocr/tesseract/archive/refs/tags/5.2.0.tar.gz
RUN tar -zxvf 5.2.0.tar.gz
WORKDIR ./tesseract-5.2.0
RUN ./autogen.sh
RUN PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LIBLEPT_HEADERSDIR=/usr/local/include ./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib
RUN LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make -j
RUN make install
RUN /sbin/ldconfig
RUN cd .. && rm 5.2.0.tar.gz
# Optional: install language packs
RUN wget https://github.com/tesseract-ocr/tessdata/raw/main/deu.traineddata
RUN wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata
RUN mv *.traineddata /usr/local/share/tessdata
WORKDIR /root
ENTRYPOINT [ "tesseract", "--version" ]
Hope this helps!

Uninstall OpenCV 3.0.0 from Ubuntu14.04

I want to use surffeature with opencv3.0.0 on Ubuntu, but I didn't install opencv_contrib at first. When I tried to install opencv_contrib, it failed. So I intend to uninstall opencv3.0.0, and reinstall it with opencv_contrib. I just delete the build file which was built during the installing opencv3.0.0. Then I type :
make uninstall
in terminal. It failed again, the error information is :
CMake Error at cmake_uninstall.cmake:20 (MESSAGE): Problem when
removing "/usr/local/include/opencv2/cvconfig.h"
I found I should type :
make uninstall
instead of remove build file, but it's already done.
I installed opencv3.0.0 with the following instruction
sudo apt-get install build-essential
sudo apt-get install git libgtk2.0-dev libavcodec-dev libavformat-dev libtiff4-dev libswscale-dev libjasper-dev
sudo apt-get install pkg-config
cmake .
mkdir build
cd build
cmake -D WITH_IPP=OFF ..
make ..
sudo make install
cd /etc/ld.so.conf.d
sudo /bin/bash -c 'echo "/usr/local/lib" /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig -v
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
What should I do now ?
You have to use sudo, as the file belongs to the system and you don't have access to it by default.
Try:
sudo make uninstall
It worked for me.
I delete all the opencv files, including source file and installed file under /usr/local, finally re-install opencv

Fastest way to install Tesseract on Elastic Beanstalk

I am currently using Tika to extract text from files uploaded to my Rails app running on AWS Elastic Beanstalk (64bit Amazon Linux 2016.03 v2.1.2 running Ruby 2.2). I'd like to index scanned images as well, so I need to install Tesseract.
I was able to get it to work by installing it from source like so, but it added 10 minutes to my deploys to a fresh instance. Is there a faster way to do this?
.ebextensions/02-tesseract.config
packages:
yum:
autoconf: []
automake: []
libtool: []
libpng-devel: []
libtiff-devel: []
zlib-devel: []
container_commands:
01-command:
command: mkdir -p install
cwd: /home/ec2-user
02-command:
command: cp .ebextensions/scripts/install_tesseract.sh /home/ec2-user/install/
03-command:
command: bash install/install_tesseract.sh
cwd: /home/ec2-user
.ebextensions/scripts/install_tesseract.sh
#!/usr/bin/env bash
cd_to_install () {
cd /home/ec2-user/install
}
cd_to () {
cd /home/ec2-user/install/$1
}
if ! [ -x "$(command -v tesseract)" ]; then
# Add `usr/local/bin` to PATH
echo 'pathmunge /usr/local/bin' > /etc/profile.d/usr_local.sh
chmod +x /etc/profile.d/usr_local.sh
# Install leptonica
cd_to_install
wget http://www.leptonica.org/source/leptonica-1.73.tar.gz
tar -zxvf leptonica-1.73.tar.gz
cd_to leptonica-1.73
./configure
make
make install
rm -rf /home/ec2-user/install/leptonica-1.73.tar.gz
rm -rf /home/ec2-user/install/leptonica-1.73
# Install tesseract ~ the jewel of Odin's treasure room
cd_to_install
wget https://github.com/tesseract-ocr/tesseract/archive/3.04.01.tar.gz
tar -zxvf 3.04.01.tar.gz
cd_to tesseract-3.04.01
./autogen.sh
./configure
make
make install
ldconfig
rm -rf /home/ec2-user/install/3.04.01.tar.gz
rm -rf /home/ec2-user/install/tesseract-3.04.01
# Install tessdata
cd_to_install
wget https://github.com/tesseract-ocr/tessdata/archive/3.04.00.tar.gz
tar -zxvf 3.04.00.tar.gz
cp /home/ec2-user/install/tessdata-3.04.00/eng.* /usr/local/share/tessdata/
rm -rf /home/ec2-user/install/3.04.00.tar.gz
rm -rf /home/ec2-user/install/tessdata-3.04.00
fi
Short answer
.ebextensions/02-tesseract.config
commands:
01-libwebp:
command: "yum --enablerepo=epel --disablerepo=amzn-main -y install libwebp"
02-tesseract:
command: "yum --enablerepo=epel -y install tesseract"
Long answer
I'm not familiar with non-Ubuntu package managers or ebextensions, so after some digging, I found that there are precompiled binaries that can be installed on Amazon Linux in the stable EPEL repo.
The first obstacle was figuring out how to use the EPEL repo. The easiest way is to use the enablerepo option on the yum command.
That gets us here:
yum --enablerepo=epel install tesseract
Next, I had to resolve this dependency error:
[root#ip-10-0-1-193 ec2-user]# yum install --enablerepo=epel tesseract
Loaded plugins: priorities, update-motd, upgrade-helper
951 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package tesseract.x86_64 0:3.04.00-3.el6 will be installed
--> Processing Dependency: liblept.so.4()(64bit) for package: tesseract-3.04.00-3.el6.x86_64
--> Running transaction check
---> Package leptonica.x86_64 0:1.72-2.el6 will be installed
--> Processing Dependency: libwebp.so.5()(64bit) for package: leptonica-1.72-2.el6.x86_64
--> Finished Dependency Resolution
Error: Package: leptonica-1.72-2.el6.x86_64 (epel)
Requires: libwebp.so.5()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I found the solution here
Just adding the epel repo doesn't solve it, as the packages in the
amzn-main repository seem to overrule those in the epel repository. If
the libwebp package in the amzn-main repo are excluded it should work
The Tesseract install has some dependencies found in the amzn-main repo. This is why I first install libwebp with --disablerepo=amzn-main.
yum --enablerepo=epel --disablerepo=amzn-main install libwebp
yum --enablerepo=epel install tesseract
Finally, here's how you can install yum packages on Elastic Beanstalk with options:
.ebextensions/02-tesseract.config
commands:
01-libwebp:
command: "yum --enablerepo=epel --disablerepo=amzn-main -y install libwebp"
02-tesseract:
command: "yum --enablerepo=epel -y install tesseract"
Fortunately, this is also the easiest way to install Tesseract on Elastic Beanstalk!

How to compile C code that is using kernel function in docker and use pci device in container?

I have a Makefile some C++ code that is using PCI device
all:
g++ -o executable main.cpp dragon.pb.cc -std=c++11 -O3 -I/usr/include/postgresql -I/usr/include/hiredis -lzmq -lprotobuf -lpthread -lpq -lhiredis
clean:
rm executable
And It have dependencies on this C library that is using kernel functions. Makefile for this libraby is
# dist and build are folders, not phony targets
.PHONY: all package clean
all: dragon.pb.cc dragon_pb2.py package
dragon.pb.cc: dragon.proto
protoc --cpp_out=. dragon.proto
dragon_pb2.py: dragon.proto
protoc --python_out=. dragon.proto
package: build
clean:
rm -f dragon.pb.*
rm -f dragon_pb*
rm -rf build
rm -rf dist
rm -f MANIFEST
And here is my Dockerfile
FROM ubuntu:14.04
ENV PG_MAJOR 9.3
RUN apt-get update
RUN apt-get install -y git make protobuf-compiler libhiredis-dev postgresql-server-dev-${PG_MAJOR}
RUN apt-get install -y g++
RUN apt-get install -y libzmq-dev
RUN apt-get install -y libprotobuf-dev
RUN apt-get install -y linux-headers-$(uname -r)
ADD deployment_key /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN echo "StrictHostKeyChecking no" >> /root/.ssh/config
RUN echo >> /root/.ssh/config
RUN echo "Host bitbucket.org" >> /root/.ssh/config
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app/
RUN git clone git#bitbucket.org:opticsdevelopment/dragon-protocols.git
WORKDIR ./dragon-protocols
RUN make dragon.pb.cc
RUN cp ./dragon.pb.* ../
COPY . /usr/src/app
WORKDIR ../
RUN git clone git#bitbucket.org:opticsdevelopment/dragon-module.git
WORKDIR ./dragon-module
RUN make all
WORKDIR ../
RUN make
EXPOSE 5570
CMD ["dragon"]
The problem right now is in installing linux-headers. Somehow it can't find headers
E: Unable to locate package linux-headers-3.13.0-19-generic
E: Couldn't find any package by regex 'linux-headers-3.13.0-19-generic'
If your app can compile with any generic linux headers
In your Dockerfile change
RUN apt-get install -y linux-headers-$(uname -r)
to just
RUN apt-get install -y linux-headers-generic
or if you need the same specific one as your host system
why dont you just volume link this directory from host to the docker container with the -v?
on your host system:
sudo apt-get install linux-headers-$(uname -r)
Now you have the kernel headers here: /usr/src/linux-headers-$(uname -r)/include
now on your docker container run command, link that volume like
-v /usr/src/linux-headers-$(uname -r)/include:/usr/src/linux-headers-$(uname -r)/include

Uninstall boost and install another version

I've installed the boost libraries on Linux Mint 12 using the command sudo apt-get install libboost-dev libboost-doc, which installs the default version available in the repositories. However, the project I have to do needs the 1.44 version of boost. How do I uninstall the default (current) version 1.46 and install 1.44?
I couldn't find the documentation on the boost website to install boost from the .tar.gz package.
Boost can installed by two ways
Deb package
wget and install manually
In some case we might have installed by both type which can cause version error. Lets see how to uninstall both.
sudo apt-get update
# to uninstall deb version
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
# to uninstall the version which we installed from source
sudo rm -f /usr/lib/libboost_*
Then we need to install other dependencies if they are not met
sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev
Lets download the boost version which we need from the link. I am downloading the 1.54 version. Then untar and install it.
# go to home folder
cd
wget http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
tar -zxvf boost_1_54_0.tar.gz
cd boost_1_54_0
# get the no of cpucores to make faster
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
echo "Available CPU cores: "$cpuCores
./bootstrap.sh # this will generate ./b2
sudo ./b2 --with=all -j $cpuCores install
Now let's check the installed version
cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
You will see something like below
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_54"
Version 1.54 of boost is installed
That's it, it worked for me. Let me know if you face any issues.
You can uninstall with
apt-get --purge remove libboost-dev libboost-doc
Download the package you need from boost website, extract and follow "getting started" instructions found inside index.html in the extracted directory.
Tested working Ubuntu 20.04 Use my script to uninstall your older version of boost in ubuntu 20.04 and follow rams instructions above
#!/bin/bash
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
echo "clear boost dir"
sudo rm -r /usr/local/lib/libboost*
sudo rm -r /usr/local/include/boost
sudo rm -r /usr/local/lib/cmake/*
sudo rm -f /usr/lib/libboost_*
sudo rm -r /usr/include/boost
Downgrade your boost version. I'm not familiar with Mint, but assuming it is deb-based, you can do:
apt-cache show libboost-dev
to see all installable version and install a specific version with
sudo apt-get install libboost-dev=1.42.0.1
There are also convenience packages for the major boost versions:
sudo apt-get install libboost1.44-dev
As #savamane wrote you can uninstall it with
apt-get --purge remove libboost-dev libboost-doc
Another suggestion to install the .deb packages as suggested here. (Download the one fitted for your architecture though).
For still supported distros, you can simply search for the package at the distributions at http://packages.ubuntu.com/. For example libboost-system1.46.1 can be found in under the precise -> Libraries tab.
For unsupported distros, there is still a chance to find them at
http://archive.ubuntu.com/. For example can libboost-all-dev_1.40.0.1_amd64.deb be found in
http://archive.ubuntu.com/ubuntu/pool/universe/b/boost-defaults/.
This is how you install a specific Boost version:
cd boost_1_54_0/
./bootstrap.sh --with-libraries=atomic,date_time,exception,filesystem,iostreams,locale,program_options,regex,signals,system,test,thread,timer,log
sudo ./b2 install