Friday, May 6, 2016

HoW To ImPoRt ImAgE In OpEnCV PyThOn

No comments
first step we need understand whenever program start we should import opencv to python libary so that we use
   import cv2
import numpy  for numerical operations
   import numpy as np
In here we need to  three process for import and show image
  • import image(cv2.imread)
  • show image(cv2.imshow)
  • save image(cv2.imwrite)

first lets we know how to import image

#import numerical operation
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()
import methods
 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)

1 comment
now we gonna learn about how to install opencv python2 and opencv c++ in ubuntu 14.04(LTS) version


Updated and upgraded
sudo apt-get update
sudo apt-get upgrade
Install many dependencies
sudo 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
 To get the OpenCV 2.4.9 source code
cd ~
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
 Generate mkdir files
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
 
make
sudo make install
  Configure OpenCV

sudo gedit /etc/ld.so.conf.d/opencv.conf

http://www.samontab.com/web/wp-content/uploads/2012/06/openCVConf1.png

now copy
/usr/local/lib
 then press ctrl+x.then save and exit from that

Run followling code for libaries


sudo ldconfig
 now need to open file in that
sudo gedit /etc/bash.bashrc
now copy this two lines into that file at end of page
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
 now opencv python and c++ installed perfectly

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
$ python
>>import cv2

 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

No comments
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

 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