Friday, May 6, 2016
HoW To ImPoRt ImAgE In OpEnCV PyThOn
Posted by
jagadish,
on
11:33 PM
first step we need understand whenever program start we should import opencv to python libary so that we use
import cv2import numpy for numerical operations
import numpy as np
In here we need to three process for import and show image
first lets we know how to import image
cv2.IMREAD_COLOR- read color image
cv2.IMREAD_GRAYSCALE-read in grayscale
cv2.IMREAD_UNCHANGED-read in alpha channel OR normal colors
only changing formation is
i had tested in my laptop.im sure this will work for you
- import image(cv2.imread)
- show image(cv2.imshow)
- save image(cv2.imwrite)
first lets we know how to import image
#import numerical operationimport methods
import numpy as np
#import opencv
import cv2
#read image from loction where we have.then assign name as jaga.
jaga = cv2.imread('/home/jagadish/Downloads/Baby_Face.JPG',cv2.IMREAD_COLOR)
#now we need to disply imaage in normal size or auto size otherwise that will display larger
cv2.namedWindow('image', cv2.WINDOW_NORMAL)
#show image(jaga) in window(image)as we can assign window name
cv2.imshow('image',jaga)
#wait key used for stop opertion when we press zero
cv2.waitKey(0)
#to close all windows
cv2.destroyAllWindows()
cv2.IMREAD_COLOR- read color image
cv2.IMREAD_GRAYSCALE-read in grayscale
cv2.IMREAD_UNCHANGED-read in alpha channel OR normal colors
only changing formation is
jaga = cv2.imread('/home/jagadish/Downloads/Baby_Face.JPG',cv2.IMREAD_COLOR)
jaga = cv2.imread('/home/jagadish/Downloads/Baby_Face.JPG',cv2.IMREAD_GRAYSCALE)
jaga = cv2.imread('/home/jagadish/Downloads/Baby_Face.JPG',cv2.IMREAD_UNCHANGED)
i had tested in my laptop.im sure this will work for you
HoW To InStAlL OpEnCv PyThOn AnD C++ In UbUnTu 14.04(LTS)
Posted by
jagadish,
on
10:32 PM
now we gonna learn about how to install opencv python2 and opencv c++ in ubuntu 14.04(LTS) version
Compile and install OpenCV 2.4.9
now copy
Run followling code for libaries
to check c++ opencv type in terminal
to check this lets run sample file.enter following command on terminal for facedetect through pythoncv
when you type and import cv2 in python if anything wrong thats goes next line >>
otherwise error will occurs
p.s
thankss for ur time to read this post
i have tested in my laptop dell 5000 series
Updated and upgraded
Install many dependenciessudo apt-get update sudo apt-get upgrade
To get the OpenCV 2.4.9 source codesudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
Generate mkdir filescd ~ wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip unzip opencv-2.4.9.zip cd opencv-2.4.9
mkdir build cd build cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON ..
Compile and install OpenCV 2.4.9
Configure OpenCV
make sudo make install
sudo gedit /etc/ld.so.conf.d/opencv.conf
now copy
then press ctrl+x.then save and exit from that/usr/local/lib
Run followling code for libaries
now need to open file in that
sudo
ldconfig
now copy this two lines into that file at end of pagesudo
gedit /etc/
bash
.bashrc
now opencv python and c++ installed perfectlyPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
to check c++ opencv type in terminal
~/opencv-2.4.9/build/bin/cpp-example-calibration_artificial
to check this lets run sample file.enter following command on terminal for facedetect through pythoncv
python ~/opencv-2.4.9/samples/python2/facedetect.py

this is running facedetect smaple program.we can check also other method
in terminal lets type following things for wheather working proparly or not
>>import cv2$ python
when you type and import cv2 in python if anything wrong thats goes next line >>
otherwise error will occurs
p.s
thankss for ur time to read this post
i have tested in my laptop dell 5000 series
HoW ToO InStAlL UbUnTu 14.04 Trusty thar
Posted by
jagadish,
on
10:02 PM
In here we gonna know about how install ubuntu os in laptop or computer through bootable USB of Ubuntu.
STEP 1: Download ubuntu os iso file in ubuntu website here.
u can download what ever version you need based on your requirement.
STEP2: Download Universal USB Installer here
which is used for create bootable os in usb pendrive
STEP3: Creating the bootable USB
STEP4:Install os on laptop or Desktop
plugin this bootable pendrive which laptop or desktop os you wanna change
then install it.
tested by myself in my laptop
STEP 1: Download ubuntu os iso file in ubuntu website here.
u can download what ever version you need based on your requirement.
STEP2: Download Universal USB Installer here
which is used for create bootable os in usb pendrive
STEP3: Creating the bootable USB
Plugin the USB drive in the computer OR laptop and run Universal USB Installer. You need to do the following things now
- Select Ubuntu
- Browse to the location of downloaded Ubuntu ISO
- select the USB drive and also check the option to format it.
STEP4:Install os on laptop or Desktop
plugin this bootable pendrive which laptop or desktop os you wanna change
then install it.
tested by myself in my laptop
Subscribe to:
Posts
(
Atom
)