There is a bug when you try to run in terminal, it does not take any input or output.
To fix this bug on Ubunut,
Tools --> Options --> Environment --> General
Change the Terminal from
x-terminal-emulator -e
to
/usr/bin/xterm -e
Thanks to https://bugs.launchpad.net/ubuntu/+source/qtcreator/+bug/566387
Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts
Friday, July 26, 2013
Tuesday, December 11, 2012
Configure OpenCV 2.4 for Qt Creator on Ubuntu
First install Qt creator using Ubuntu Software Center
Open Qt Creator
File --> New file or project
Qt Widget Project --> Qt GUI Application --> Choose
Click Next for all.
Open .pro file and add the following lines
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
LIBS += -lopencv_ml
LIBS += -lopencv_video
LIBS += -lopencv_features2d
LIBS += -lopencv_calib3d
LIBS += -lopencv_objdetect
LIBS += -lopencv_contrib
LIBS += -lopencv_legacy
LIBS += -lopencv_flann
LIBS += -lopencv_nonfree
Save it.
Open .ui file.
Drag and drop a PushButton to window.
Click PushButton and chage the follwong properties
Right click PushButton --> Go to slot --> clicked() --> Ok
Include the following
#include <cv.h>
#include <highgui.h>
Add the following code
void MainWindow::on_btnDisplay_clicked()
{
cv::namedWindow("Disp");
cv::VideoCapture cap(0);
cv::Mat frame;
do{
cap >> frame;
imshow("Disp",frame);
}while(cv::waitKey(30)<0);
cv::destroyAllWindows();
}
Run it. You will see yourself on the screen, when you click Display button !!!
Open Qt Creator
File --> New file or project
Qt Widget Project --> Qt GUI Application --> Choose
Click Next for all.
Open .pro file and add the following lines
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
LIBS += -lopencv_ml
LIBS += -lopencv_video
LIBS += -lopencv_features2d
LIBS += -lopencv_calib3d
LIBS += -lopencv_objdetect
LIBS += -lopencv_contrib
LIBS += -lopencv_legacy
LIBS += -lopencv_flann
LIBS += -lopencv_nonfree
Save it.
Open .ui file.
Drag and drop a PushButton to window.
Click PushButton and chage the follwong properties
- objectName: btnDisplay
- text: Display
Right click PushButton --> Go to slot --> clicked() --> Ok
Include the following
#include <cv.h>
#include <highgui.h>
Add the following code
void MainWindow::on_btnDisplay_clicked()
{
cv::namedWindow("Disp");
cv::VideoCapture cap(0);
cv::Mat frame;
do{
cap >> frame;
imshow("Disp",frame);
}while(cv::waitKey(30)<0);
cv::destroyAllWindows();
}
Run it. You will see yourself on the screen, when you click Display button !!!
Install Eclipse in Ubuntu
Downloaded Eclipse from website
http://www.eclipse.org/downloads/
If your downloaded file is eclipse-cpp-juno-linux-gtk.tar.gz
tar -xvf eclipse-cpp-juno-linux-gtk.tar.gz
cd eclipse
chmod +x eclipse
cd ..
mv eclipse /opt
gedit /usr/share/applications/eclipse.desktop
Copy the following and save it.
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=Eclipse
cd /usr/local/bin
ln -s /opt/eclipse/eclipse
Eclipse is ready
http://www.eclipse.org/downloads/
If your downloaded file is eclipse-cpp-juno-linux-gtk.tar.gz
tar -xvf eclipse-cpp-juno-linux-gtk.tar.gz
cd eclipse
chmod +x eclipse
cd ..
mv eclipse /opt
gedit /usr/share/applications/eclipse.desktop
Copy the following and save it.
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=Eclipse
cd /usr/local/bin
ln -s /opt/eclipse/eclipse
Eclipse is ready
Install OpenCV in Ubuntu 12.04
Copy the following script to gedit and save as opencv.sh . Open terminal.
chmox +x opencv.sh
./opencv.sh
This will complete opencv installation
arch=$(uname -m)
if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
flag=1
else
flag=0
fi
echo "Installing OpenCV 2.4.3"
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get install libopencv-dev
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get install python-dev python-numpy
sudo apt-get install libtbb-dev
sudo apt-get install libqt4-dev libgtk2.0-dev
echo "Downloading x264"
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120528-2245-stable.tar.bz2
tar -xvf x264-snapshot-20120528-2245-stable.tar.bz2
cd x264-snapshot-20120528-2245-stable/
echo "Installing x264"
if [ $flag -eq 1 ]; then
./configure --enable-static
else
./configure --enable-shared --enable-pic
fi
make
sudo make install
cd ..
echo "Downloading ffmpeg"
wget http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.bz2
echo "Installing ffmpeg"
tar -xvf ffmpeg-0.11.1.tar.bz2
cd ffmpeg-0.11.1/
if [ $flag -eq 1 ]; then
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
else
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared
fi
make
sudo make install
cd ..
echo "Downloading v4l"
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-0.8.8.tar.bz2
echo "Installing v4l"
tar -xvf v4l-utils-0.8.8.tar.bz2
cd v4l-utils-0.8.8/
make
sudo make install
cd ..
echo "Downloading OpenCV 2.4.3"
wget -O OpenCV-2.4.3.tar.bz2 http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.3/OpenCV-2.4.3.tar.bz2/download
echo "Installing OpenCV 2.4.3"
tar -xvf OpenCV-2.4.3.tar.bz2
cd OpenCV-2.4.3
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install
sudo su
sudo echo “/usr/local/lib” >> /etc/ld.so.conf
sudo ldconfig
echo "OpenCV 2.4.3 ready to be used"
Special Thanks for the original writer. This is a little modified version of it
chmox +x opencv.sh
./opencv.sh
This will complete opencv installation
arch=$(uname -m)
if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
flag=1
else
flag=0
fi
echo "Installing OpenCV 2.4.3"
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get install libopencv-dev
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get install python-dev python-numpy
sudo apt-get install libtbb-dev
sudo apt-get install libqt4-dev libgtk2.0-dev
echo "Downloading x264"
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120528-2245-stable.tar.bz2
tar -xvf x264-snapshot-20120528-2245-stable.tar.bz2
cd x264-snapshot-20120528-2245-stable/
echo "Installing x264"
if [ $flag -eq 1 ]; then
./configure --enable-static
else
./configure --enable-shared --enable-pic
fi
make
sudo make install
cd ..
echo "Downloading ffmpeg"
wget http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.bz2
echo "Installing ffmpeg"
tar -xvf ffmpeg-0.11.1.tar.bz2
cd ffmpeg-0.11.1/
if [ $flag -eq 1 ]; then
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
else
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared
fi
make
sudo make install
cd ..
echo "Downloading v4l"
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-0.8.8.tar.bz2
echo "Installing v4l"
tar -xvf v4l-utils-0.8.8.tar.bz2
cd v4l-utils-0.8.8/
make
sudo make install
cd ..
echo "Downloading OpenCV 2.4.3"
wget -O OpenCV-2.4.3.tar.bz2 http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.3/OpenCV-2.4.3.tar.bz2/download
echo "Installing OpenCV 2.4.3"
tar -xvf OpenCV-2.4.3.tar.bz2
cd OpenCV-2.4.3
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install
sudo su
sudo echo “/usr/local/lib” >> /etc/ld.so.conf
sudo ldconfig
echo "OpenCV 2.4.3 ready to be used"
Special Thanks for the original writer. This is a little modified version of it
Sunday, December 9, 2012
Install .deb file in Ubuntu
sudo dpkg -i .deb
This command may give error because the dependences may not be installed. If so,
sudo apt-get -f install
Note: Can applicable for google chrome, skype etc.
Sunday, December 2, 2012
Customize Ubuntu Boot Menu
Grub-Customizer is the best GUI I found to customize
Ubunutu boot menu. It allows you to select desired default boot or to
boot previously booted OS.
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
Subscribe to:
Posts (Atom)