Install OpenCV dengan CodeBlocks pada Windows


OpenCV merupakan library yang digunakan untuk pengolahan citra (image processing). Untuk dapat menjalankannya ada beberapa yang perlu dimiliki :

  • OpenCV
  • IDE (Integrated Development Environment)
    merupakan program komputer yang memiliki beberapa fasilitas dalam pembangunan perangkat lunak.Ada bebrapa macam IDE yang dapat digunakan untuk pengolahan citra dengan OpenCV
    antara lain : Microsoft Visual C++, Eclipse, CodeBlocks, MATHLAB.
Kali ini aku akan bagi-bagi mengenai cara intall OpenCV dengan  CodeBlocks IDE. Setelah sebelumnya pernah kasih Install OpenCV dengan Visual C++ di Windows.
Kalau aku bandingkan, aku cenderung suka pake CodeBlocks, alasannya

  • OpenSource (alias gratis tis tis)
  • Mendukung beberapa jenis pemrograman seperti C, Java, AVR
  • Terasa lebih ringan jalanin program
Cara install OpenCV dengan CodeBlocks pada Windows :
  1. Download OpenCV disini
    install sampai selesai.
  2. Download Code::Blocks disini
    install seperti biasa sampai selesai.
  3. Buka Code::Blocks 10.5
    Pilih File -> New -> Project
    Pilih Console Application -> Go

  4. Klik Next -> Beri nama project -> Next -> Finish

  5. Klik Project -> Build Option -> Pilih Search directories
    Pada bagian Compiler, klik Add -> brows file -> cari directory "OpenCV2.1/include/opencv"
    Yes -> OK
  6. Pada bagian Linker, klik Add -> brows file -> cari direktory "OpenCV2.1/lib"
    Yes -> OK

  7. Klik bagian Linker Settings, klik Add -> brows file -> menuju pada file library OpenCV
    Klik lalu pilih semua (Ctrl+A) -> OK
    OK

  8. Setting debug dan release
    Klik Project -> Properties -> Build Targets
    Isi Execution working dir sesuai Output filename


    9. Tulis Program
#include "iostream"
#include "cv.h"
#include "highgui.h"
using namespace std;
int main()
{
   cvNamedWindow( "hello", 1 );
  IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 );
  CvFont font;
  double hScale = 1.0;
  double vScale = 1.0;
  int lineWidth = 1;
  cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX,
              hScale, vScale, 0, lineWidth );
  cvPutText( img, "I'm EBIT", cvPoint( 250, 350 ), &font,
             cvScalar( 255, 255, 0 ) );
  cvPutText( img, "Hello OpenCV.....!", cvPoint( 200, 400 ), &font,
             cvScalar( 255, 255, 0 ) );
  cvShowImage( "hello", img );
  cvWaitKey();
    return 0;

}

You can leave a response, or trackback from your own site.

0 Response to "Install OpenCV dengan CodeBlocks pada Windows"

:10 :11 :12 :13 :14 :15 :16 :17
:18 :19 :20 :21 :22 :23 :24 :25
:26 :27 :28 :29 :30 :31 :32 :33
:34 :35 :36 :37 :38 :39

Posting Komentar