블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
  • total
  • today
  • yesterday

Category

2011. 10. 31. 11:22

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

번역서: 시작하세요! 아이폰 3 프로그래밍: IPHONE SDK를 이용한 아이폰 개발

원서: More IPhone 3 Development: Tackling IPhone SDK 3  by Dave Mark, Jeff LaMarch
번역서: MORE 아이폰 3 프로그래밍   (IPHONE SDK 3 집중분석)


http://iphonedevbook.com/


posted by maetel
2010. 10. 10. 00:52

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

아이폰 어플리케이션 제작 워크숍: Preparation and Practice
강사: 오재혁
시간: 10년 10월 8일부터 총 10회, 금요일 오후 7시 30분 ~9시 30분
수강료: 300,000원



강좌 개요
iPhone의 매력은 사용 경험에 기반한다. 일상의 한 부분에 퍼즐 조각처럼 들어맞는, 어플리케이션을 사용하며 얻는 만족감은, 주변에서 쉽게 확인할 수 있다. 하지만, iPhone 플랫폼의 매력은 사용에 한정되지 않는다. iPhone 어플리케이션 제작은 더욱 농밀하고 치명적인 경험 기회를 제공한다. 직접 제작한, 자신만의 표현을 간직한 어플리케이션을, 전 세계에 배포할 수 있고, 그것을 매개로 소통할 수 있다는 가능성은, 제작자가 되기 위한 노력을 상쇄하고 남을 만큼의 가치를 제공한다.

본 강좌는 iPhone 어플리케이션 제작의 경험을 같이 하고자 하는 사용자를 대상으로 한다. 어플리케이션 제작을 위해 알아야 할 지식들을 살펴보고, 전반적인 기능을 연습해본다.

* 필요한 준비 사항
: 수강을 위해서는 Snow Leopard (Mac OS X 10.6.x) 이후 버전이 설치된 Mac 과 iPod Touch 혹은 iPhone이 필요합니다.



강사 소개
오재혁 / 프로그래머
서울대학교에서 컴퓨터공학을 전공하였으며 다수의 인터랙티브 설치 작업을 제작 및 지원해왔다. 현재 프리랜서로 설치 제작 및 team Gurunun 에서 아이폰 어플리케이션 제작에 주력하고 있다.



강좌 계획

1강: iPhone Framework
- iPhone SDK 내용 전반을 훑어본다.
- Xcode (어플리케이션 제작 환경) 사용법을 익힌다.
- SDK 에서 제공하는 template project 에서 간단한 어플리케이션을 만들고, 실행해본다.

2강:Objective-C, Cocoa
- Objective-C, Cocoa 의 역사, 특징을 이해한다.
- iPhone Application Project의 구성을 살펴본다.
- iPhone SDK 에서 원하는 부분을 찾아 사용하는 법을 배운다.

3강: Primitive Interface
- 기본적인 UI 컨트롤 (Button, TextField, Slider, Switch, Progress View, … ) 사용법을 익힌다.

4강: Advanced Interface
- Table View, Navigation Controller 를 사용하여 hierarchical list 를 구성해본다.

5강: Animation
- Core Animation 을 활용하여 UI 컨트롤을 움직여 본다.
- 보다 견고한 Animation 진행을 위한 State Machine 을 구성해본다.

6강: Quartz 2D, OpenGL ES
- Quartz 2D 를 사용한 그리기를 연습한다.
- OpenGL ES template project 를 분석하고, 3D Drawing 의 구성 요소를 이해한다.

7강: Touch, Accelerometer
- Accelerometer 값을 받아들여, 해석, 사용하는 법을 연습한다.
- Touch 입력을 처리하고, Gesture Recognizer 의 구조와 사용법을 이해한다.

8강: Audio
- iPod library 의 음악을 연주하는 법을 알아본다.
- 여러 음원을 동시에 출력하는 법을 알아본다.
- OpenAL 의 기능을 이해하고, 사용해본다.

9강: Advanced Audio
- Audio Queue 를 활용하여, linear PCM 을 출력해본다.
- Microphone 입력을 받아들이는 방법을 알아본다.

10강: Connection
- 웹의 데이터를 읽어들이는 방법을 연습해본다.
- GameKit 을 활용하여 peer-to-peer 통신을 시도해본다.



posted by maetel
2010. 9. 26. 19:18 Computation
How to Design Programs        
: An Introduction to Computing and Programming           

http://www.htdp.org/

Matthias Felleisen        
Robert Bruce Findler        
Matthew Flatt        
Shriram Krishnamurthi           

The MIT Press        
Cambridge, Massachusetts        
London, England

pdf download

'Computation' 카테고리의 다른 글

안드로이드 내부구조 #1  (0) 2011.10.24
매킨토시 스크린 샷 파일 포맷 변경법  (0) 2011.02.10
Octave on Mac OS X  (1) 2009.08.12
Cloud Computing 클라우드 컴퓨팅  (0) 2009.07.03
OpenFrameworks  (2) 2008.06.18
posted by maetel
2010. 5. 27. 20:53 Computer Vision
virtual object rendering test
가상의 그래픽 합성 시험

OpenGL 그래픽과 OpenCV 이미지 합성

camera로부터의 입력 이미지를 OpenCV 함수로 받아 IplImage 형태로 저장한 것과 OpenGL 함수로 그린 그래픽 정보를 합성하기


Way #1.

OpenCV의 카메라 입력으로 받은 image frame을 texture로 만들어 OpenGL의 디스플레이 창에 배경 (평면에 texture mapping)으로 넣고 여기에 그래픽을 그려 display하는 방법
ref. http://cafe.naver.com/opencv/12266

여차저차 조사 끝에 정리하면,
OpenGL에서 texture mapping을 실행하는 함수 glTexImage2D( )의 입력 텍스처로 OpenCV의 image data structure인 IplImage를 넣어 줄 수 있으면 끝난다.
ref.
http://www.gamedev.net/community/forums/topic.asp?topic_id=205527
http://www.rauwendaal.net/blog/opencvandopengl-1
ARTag source code: cfar_code/OpenGL/opengl_only_test/opengl_only_test.cpp
ARTag source code: cfar_code/IntroARProg/basic_artag_opengl/basic_artag_opengl.cpp

테스팅 중 발견한 문제점:
cvRetrieveFrame() 함수를 while 아래에서 돌려 cvShowImage() 함수로 보여 주는 대신 glutDisplayFunc() 함수에서 불러 glutMainLoop() 함수로 돌리면 시간이 많이 걸린다. (* cvGrabFrame() 함수의 경우는 괜찮음.)


ref. OpenGL Programming Guide - Chapter 9 - Texture Mapping
Textures are simply rectangular arrays of data - for example, color data, luminance data, or color and alpha data. The individual values in a texture array are often called texels.

The data describing a texture may consist of one, two, three, or four elements per texel, representing anything from a modulation constant to an (R, G, B, A) quadruple.

A texture object stores texture data and makes it readily available. You can now control many textures and go back to textures that have been previously loaded into your texture resources.


6일 동안의 갖은 삽질 끝에 몇 줄 되지도 않는 source code. ㅜㅜ

glLoadMarix( ) 함수




Way #2.

OpenCV에서 카메라로부터 얻은 image frame과 이로부터 계산한 OpenGL의 그래픽 정보를 OpenCV의 Iplimage로 넘기는 방법

ref.
http://cafe.naver.com/opencv/12622


http://webcache.googleusercontent.com/search?q=cache:xUG17-FlHQMJ:www.soe.ucsc.edu/classes/cmps260/Winter99/Winter99/handouts/proj1/proj1_99.html+tsai+opengl&cd=5&hl=ko&ct=clnk&gl=kr


http://www.google.com/codesearch/p?hl=ko#zI2h2OEMZ0U/~mgattass/ra/software/tsai.zip%7CsGIrNzsqK4o/tsai/src/main.c&q=tsai%20glut&l=9

http://www.google.com/codesearch/p?hl=ko#XWPk_ZdtAX4/classes/cmps260/Winter99/handouts/proj1/cs260proj1.tar.gz|DRo4_7nUzpo/CS260/camera.c&q=tsai%20glut&d=7


posted by maetel
2010. 5. 18. 00:26 Computer Vision
ref.
2010/02/10 - [Visual Information Processing Lab] - R. Y. Tsai "A Versatile Camera Calibration Technique for High Accuracy 3-D Maching Vision Metrology Using Off-the-shelf TV Cameras and Lenses"


(1) 고정되어 있는 것으로 가정한 카메라의 내부 파라미터 값들을 구하고 (2) 실시간으로 들어오는 이미지 프레임마다 카메라의 회전과 이동을 계산하기 위하여 Tsai 알고리즘을 쓰기로 하고, C 또는 C++로 구현된 소스코드 또는 라이브러리를 찾아서 붙여 보기로 한다.


Try #1.
처음에는 CMU의 Reg Willson가 C로 짠 Tsai Camera Calibration 코드 에서 필요한 부분을 include하여 쓰려고 했는데, C++ 문법에 맞지 않는 구식 C 문법으로 코딩된 부분이 많아서 고치는 데 애를 먹었다. (Xcode의 C++ 프로젝트에서 .c 파일을 include하면 compile은 되지만, linking error가 난다. 때문에 .c를 .cpp로 바꾸어야 함.)  그런데 결정적으로, "cal_main.cpp" 파일에 정의된, 캘리브레이션의 최종 결과값을 주는 함수들이 호출하는 optimization을 실행하는 함수 lmdif_()가  Fortan 파일 "lmdif.f"에 정의되어 있고, Fortran을 C로 변환해 주는 "f2c.h"에 의해 이것을 "lmdif.c"로 하여 가지고 있다는 문제가 있었다. lmdif.c를 lmdif.cpp 형태로 만들기 위해서는 Fortran 언어와 Fortran을 C++로 변환하는 방법을 알아야 하므로, 결국 포기했다.



Try #2.
Michigan State University Charles B. Owen Display-Relative Calibration (DRC)을 구현한 DRC 프로그램( DRC.zip )에서 카메라 캘리브레이션에 Tsai의 알고리즘 libtsai.zip을 쓰고 있다. 이 라이브러리는 위의 C 코드를 C++로 수정하면서 "CTsai"라는 클래스를 사용하고 여러 함수들을 수정/보완/결합한 것인데, Visual Studio 용 프로젝트 프로그램을 만들면서 Windows 환경에 기반하여 MFC를 활용하였다. 그래서 이것을 나의 Mac OS X 기반 Xcode 프로젝트에서 그대로 가져다 쓸 수는 없다. 용법은 다음과 같다.

DRC/DisplayRelativeCalibration.cpp:
bool CDisplayRelativeCalibration::ComputeCameraCalibration(void)
{
    CTsai tsai;

    tsai.Width(m_camerawid);
    tsai.Height(m_camerahit);

    for(std::list<Corr>::const_iterator i=m_cameracorr.begin();  i!=m_cameracorr.end();  i++)
    {
        tsai.Point(i->x, i->y, i->z, i->u, i->v);
    }

    if(tsai.PointCount() < 8)
        return Error("Didn't get enough points");

    if(!tsai.Compute())
        return Error("Camera calibration failed");

    for(int n=0;  n<tsai.PointCount();  n++)
    {
        double ux, uy;
        tsai.WorldToImage (tsai.PointX(n), tsai.PointY(n), tsai.PointZ(n), ux, uy);

        m_cameraproj.push_back(CGrPoint(ux, uy, 0));
    }

   
    m_cameraf = tsai.F();
    m_cameracx = tsai.Cx();
    m_cameracy = tsai.Cy();
    m_camerakappa1 = tsai.Kappa1();
    m_camerasx = tsai.Sx();
    memcpy(m_cameramatrix, tsai.CameraMatrix(), sizeof(double) * 16);

    return true;
}




문제점#1.

class CTsai 안의 member functions 중에  ncc_compute_exact_f_and_Tz( )와 ncc_compute_exact_f_and_Tz_error( )가 있는데,

libtsai.h:21
class CTsai
{

    bool ncc_compute_exact_f_and_Tz();
    bool ncc_compute_exact_f_and_Tz_error (int m_ptr, int n_ptr, const double *params, double *err);

};

전자인 ncc_compute_exact_f_and_Tz()가 정의된 부분을 보면, 

Tsai_ncc.cpp:274
bool CTsai::ncc_compute_exact_f_and_Tz()
{
    CLmdif<CTsai> lmdif;

    lmdif.Lmdif (this, ncc_compute_exact_f_and_Tz_error,
            m_point_count, NPARAMS, x,
            NULL, NULL, NULL, NULL);
}

클래스 형태의 템플릿( CLmdif )으로 선언된 "lmdif"의 member function "Lmdif"를 호출할 때, 

min/Lmdif.h:48
template<class T> class CLmdif : private CLmdif_
{

int Lmdif(T *p_user, bool (T::*p_func)(int m, int n, const double *parms, double *err),
        int m, int n, double *x, double *fvec, double *diag, int *ipvt, double *qtf)

};

후자인 같은 member function, ncc_compute_exact_f_and_Tz_error()를 인자로 넣고 있고 (위 부분 코드들 중 오렌지 색 부분), 컴파일 하면 이 부분을 <unknown type>으로 인식하지 못 하겠다는 에러 메시지를 보낸다. 그리고 다음과 같은 형태를 추천한다고 한다.
 
note: candidates are: int CLmdif<T>::Lmdif(T*, bool (T::*)(int, int, const double*, double*), int, int, double*, double*, double*, int*, double*) [with T = CTsai]

function pointer의 형태가 틀린 모양인데, 오렌지색 부분을 그냥 함수가 아닌 어떤 class의 non-static member function을 가리키는 pointer로  &CTsai::ncc_compute_exact_f_and_Tz_error 이렇게 바꾸어 주면, 에러 메시지가 다음과 같이 바뀐다.

error: no matching function for call to 'CLmdif<CTsai>::Lmdif(CTsai* const, bool (*)(int, int, const double*, double*), int&, const int&, double [3], NULL, NULL, NULL, NULL)'

연두색 부분 대신 CTsai::ncc_compute_exact_f_and_Tz_error 이렇게 바꾸어 주면, 에러 메시지가 다음과 같다.

error: no matching function for call to 'CLmdif<CTsai>::Lmdif(CTsai* const, bool (&)(int, int, const double*, double*), int&, const int&, double [3], NULL, NULL, NULL, NULL)'

해결:
편법으로, class CLmdif를 클래스 형 템플릿이 아닌 그냥 클래스로 바꾸어서 선언하고 연두색 부분처럼 호출하면 에러는 안 나기에 일단 이렇게 넘어가기로 한다.


문제점#2.
코드에서 Windows OS 기반 MFC를 사용하고 있어 Mac OS X에서 에러가 난다.

해결:
MFC를 사용하는 "StdAfx.h"는 모두 주석 처리한다.


문제점#3.
Lmdif.h



... 기타 등등의 문제점들을 해결하고, 캘리브레이션을 수행한 결과가 맞는지 확인하자.

source code:
           if ( CRimage.size() > 0 ) // if there is a valid point with its cross ratio
            {  
                correspondPoints(indexI, indexW, p, CRimage, linesYorder.size(), linesXorder.size(), world, CRworld, dxList.size(), dyList.size(), iplMatch, scale );
            }  
            cvShowImage( "match", iplMatch );
            cvSaveImage( "match.bmp", iplMatch );
           
            cout << "# of pairs = " << indexI.size() << " = " << indexW.size() << endl;
           
            // # 6. camera calibration
           
            int numPair = indexI.size();
           
            tsai.Clear();
           
            for( int n = 0;  n < numPair;  n++ )
            {
                tsai.Point(world[indexW[n]].x, world[indexW[n]].y, world[indexW[n]].z, p[indexI[n]].x, p[indexI[n]].y);
               
                cout << "pair #" << n << ": " << p[indexI[n]].x << "  " <<  p[indexI[n]].y << "  : "
                    << world[indexW[n]].x << "  " << world[indexW[n]].y << "  " << world[indexW[n]].z << endl;
            }
           
            if( numPair < 8 )
                cout << "Didn't get enough points" << endl;
           
            if(!tsai.Compute())
                cout << "Camera calibration failed" << endl;
           
            cout << endl << "camera parameter" << endl
            << "focus = " << tsai.F() << endl
            << "principal axis (x,y) = " <<  tsai.Cx() << ", " <<  tsai.Cy() << endl
            << "kappa1 (lens distortion) = " <<  tsai.Kappa1() << endl
            << "skew_x = " << tsai.Sx() << endl;
          
            // reproject world points on to the image frame to check the result of computing camera parameters
            for(int n=0;  n<tsai.PointCount();  n++)
            {
                double ux, uy;
                tsai.WorldToImage (tsai.PointX(n), tsai.PointY(n), tsai.PointZ(n), ux, uy);
                CvPoint reproj = cvPoint( cvRound(ux), cvRound(uy) );
                cvCircle( iplInput, reproj, 3, CV_RGB(200,100,200), 2 );
            }
           
// draw a cube on the image coordinate computed by camera parameters according to the world coordinate
            drawcube( tsai, iplInput, patSize );
            cvShowImage( "input", iplInput );  



아래 사진은 구해진 카메라 내부/외부 파라미터들을 가지고 (1) 실제 패턴의 점에 대응하는 이미지 프레임 (image coordinate) 상의 점을 찾아 (reprojection) 보라색 원으로 그리고, (2) 실제 패턴이 있는 좌표 (world coordinate)를 기준으로 한 graphic coordinate에 직육면체 cube를 노란색 선으로 그린 결과이다.

이미지 프레임과 실제 패턴 상의 점을 1 대 1로 비교하여 연결한 16쌍의 대응점

구한 카메라 파라미터를 가지고 실제 패턴 위의 점들을 이미지 프레임에 reproject한 결과 (보라색 점)와 실제 패턴의 좌표를 기준으로 한 그래픽이 이미지 프레임 상에 어떻게 나타나는지 그린 결과 (노란색 상자)

 

위 왼쪽 사진에서 보여지는 16쌍의 대응점들의 좌표값을 "이미지 좌표(x,y) : 패턴 좌표 (x,y,z)"로 출력한 결과:
# of pairs = 16 = 16
pair #0: 7.81919  36.7864  : 119.45  82.8966  0
pair #1: 15.1452  71.2526  : 119.45  108.484  0
pair #2: 26.1296  122.93  : 119.45  147.129  0
pair #3: 36.6362  172.36  : 119.45  182.066  0
pair #4: 77.3832  20.4703  : 159.45  82.8966  0
pair #5: 85.4293  53.7288  : 159.45  108.484  0
pair #6: 97.8451  105.05  : 159.45  147.129  0
pair #7: 109.473  153.115  : 159.45  182.066  0
pair #8: 96.6046  15.962  : 171.309  82.8966  0
pair #9: 105.046  48.8378  : 171.309  108.484  0
pair #10: 118.177  99.9803  : 171.309  147.129  0
pair #11: 130.4  147.586  : 171.309  182.066  0
pair #12: 145.469  4.50092  : 199.965  82.8966  0
pair #13: 154.186  36.5857  : 199.965  108.484  0
pair #14: 168.033  87.5497  : 199.965  147.129  0
pair #15: 180.732  134.288  : 199.965  182.066  0


그런데 위 오른쪽 사진에서 보여지는 결과는 이전 프레임에서 20쌍의 대응점으로부터 구한 카메라 파라미터 값을 가지고 계산한 결과이다.
# of found lines = 8 vertical, 7 horizontal
vertical lines:
horizontal lines:
p.size = 56
CRimage.size = 56

# of pairs = 20 = 20
pair #0: -42.2331  53.2782  : 102.07  108.484  0
pair #1: -22.6307  104.882  : 102.07  147.129  0
pair #2: -4.14939  153.534  : 102.07  182.066  0
pair #3: 1.81771  169.243  : 102.07  193.937  0
pair #4: -10.9062  41.1273  : 119.45  108.484  0
pair #5: 8.69616  92.7309  : 119.45  147.129  0
pair #6: 27.0108  140.945  : 119.45  182.066  0
pair #7: 32.9779  156.653  : 119.45  193.937  0
pair #8: 57.4164  14.6267  : 159.45  108.484  0
pair #9: 77.7374  65.9516  : 159.45  147.129  0
pair #10: 96.3391  112.934  : 159.45  182.066  0
pair #11: 102.524  128.555  : 159.45  193.937  0
pair #12: 76.5236  7.21549  : 171.309  108.484  0
pair #13: 97.5633  58.2616  : 171.309  147.129  0
pair #14: 116.706  104.705  : 171.309  182.066  0
pair #15: 123.108  120.238  : 171.309  193.937  0
pair #16: 125.015  -11.5931  : 199.965  108.484  0
pair #17: 146.055  39.453  : 199.965  147.129  0
pair #18: 164.921  85.2254  : 199.965  182.066  0
pair #19: 171.323  100.758  : 199.965  193.937  0

camera parameter
focus = 3724.66
principal axis (x,y) = 168.216, 66.5731
kappa1 (lens distortion) = -6.19473e-07
skew_x = 1



대응점 연결에 오차가 없으면, 즉, 패턴 인식이 잘 되면, Tsai 알고리즘에 의한 카메라 파라미터 구하기가 제대로 되고 있음을 확인할 수 있다. 하지만, 현재 full optimization (모든 파라미터들에 대해 최적화 과정을 수행하는 것)으로 동작하게 되어 있고, 프레임마다 모든 파라미터들을 새로 구하고 있기 때문에, 속도가 매우 느리다. 시험 삼아 reprojection과 간단한 graphic을 그리는 과정은 속도에 큰 영향이 없지만, 그전에 카메라 캘리브레이션을 하는 데 필요한 계산 시간이 길다. 입력 프레임이 들어오는 시간보다 훨씬 많은 시간이 걸려 실시간 구현이 되지 못 하고 있다.

따라서, (1) 내부 파라미터는 첫 프레임에서 한 번만 계산하고 (2) 이후 매 프레임마다 외부 파라미터 (카메라의 회전과 이동)만을 따로 계산하는 것으로 코드를 수정해야 한다.




Try#3.
OpenCV 함수 이용

1) 내부 파라미터 계산
cvCalib
rateCamera2


2) lens distortion(kappa1, kappa2)을 가지고 rectification
cvInitUndistortRectifyMap

3) line detection

4) 패턴 인식 (대응점 찾기)

5) 외부 파라미터 계산 (4의 결과 & lens distortion = 0 입력)
cvFindExtrinsicCameraParams2

6) reprojection
2)에서 얻은 rectificated image에 할 것


posted by maetel
2010. 2. 9. 01:34 Computation/Language
Google C++ Style Guide
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml    informed by jinho

C++ coding standards: 101 rules, guidelines, and best practices  By Herb Sutter, Andrei Alexandrescu

Code Complete by Steven C. McConnell
http://cc2e.com/


Code Craft: the practice of writing excellent code By Pete Goodliffe
http://oreilly.com/catalog/9781593271190   informed by neuralix



'Computation > Language' 카테고리의 다른 글

windows.h  (0) 2008.09.10
Communications Functions (Windows)  (0) 2008.08.14
visual c++ solution - dsw  (0) 2008.08.12
16진수 10진수로 변환 strtol()  (0) 2008.08.12
numeric library  (0) 2008.03.18
posted by maetel
2009. 11. 17. 15:48 Computer Vision
Kalman Filtering
http://academic.csuohio.edu/simond/courses/eec644/kalman.pdf

72-79p, Embedded Systems Programming f e a tur e, JUNE 2001
http://www.embedded.com/9900168?_requestid=49635

The Kalman filter update equations in C
http://www.embedded.com/9900168?pgno=2
matrix algebra reference
ftp://ftp.embedded.com/pub/2001/simon06


Dan Simon 
http://academic.csuohio.edu/simond/


Kalman filter
: estimates system states that can only be observed indirectly or inaccurately by the system itself.
: estimates the variables of a wide range of processes.
: estimates the states of a linear system.
: minimizes the variance of the estimation error

Linear system
x: state of the system
u: known input to the system
y: measured output
w: process noise
z: measurement noise


http://wiki.answers.com/Q/What_is_a_feedback_system
A feedback system, in general engineering terms, is a system whose output if fed back to the input, and depending on the output, your input is adjusted so as to reach a steady-state. In colloquial language, you adjust your input based on the output of your system so as to achieve a certain end, like minimizing disturbance, cancelling echo (in a speech system) and so on.


Criteria of an Estimator
1) The expected value of the estimate should be equal to the expected value of the state.
2) The estimator should be with the smallest possible error variance.


Requirement of Kalman filter
1) The average value of w is zero and average value of z is zero.
2) No correlation exists between w and z. w_k and z_k are independent random variables.


Kalman filter equations

K matrix: Kalman gain
P matrix: estimation error covariance



http://en.wikipedia.org/wiki/Three_sigma_rule
In statistics, the 68-95-99.7 rule, or three-sigma rule, or empirical rule, states that for a normal distribution, nearly all values lie within 3 standard deviations of the mean.


"steady state Kalman filter"
 - K matrix & P matrix are constant

"extended Kalman filter"
: an extension of linear Kalman filter theory to nonlinear systems

"Kalman smoother"
: to estimate the state as a function of time so to reconstruct the trajectory after the fact


H infinity filter
=> correlated noise problem
=> unknown noise covariances problem

http://academic.csuohio.edu/simond/estimation/


Rudolph Kalman

Peter Swerling, 1958

Karl Gauss's method of least squares, 1795

spacecraft navigation for the Apollo space program


> applications
all forms of navigation (aerospace, land, and marine)
nuclear power plant instrumentation
demographic modeling
manufacturing
the detection of underground radioactivity
fuzzy logic and neural network training



Gelb, A. Applied Optimal Estimation. Cambridge, MA: MIT Press, 1974.

Anderson, B. and J. Moore. Optimal Filtering. Englewood Cliffs, NJ: Prentice-Hall, 1979.

Grewal, M. and A. Andrews. Kalman Filtering Theory and Practice. Englewood Cliffs, NJ: Prentice-Hall, 1993.

Sorenson, H. Kalman Filtering: Theory and Application. Los Alamitos, CA: IEEE Press, 1985.

Peter Joseph’s Web site @http://ourworld.compuserve.com/homepages/PDJoseph/

posted by maetel
2009. 8. 5. 14:36 Computer Vision
Oxford 대학  Active Vision Group에서 개발한
PTAM (Parallel Tracking and Mapping for Small AR Workspaces)
http://www.robots.ox.ac.uk/~gk/PTAM/

Questions? E-mail ptam@robots.ox.ac.uk


0. requirements 확인

readme 파일에서 언급하는 대로 프로세서와 그래픽카드를 확인하니

내가 설치할 컴퓨터 사양:
Model Name:    Mac mini
  Model Identifier:    Macmini3,1
  Processor Name:    Intel Core 2 Duo
  Processor Speed:    2 GHz
  Number Of Processors:    1
  Total Number Of Cores:    2
  L2 Cache:    3 MB
  Memory:    1 GB
  Bus Speed:    1.07 GHz
  Boot ROM Version:    MM31.0081.B00

그래픽 카드:
NVIDIA GeForce 9400

"Intel Core 2 Duo processors 2.4GHz+ are fine."이라고 했는데, 2.0이면 되지 않을까? 그래픽 카드는 동일한 것이니 문제 없고.


1. library dependency 확인

1. TooN - a header library for linear algebra
2. libCVD - a library for image handling, video capture and computer vision
3. Gvars3 - a run-time configuration/scripting library, this is a sub-project of libCVD.
셋 다 없으므로,

1-1. TooN 다운로드

TooN (Tom's object oriented Numerics)선형대수 (벡터, 매트릭스 연산)를 위해 Cambridge Machine Intelligence lab에서 개발한 C++ 라이브러리라고 한다.

ref. TooN Documentation (<- 공식 홈보다 정리가 잘 되어 있군.)

다음과 같은 명령으로 다운로드를 받는다.
%% cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/toon co TooN

실행 결과:

생성된 TooN 폴더에 들어가서
%%% ./configure

실행 결과:


1-1-1. 더 안정적인(?) 버전을 받으려면

%% cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/toon co -D "Mon May 11 16:29:26 BST 2009" TooN

실행 결과:


1-2. libCVD 다운로드

libCVD (Cambridge Video Dynamics)같은 연구실에서 만든 컴퓨터 비전 관련 이미지 처리를 위한 C++ 라이브러리

ref. CVD documentation

%% cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/libcvd co -D "Mon May 11 16:29:26 BST 2009" libcvd

실행 결과:



1-3. Gvars3 다운로드

Gvars3 (configuration system library)
 
%% cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/libcvd co -D "Mon May 11 16:29:26 BST 2009" gvars3

실행 결과:


2. 다운로드한 기반 라이브러리 설치

2-1. TooN 설치

2-1-1. configure file 실행

configure scripts는 source code를 compile하고 실행시킬 수 있게 만들어 주는 것.

생성된 TooN 폴더에 들어가서
%%% ./configure

실행 결과:

2-1-2. 설치

(TooN은 헤더파일들의 모음이므로 compile이 필요없다.)

%%% sudo make install

실행 결과:
mkdir -p //usr/local/include/TooN
cp *.h //usr/local/include/TooN
cp -r optimization //usr/local/include/TooN/
cp -r internal //usr/local/include/TooN/


2-2. libCVD 설치

2-2-1. configure 파일 실행

생성된 libCVD 폴더에 들어가서
%%% export CXXFLAGS=-D_REENTRANT
%%% ./configure --without-ffmpeg

실행 결과:

2-2-2. documents 생성 (생략해도 되는 듯)

다시 시도했더니
%%% make docs

make: *** No rule to make target `docs'.  Stop.
여전히 안 되는 듯... 아! doxygen을 맥포트로 설치해서 그런가 보다. (데이터베이스가 서로 다르다고 한다.)_M#]


2-2-3. compile 컴파일하기

%%% make

실행 결과:


2-2-4. install 설치하기

%%% sudo make install

실행 결과:


2-3. Gvars3  설치

2-3-1. configure 파일 실행

Gvars3 폴더에 들어가서
%%% ./configure --disable-widgets

실행 결과:


2-3-2. compile 컴파일하기

%%% make

실행 결과:


2-3-3. install 설치하기

%%% sudo make install

mkdir -p //usr/local/lib
cp libGVars3.a libGVars3_headless.a //usr/local/lib
mkdir -p //usr/local/lib
cp libGVars3-0.6.dylib //usr/local/lib
ln -fs  //usr/local/lib/libGVars3-0.6.dylib //usr/local/lib/libGVars3-0.dylib
ln -fs  //usr/local/lib/libGVars3-0.dylib //usr/local/lib/libGVars3.dylib
mkdir -p //usr/local/lib
cp libGVars3_headless-0.6.dylib //usr/local/lib
ln -fs  //usr/local/lib/libGVars3_headless-0.6.dylib //usr/local/lib/libGVars3_headless-0.dylib
ln -fs  //usr/local/lib/libGVars3_headless-0.dylib //usr/local/lib/libGVars3_headless.dylib
mkdir -p //usr/local/include
cp -r gvars3 //usr/local/include


2-4. OS X에서의 컴파일링과 관련하여

ref. UNIX에서 컴파일하기
Porting UNIX/Linux Applications to Mac OS X: Compiling Your Code in Mac OS X



3. PTAM 컴파일

3-1. 해당 플랫폼의 빌드 파일을 PTAM source 디렉토리로 복사

내 (OS X의) 경우, PTAM/Build/OS X에 있는 모든 (두 개의) 파일 Makefile과 VideoSource_OSX.cc를 PTAM 폴더에 옮겼다.

3-2. video source 셋업

카메라에 맞는 video input file을 컴파일하도록 Makefile을 수정해 주어야 한다.
맥의 경우, (아마도 Logitech Quickcam Pro 5000 을 기준으로 하는) 하나의 소스 파일만이 존재하므로 그대로 두면 될 듯.

3-3. video source 추가

다른 비디오 소스들은 libCVD에 클래스로 만들어져 있다고 한다. 여기에 포함되어 있지 않은 경우에는 VideoSource_XYZ.cc 라는 식의 이름을 갖는 파일을 만들어서 넣어 주어야 한다.

3-4. compile

PTAM 폴더에 들어가서
%% make

실행 결과:
g++ -g -O3 main.cc -o main.o -c -I /MY_CUSTOM_INCLUDE_PATH/ -D_OSX -D_REENTRANT
g++ -g -O3 VideoSource_OSX.cc -o VideoSource_OSX.o -c -I /MY_CUSTOM_INCLUDE_PATH/ -D_OSX -D_REENTRANT
g++ -g -O3 GLWindow2.cc -o GLWindow2.o -c -I /MY_CUSTOM_INCLUDE_PATH/ -D_OSX -D_REENTRANT
In file included from OpenGL.h:20,
                 from GLWindow2.cc:1:
/usr/local/include/cvd/gl_helpers.h:38:19: error: GL/gl.h: No such file or directory
/usr/local/include/cvd/gl_helpers.h:39:20: error: GL/glu.h: No such file or directory
/usr/local/include/cvd/gl_helpers.h: In function 'void CVD::glPrintErrors()':
/usr/local/include/cvd/gl_helpers.h:569: error: 'gluGetString' was not declared in this scope
make: *** [GLWindow2.o] Error 1

이 에러 메시지는 다음 링크에서 논의되고 있는 문제와 비슷한 상황인 것 같다.
http://en.allexperts.com/q/Unix-Linux-OS-1064/Compiling-OpenGL-unix-linux.htm


3-4-1. OpenGL on UNIX

PTAM이 OpenGL을 사용하고 있는데, OpenGL이 Mac에 기본으로 설치되어 있으므로 신경쓰지 않았던 부분이다. 물론 system의 public framework으로 들어가 있음을 확인할 수 있다. 그런데 UNIX 프로그램에서 접근할 수는 없는가? (인터넷에서 검색해 보아도 따로 설치할 수 있는 다운로드 링크나 방법을 찾을 수 없다.)

에러 메시지에 대한 정확한 진단 ->
philphys: 일단 OpenGL은 분명히 있을 건데 그 헤더파일과 라이브러리가 있는 곳을 지정해 주지 않아서 에러가 나는 것 같아. 보통 Makefile에 이게 지정되어 있어야 하는데 실행결과를 보니까 전혀 지정되어 있지 않네. 중간에 보면 -I /MY_CUSTOM_INCLUDE_PATH/ 라는 부분이 헤더 파일의 위치를 지정해 주는 부분이고 또 라이브러리는 뒤에 링크할 때 지정해 주게 되어 있는데 거기까지는 가지도 못 했네.
즉, "링커가 문제가 아니라, 컴파일러 옵션에 OpenGL의 헤더파일이 있는 디렉토리를 지정해 주어야 할 것 같다"고 한다.

문제의 Makefile을 들여다보고

Makefile을 다음과 같이 수정하고 (보라색 부분 추가)
COMPILEFLAGS = -I /MY_CUSTOM_INCLUDE_PATH/ -D_OSX -D_REENTRANT -I/usr/X11R6/include/

philphys: /usr/X11R6/include 밑에 GL 폴더가 있고 거기에 필요한 헤더파일들이 모두 들어 있다. 그래서 코드에선 "GL/gl.h" 하는 식으로 explicit하게 GL 폴더를 찾게 된다.

그러고 보면 아래와 같은 설명이 있었던 것이다.
Since the Linux code compiles directly against the nVidia driver's GL headers, use of a different GL driver may require some modifications to the code.

다시 컴파일 하니,
실행 결과:

설치 완료!
두 실행파일 PTAM과 CameraCalibrator이 생성되었다.


3-5. X11R6에 대하여

X11R6 = Xwindow Verion 11 Release 6

Xwindow
X.org



4. camera calibration

CameraCalibrator 파일을 실행시켜 카메라 캘리브레이션을 시도했더니 GUI 창이 뜨는데 연결된 웹캠(Logitech QuickCam Pro 4000)으로부터 입력을 받지 못 한다.

4-0. 증상

CameraCalibrator 실행파일을 열면, 다음과 같은 터미널 창이 새로 열린다.
Last login: Fri Aug  7 01:14:05 on ttys001
%% /Users/lym/PTAM/CameraCalibrator ; exit;
  Welcome to CameraCalibrator
  --------------------------------------
  Parallel tracking and mapping for Small AR workspaces
  Copyright (C) Isis Innovation Limited 2008

  Parsing calibrator_settings.cfg ....
! GUI_impl::Loadfile: Failed to load script file "calibrator_settings.cfg".
  VideoSource_OSX: Creating QTBuffer....
  IMPORTANT
  This will open a quicktime settings planel.
  You should use this settings dialog to turn the camera's
  sharpness to a minimum, or at least so small that no sharpening
  artefacts appear! In-camera sharpening will seriously degrade the
  performance of both the camera calibrator and the tracking system.

그리고 Video란 이름의 GUI 창이 열리는데, 이때 아무런 설정을 바꾸지 않고 그대로 OK를 누르면 위의 터미널 창에 다음과 같은 메시지가 이어지면서 자동 종료된다.
  .. created QTBuffer of size [640 480]
2009-08-07 01:20:57.231 CameraCalibrator[40836:10b] ***_NSAutoreleaseNoPool(): Object 0xf70e2c0 of class NSThread autoreleasedwith no pool in place - just leaking
Stack: (0x96827f0f 0x96734442 0x9673a1b4 0xbc2db7 0xbc7e9a 0xbc69d30xbcacbd 0xbca130 0x964879c9 0x90f8dfb8 0x90e69618 0x90e699840x964879c9 0x90f9037c 0x90e7249c 0x90e69984 0x964879c9 0x90f8ec800x90e55e05 0x90e5acd5 0x90e5530f 0x964879c9 0x94179eb9 0x282b48 0xd9f40xd6a6 0x2f16b 0x2fea4 0x26b6)
! Code for converting from format "Raw RGB data"
  not implemented yet, check VideoSource_OSX.cc.

logout

[Process completed]

그러므로 3-3의 문제 -- set up video source (비디오 소스 셋업) --로 돌아가야 한다.
즉, VideoSource_OSX.cc 파일을 수정해서 다시 컴파일한 후 실행해야 한다.

Other video source classes are available with libCVD. Finally, if a custom video source not supported by libCVD is required, the code for it will have to be put into some VideoSource_XYZ.cc file (the interface for this file is very simple.)

삽질...



4-1. VideoSource_OSX.cc 파일 수정



수정한 VideoSource 파일

터미널 창:
Welcome to CameraCalibrator
  --------------------------------------
  Parallel tracking and mapping for Small AR workspaces
  Copyright (C) Isis Innovation Limited 2008

  Parsing calibrator_settings.cfg ....
  VideoSource_OSX: Creating QTBuffer....
  IMPORTANT
  This will open a quicktime settings planel.
  You should use this settings dialog to turn the camera's
  sharpness to a minimum, or at least so small that no sharpening
  artefacts appear! In-camera sharpening will seriously degrade the
  performance of both the camera calibrator and the tracking system.
>   .. created QTBuffer of size [640 480]
2009-08-13 04:02:50.464 CameraCalibrator[6251:10b] *** _NSAutoreleaseNoPool(): Object 0x9df180 of class NSThread autoreleased with no pool in place - just leaking
Stack: (0x96670f4f 0x9657d432 0x965831a4 0xbc2db7 0xbc7e9a 0xbc69d3 0xbcacbd 0xbca130 0x924b09c9 0x958e8fb8 0x957c4618 0x957c4984 0x924b09c9 0x958eb37c 0x957cd49c 0x957c4984 0x924b09c9 0x958e9c80 0x957b0e05 0x957b5cd5 0x957b030f 0x924b09c9 0x90bd4eb9 0x282b48 0xd414 0xcfd6 0x2f06b 0x2fda4)



4-2. Camera Calibrator 실행


Camera calib is [ 1.51994 2.03006 0.499577 0.536311 -0.0005 ]
  Saving camera calib to camera.cfg...
  .. saved.



5. PTAM 실행


  Welcome to PTAM
  ---------------
  Parallel tracking and mapping for Small AR workspaces
  Copyright (C) Isis Innovation Limited 2008

  Parsing settings.cfg ....
  VideoSource_OSX: Creating QTBuffer....
  IMPORTANT
  This will open a quicktime settings planel.
  You should use this settings dialog to turn the camera's
  sharpness to a minimum, or at least so small that no sharpening
  artefacts appear! In-camera sharpening will seriously degrade the
  performance of both the camera calibrator and the tracking system.
>   .. created QTBuffer of size [640 480]
2009-08-13 20:17:54.162 ptam[1374:10b] *** _NSAutoreleaseNoPool(): Object 0x8f5850 of class NSThread autoreleased with no pool in place - just leaking
Stack: (0x96670f4f 0x9657d432 0x965831a4 0xbb9db7 0xbbee9a 0xbbd9d3 0xbc1cbd 0xbc1130 0x924b09c9 0x958e8fb8 0x957c4618 0x957c4984 0x924b09c9 0x958eb37c 0x957cd49c 0x957c4984 0x924b09c9 0x958e9c80 0x957b0e05 0x957b5cd5 0x957b030f 0x924b09c9 0x90bd4eb9 0x282b48 0x6504 0x60a6 0x11af2 0x28da 0x2766)
  ARDriver: Creating FBO...  .. created FBO.
  MapMaker: made initial map with 135 points.
  MapMaker: made initial map with 227 points.


The software was developed with a Unibrain Fire-i colour camera, using a 2.1mm M12 (board-mount) wide-angle lens. It also runs well with a Logitech Quickcam Pro 5000 camera, modified to use the same 2.1mm M12 lens.

iSight를 Netmate 1394B 9P Bilingual to 6P 케이블로  MacMini에 연결하여 해 보니 더 잘 된다.



'Computer Vision' 카테고리의 다른 글

UNIX references  (0) 2009.08.17
PTAM to be dissected on OS X  (0) 2009.08.17
SLAM related generally  (0) 2009.08.04
Kalman Filter  (0) 2009.07.30
OpenCV 1.0 설치 on Mac OS X  (0) 2009.07.27
posted by maetel
2009. 7. 27. 20:50 Computer Vision
http://opencv.willowgarage.com/wiki/InstallGuide

http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port

Installing OpenCV on OS/X with Python - Princess Polymath


0. MacPorts 설치 -> 참조

1. SubVersion 설치

%% sudo port install subversion
Password:




2. OpenCV 다운로드

%% svn co http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk opencv



3. 다운로드 받은 OpenCV 확인

%% port search opencv

opencv @1.0.0 (graphics, science)
    Intel(R) Open Source Computer Vision Library


3-1. 좀 더 자세한 정보 보기

%% port info opencv

opencv @1.0.0 (graphics, science)
Variants:    universal

opencv is a library that is mainly aimed at real time computer
vision. Some example areas would be Human-Computer Interaction
(HCI), Object Identification, Segmentation and Recognition, Face
Recognition, Gesture Recognition, Motion Tracking, Ego Motion,
Motion Understanding, Structure From Motion (SFM), and Mobile
Robotics.
Homepage:    http://www.intel.com/technology/computing/opencv/

Library Dependencies: gtk2, zlib, jpeg, libpng, tiff
Platforms:            darwin
Maintainers:          stante@gmail.com



4. OpenCV 설치하기

OpenCV 공식 위키의 설명대로 하면 안 되어서,
( cf. http://en.wikipedia.org/wiki/CMake
http://www.cmake.org/ )

예전에 Freeimage를 설치했던 과정을 참고로 MacPorts를 사용하자.
ref. http://opencv.darwinports.com/


%% sudo port install opencv



4-1. Python 2.5를 (OpenCV의 무엇에 대해서란 말인지는 모르겠으나;;;) 기본으로 설정하기

(맥에 파이썬이 기본으로 설치되어 있음은 나도 알고 있다. 여기에서는 버전을 지정/설정해 주라는 뜻인 것 같은데... 확실치 않다...)
To fully complete your installation and make python 2.5 the default, please run

    sudo port install python_select 
    sudo python_select python25

위와 같은 메시지가 있기에, 그대로..
%% sudo port install python_select 

실행 결과:
--->  Fetching python_select
--->  Attempting to fetch select-0.2.1.tar.gz from http://svn.macports.org/repository/macports/contrib/select/
--->  Verifying checksum(s) for python_select
--->  Extracting python_select
--->  Configuring python_select
--->  Building python_select
--->  Staging python_select into destroot
--->  Installing python_select @0.2.1_0+darwin_9
--->  Activating python_select @0.2.1_0+darwin_9
--->  Cleaning python_select

그리고...
%% sudo python_select python25

Selecting version "python25" for python


4-2. Python에 대하여

그냥 한 번 보기 (버전 업그레이드해야 하는 지도 모르고 하니...)
%% port info python25

python25 @2.5.4, Revision 6 (lang)
Variants:    darwin_10, darwin_7, darwin_8, darwin_9, macosx,
             puredarwin, universal

Python is an interpreted, interactive, object-oriented programming
language.
Homepage:    http://www.python.org/

Library Dependencies: gettext, zlib, openssl, tk, sqlite3, db46,
                      bzip2, gdbm, readline, ncurses
Platforms:            darwin
Maintainers:          mww@macports.org


cf.
http://wiki.python.org/moin/MacPython/Leopard
(상위 버전이 나왔으나 지금은 OpenCV를 위해서라면 그대로 2.5가 괜찮을 듯.)

ref.
Installing OpenCV on OS/X with Python - Princess Polymath


4-3. Mac에서 Unix application을  porting하는 문제에 대하여

http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/



4-4. private framework

공식 위키의 안내대로 OpenCV를 Xcode에서 부를 수 있도록 Mac OS X용 frameworks를 만들기 위해,
생성된 opencv 폴더 아래에서 make_frameworks.sh가  opencv 폴더에 있음을 확인하고 실행을 시켰다.

%% ./make_frameworks.sh

실패. 빌딩 준비만 하다가 끝난 것이라고 한다.



5. Xcode에서 OpenCV frameworks 추가하기

frameworks에는 public과 private이 있는데, OpenCV는 private framework이다.
(Mac의 public frameworks들은 /System/Library/Framework 에 있다.)


5-1. OpenCV  프레임웍 추가

4-4의 시도가 실패했으므로 (이를 바로잡기보다 우선은 편하게),
아래 링크에서 미리 built된 맥용 OpenCV frameworks를 다운로드 한다. (또는 두번째 링크에서 1.2버전 바로 받기 )
Institut für Nachrichtentechnik – OpenCV - Universal Binary Frameworks for MacOS X

.dmg 파일을 실행시켜 마운트된 이미지에서 OpenCV.framework 폴더를
/Library/Frameworks 에 넣는다.

5-2. Xcode 프로젝트에 프레임웍 삽입 (Xcode 3.1 기준)

Xcode를 열고 새 프로젝트 Command Line Utility / C++ Tool 을 만들고,
(자동으로 프로젝트와 동일명의 target 이 생성됨)
왼쪽 바 Groups & Files에서 프로젝트를 오른쪽 마우스 클릭하여 Add > Existing Frameworks 선택한다.
탐색창이 뜨면 /Library/Frameworks/OpenCV.framework 를 찾아 추가한다.

5-3. 테스트

아래 링크들의 예제 파일들을 실행시켜 본다.

ref.
http://stefanix.net/opencv-in-xcode
Wonwoo's Life DB :: OpenCV를 MAC OS X의 XCODE 에서 사용하기
Phillip Whisenhunt - Using openCV for Mac OS in XCode
Installing OpenCV on Mac OS X - NUI Group Community Wiki


5-4. Mac에서의 frameworks에 대하여
 
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port 를 보고도 헤매여야 했던 이유를
http://opencv.willowgarage.com/wiki/PrivateFramework 에서 알 수 있었다.

ADC: Framework Programming Guide: Creating a Framework
A framework is a hierarchical directory that encapsulates shared resources, such as a dynamic shared library, nib files, image files, localized strings, header files, and reference documentation in a single package.

A framework is also a bundle and its contents can be accessed using Core Foundation Bundle Services or the Cocoa NSBundle class.

Frameworks can include a wider variety of resource types than libraries.

http://en.wikipedia.org/wiki/Framework

http://en.wikipedia.org/wiki/Software_framework


OpenCV is a Private Framework
(2007-06-10, Mark Asbach)

posted by maetel
Sahni
Data Structures, Algorithms and Applications in C++, 2nd ed.
: Chapter 16 Graphs

graph data structure

terminology:
vertex, edge, adjacent, incident, degree, cycle, path, connected component, and spanning tree

types:
undirected / directed / weighted

representation:
adjacent matrix / array adjacency lists /  linked adjacency lists

standard graph search methods:
breadth-first / depth-first search

algorithms:



16.1 Definitions

graph
: an ordered pair of finite sets of vertices (or nodes or points) and edges (or arcs or lines)

http://en.wikipedia.org/wiki/Graph_(data_structure)

loop
: self-edge

digraph
: directed graph

network
: weighted undirected graph or digraph


16.2 Applications and More Definitions

example 16.1: path problems

example 16.2: spanning trees

A graph is connected iff there is a path between every pair of vertices in the graph.

cycle
: simiple path with the same start and end vertex

tree
: a connected undirected graph that contains no cycles

spanning tree
: a subgraph of a graph that contains all the vertices of the graph and is a tree

example 16.3: interpreters

bipartite graphs


16.3 Properties

http://en.wikipedia.org/wiki/List_of_graph_theory_topics

in-degree
out-degree

complete digraph


16.4 The ADT graph
16.5 Representation of Unweighted Graphs

adjacency matrix
linked adjacency list
array adjacency list

http://en.wikipedia.org/wiki/Adjacency_matrix

http://en.wikipedia.org/wiki/Adjacency_list
16.6 Representation of Weighted Graphs


cost-adjacency-matrix


16.7 Class Implementations

 
16.8 Graph Search Methods

cp. level-order traversal of a binary tree
http://en.wikipedia.org/wiki/Binary_search_tree#Traversal

cp. pre-order traversal of a binary tree
 
 


 
posted by maetel
2008. 8. 16. 22:31 Hardware/network



08-07-24

long CSGLSDlg::lCom_RcvData( WPARAM wParam, LPARAM lParam )
{
 if(Rvd_flag)
 {
  register int nRcvSize = (int)lParam; // data length
 
  for( int i=0;i<nRcvSize;i++)
  {   
   data1[i]=m_Commthread->g_byRcvBuf[i];
   fprintf(_fp1,"%02X\t",data1[i]);
  }

  fprintf(_fp1,"\n");
  m_nData++;
  UpdateData(FALSE);
 }
 return 1;
 
}


08-07-27

long CSGLSDlg::lCom_RcvData( WPARAM wParam, LPARAM lParam )
{

 if(Rvd_flag)
 {
  register int nRcvSize = (int)lParam; // data length

  for( int i=0;i<nRcvSize;i++)
  {   
   data1[i]=m_Commthread->g_byRcvBuf[i];
   fprintf(_fp1,"%02X\t",data1[i]);
  }

  if((ByteCount+nRcvSize) >= 25)
  {
   ByteCount = ByteCount - 25;
  }

  for(i=0;i<nRcvSize;i++)
  {
   if((ByteFlag==false)&&(data1[i]==250))
   {
    IdenFlag = true;
    StartIden[0] = data1[i];
   }
   else
   {
    if(IdenFlag==true)
    {
     if(data1[i] == 175)
     {
      StartIden[1] = data1[i];
     }
     else if(data1[i] == 32)
     {
      StartIden[2] = data1[i];
     }
     else if(data1[i] == 170)
     {
      StartIden[3] = data1[i];
      IdenFlag = false;
      ByteFlag = true;
     }
    }
    else
    {
     if(((ByteCount+i)==16)&&(ByteFlag==true))
     {
      Magneto[0] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[0]);
     }
     else if(((ByteCount+i)==17)&&(ByteFlag==true))
     {
      Magneto[1] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[1]);
     }
     else if(((ByteCount+i)==18)&&(ByteFlag==true))
     {
      Magneto[2] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[2]);
     }
     else if(((ByteCount+i)==19)&&(ByteFlag==true))
     {
      Magneto[3] = data1[i];
      // ByteFlag = false;

      fprintf(_fp2,"%02X\t",Magneto[3]);
     }
     else if(((ByteCount+i)==20)&&(ByteFlag==true))
     {
      Magneto[4] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[4]);
     }
     else if(((ByteCount+i)==21)&&(ByteFlag==true))
     {
      Magneto[5] = data1[i];
      fprintf(_fp2,"%02X\t",Magneto[5]);
      ByteFlag = false;
     }    
    } // else
   } // else
  } // for

  ByteCount = ByteCount + nRcvSize;

  fprintf(_fp1,"\n");
  fprintf(_fp2,"\n");
  m_nData++;
  UpdateData(FALSE);
 }
 return 1;
}


08-08-11

long CSGLSDlg::lCom_RcvData( WPARAM wParam, LPARAM lParam )
{   // check
 if(Rvd_flag)
 {
  register int nRcvSize = (int)lParam; // data length

  for( int i=0;i<nRcvSize;i++)
  {   
   data1[i]=m_Commthread->g_byRcvBuf[i];
   fprintf(_fp1,"%02X\t",data1[i]);
  }

  if((ByteCount+nRcvSize) >= 25)
  {
   ByteCount = ByteCount - 25;
  }

  for(i=0;i<nRcvSize;i++)
  {
   if((ByteFlag==false)&&(data1[i]==250))
   {
    IdenFlag = true;
    StartIden[0] = data1[i];
   }
   else
   {
    if(IdenFlag==true)
    {
     if(data1[i] == 175)
     {
      StartIden[1] = data1[i];
     }
     else if(data1[i] == 32)
     {
      StartIden[2] = data1[i];
     }
     else if(data1[i] == 170)
     {
      StartIden[3] = data1[i];
      IdenFlag = false;
      ByteFlag = true;
     }
    }
    else
    {
     if(((ByteCount+i)==16)&&(ByteFlag==true))
     {
      Magneto[0] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[0]);

      temp_m = Magneto[0]>>4;
      temp_l = Magneto[0]<<4;
      bit_order = temp_m | temp_l;
      fprintf(_fp2,"%02x\t",bit_order);
     }
     else if(((ByteCount+i)==17)&&(ByteFlag==true))
     {
      Magneto[1] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[1]);

      temp_m = Magneto[1]>>4;
      temp_l = Magneto[1]<<4;
      bit_order = temp_m | temp_l;
      fprintf(_fp2,"%02x\t",bit_order);
     }
     else if(((ByteCount+i)==18)&&(ByteFlag==true))
     {
      Magneto[2] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[2]);

      temp_m = Magneto[2]>>4;
      temp_l = Magneto[2]<<4;
      bit_order = temp_m | temp_l;
      fprintf(_fp2,"%02x\t",bit_order);
     }
     else if(((ByteCount+i)==19)&&(ByteFlag==true))
     {
      Magneto[3] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[3]);

      temp_m = Magneto[3]>>4;
      temp_l = Magneto[3]<<4;
      bit_order = temp_m | temp_l;
      fprintf(_fp2,"%02x\t",bit_order);
     }
     else if(((ByteCount+i)==20)&&(ByteFlag==true))
     {
      Magneto[4] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[4]);

      temp_m = Magneto[4]>>4;
      temp_l = Magneto[4]<<4;
      bit_order = temp_m | temp_l;
      fprintf(_fp2,"%02x\t",bit_order);
     }
     else if(((ByteCount+i)==21)&&(ByteFlag==true))
     {
      Magneto[5] = data1[i];
      fprintf(_fp2,"%02X\t",Magneto[5]);
      ByteFlag = false;

      temp_m = Magneto[5]>>4;
      temp_l = Magneto[5]<<4;
      bit_order = temp_m | temp_l;
      fprintf(_fp2,"%02x\t",bit_order);
     }    
    } // else
   } // else
  } // for

  ByteCount = ByteCount + nRcvSize;

  fprintf(_fp1,"\n");
  fprintf(_fp2,"\n");
  m_nData++;
  UpdateData(FALSE);
 }
 return 1;
}





08-08-12

unsigned char bit_more;
unsigned char bit_less;
//unsigned char bit_order;

unsigned short int Magneto_x;
unsigned short int Magneto_y;
unsigned short int Magneto_z;


long CSGLSDlg::lCom_RcvData( WPARAM wParam, LPARAM lParam )
{
 if(Rvd_flag)
 {
  register int nRcvSize = (int)lParam; // data length

  for( int i=0;i<nRcvSize;i++)
  {   
   data1[i]=m_Commthread->g_byRcvBuf[i];
   fprintf(_fp1,"%02X\t",data1[i]);
  }

  if((ByteCount+nRcvSize) >= 25)
  {
   ByteCount = ByteCount - 25;
  }

  for(i=0;i<nRcvSize;i++)
  {
   if((ByteFlag==false)&&(data1[i]==250))
   {
    IdenFlag = true;
    StartIden[0] = data1[i];
   }
   else
   {
    if(IdenFlag==true)
    {
     if(data1[i] == 175)
     {
      StartIden[1] = data1[i];
     }
     else if(data1[i] == 32)
     {
      StartIden[2] = data1[i];
     }
     else if(data1[i] == 170)
     {
      StartIden[3] = data1[i];
      IdenFlag = false;
      ByteFlag = true;
     }
    }
    else
    {
     if(((ByteCount+i)==16)&&(ByteFlag==true))
     {
      Magneto[0] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[0]);

      bit_more = Magneto[0]>>4;
      bit_less = Magneto[0]<<4;
      Magneto[0] = bit_more | bit_less;
//      fprintf(_fp2,"%02x\t",Magneto[0]);
     }
     else if(((ByteCount+i)==17)&&(ByteFlag==true))
     {
      Magneto[1] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[1]);

      bit_more = Magneto[1]>>4;
      bit_less = Magneto[1]<<4;
      Magneto[1] = bit_more | bit_less;
//      fprintf(_fp2,"%02x\t",Magneto[1]);
     }
     else if(((ByteCount+i)==18)&&(ByteFlag==true))
     {
      Magneto[2] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[2]);

      bit_more = Magneto[2]>>4;
      bit_less = Magneto[2]<<4;
      Magneto[2] = bit_more | bit_less;
//      fprintf(_fp2,"%02x\t",Magneto[2]);
     }
     else if(((ByteCount+i)==19)&&(ByteFlag==true))
     {
      Magneto[3] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[3]);

      bit_more = Magneto[3]>>4;
      bit_less = Magneto[3]<<4;
      Magneto[3] = bit_more | bit_less;
//      fprintf(_fp2,"%02x\t",Magneto[3]);
     }
     else if(((ByteCount+i)==20)&&(ByteFlag==true))
     {
      Magneto[4] = data1[i];
      // ByteFlag = false;
      fprintf(_fp2,"%02X\t",Magneto[4]);

      bit_more = Magneto[4]>>4;
      bit_less = Magneto[4]<<4;
      Magneto[4] = bit_more | bit_less;
//      fprintf(_fp2,"%02x\t",Magneto[4]);
     }
     else if(((ByteCount+i)==21)&&(ByteFlag==true))
     {
      Magneto[5] = data1[i];
      fprintf(_fp2,"%02X\t",Magneto[5]);
      ByteFlag = false;

      bit_more = Magneto[5]>>4;
      bit_less = Magneto[5]<<4;
      Magneto[5] = bit_more | bit_less;
//      fprintf(_fp2,"%02x\t",Magneto[5]);
     }    
    } // else
   } // else
  } // for

//  fprintf(_fp3,"%02X%\t%02X\t",Magneto[0],Magneto[1]);
//  fprintf(_fp3,"%02X%\t%02X\t",Magneto[2],Magneto[3]);
//  fprintf(_fp3,"%02X%\t%02X\t",Magneto[4],Magneto[5]);

  Magneto_x = (Magneto[0]<<8) | Magneto[1];
  Magneto_y = (Magneto[2]<<8) | Magneto[3];
  Magneto_z = (Magneto[4]<<8) | Magneto[5];

  fprintf(_fp3,"Magneto_x=%02X\t", Magneto_x);
  fprintf(_fp3,"Magneto_y=%02X\t", Magneto_y);
  fprintf(_fp3,"Magneto_z=%02X\t", Magneto_z);

  ByteCount = ByteCount + nRcvSize;

  fprintf(_fp1,"\n");
  fprintf(_fp2,"\n");
  fprintf(_fp3,"\n");
  m_nData++;
  UpdateData(FALSE);
 }
 return 1;
}



08-08-16 20:42
- log1.txt가 FA AF 20 AA로 시작하지 않으면, log2.txt에 한 번에 3개씩 (6개가 아니라) 저장된다. 이때 한 주기의 16번(17번째) byte부터 읽는 것이 아니라 무조건 처음에 들어온 데이터로부터 16번(17번째) byte를 읽기 시작한다.


08-08-17 02:22

Microsoft Visual C++ Debug Library

Debug Assertion Failed!

Program: ...\SGLS.exe
File: wincore.cpp
Line: 958

For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the aaplication)

http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/0f287b5f-c1e1-4cd9-a0f0-a418def88edd/



* 변수들의 초기값 설정은 OnInitDialog()에서 한다.



'Hardware > network' 카테고리의 다른 글

UART (범용 비동기화 송수신기)  (0) 2008.07.02
bluetooth on Mac  (0) 2008.06.17
Video Tracking on PC  (0) 2007.08.11
posted by maetel
2008. 8. 12. 20:41 Computation/Language
http://www.winapi.co.kr/clec/cpp1/2-2-2.htm

프로젝트는 하나의 실행 파일을 제작하는데 필요한 관련 파일의 집합이다.

비주얼 C++은 프로젝트보다 더 상위의 개념인 솔루션(Solution)까지 지원한다. 솔루션(비주얼 C++ 6.0에서는 워크 스페이스)이란 여러 개의 프로젝트를 모아 놓은 것이다.

솔루션 파일은 확장자 sln(6.0에서는 dsw)을 가지며 프로젝트 파일은 확장자 vcproj(6.0에서는 dsp)를 가진다.



http://wi-fizzle.com/howtos/vc-stl/templates.htm

'Computation > Language' 카테고리의 다른 글

windows.h  (0) 2008.09.10
Communications Functions (Windows)  (0) 2008.08.14
16진수 10진수로 변환 strtol()  (0) 2008.08.12
numeric library  (0) 2008.03.18
Python tutorials  (0) 2008.02.24
posted by maetel
2008. 8. 12. 04:17 Computation/Language

'Computation > Language' 카테고리의 다른 글

Communications Functions (Windows)  (0) 2008.08.14
visual c++ solution - dsw  (0) 2008.08.12
numeric library  (0) 2008.03.18
Python tutorials  (0) 2008.02.24
Using Python for CGI programming  (0) 2007.07.11
posted by maetel
중앙대학교 심귀보 Kwee-Bo Sim

http://alife.cau.ac.kr/korean/sub01/GAs.html

'@GSMC > 정문열: Generative Art' 카테고리의 다른 글

breadth-first search  (0) 2008.06.30
Evolutionary and Swarm Design  (0) 2008.06.27
genetic programming  (0) 2008.06.05
treemaps  (0) 2008.05.29
변수  (0) 2008.05.17
posted by maetel
2008. 7. 6. 02:06 Computation/Algorithm
Natural Computing Series

Series Editors: Rozenberg, G., Bäck, Th., Eiben, A.E., Kok, J.N., Spaink, H.P.
ISSN: 1619-7127

http://www.springer.com/series/4190?detailsPage=titles

posted by maetel
2008. 6. 27. 17:45 @GSMC/정문열: Generative Art
Evolutionary and Swarm Design
CPSC 599.33 — Summer 2001
Christian Jacob — jacob@cpsc.ucalgary.ca
http://www.cpsc.ucalgary.ca/~jacob
03 July 2001


Penousal Machado : Neural Evolutionary Art
http://eden.dei.uc.pt/~machado/

Ken Musgrave: Genetic Programming and Genetic Art
www.wizardnet.com/musgrave/mutatis.html
www.fractalworlds.com

Steven Rooke: Evolutionary Art

Jano van Hemert: Art by Evolution on the Web
http://www.vanhemert.co.uk/

Piet Mondriaan — Theo van Doesburg — Mandala art — Fractal art

Jeffrey Ventrella: Art and Artificial Life
www.ventrella.com

Mattias Fagerlund: Cambrian Art
http://www.hypeskeptic.com/mattias/

The NeuroEvolution of Augmenting Topologies (NEAT)
http://www.cs.ucf.edu/~kstanley/neat.html

Andrej Bauer: Random Art (Carnegie Mellon University)
http://andrej.com/


Aaron — The Robot as an Artist
http://www.aaai.org/AITopics/pmwiki/pmwiki.php/AITopics/Art#aaron


Evolutionary Computer Graphics

http://www.artlandia.com/
Igor Bakshee

http://www.graphica.com/
Michael Trott

Organic Genetic and Evolutionary Art

Andrew Rowbottom
http://www.netlink.co.uk/~snaffle/form/evolutio.html

Evolutionary Art and Computers
Stephen Todd
William Latham

Organic Art
William Latham
http://www.doc.gold.ac.uk/~mas01whl/

Mark Atkinson

Linda Moss


Genetic L-System Programming

Swarm Systems
· Cell Replication
· Competitive Cell Replication
· "BlocksWorld"


Design by Swarms

Turtle Art
Example projects by Namrata Khemka

Self-Assembly

Swarm Art by Euan Forrester


'@GSMC > 정문열: Generative Art' 카테고리의 다른 글

[심귀보] 유전자 알고리즘  (0) 2008.07.07
breadth-first search  (0) 2008.06.30
genetic programming  (0) 2008.06.05
treemaps  (0) 2008.05.29
변수  (0) 2008.05.17
posted by maetel
Steve Oualline
Practical C Programming

13. Simple Pointers


183p
Pointers are also called address variables because they contain the addresses of other variables.

184p
Pointers can be used as a quick and simple way to access arrays. (...) Pointers can be used to create new variables and complex data structures such as linked lists and trees.

185p
The operator ampersand (&) returns the address of a thing which is a pointer.
The operator asterisk (*) returns the object to which a pointer points.

Operator - Meaning
* - Dereference (given a pointer, get the thing referenced)
& - Address of (given a thing, point to it)

The operator ampersand (&) returns the address of a thing which is a pointer.
The operator asterisk (*) returns the object to which a pointer points.


int *thing_ptr; // declare a pointer to a thing
thing_ptr = &thing; // point to the thing
*thing_ptr = 5; // set "thing" to 5
// The expression &thing is a pointer to a thing. The variable thing is an object
// thing_ptr points to any integer. It may or may not point to the specific variable thing.

The & (address of operator) gets the address of an object (a pointer).
The * (dereference operator) tells C to look at the data pointed to, not hte pointer itself.

http://www.cplusplus.com/doc/tutorial/pointers.html

http://www.cprogramming.com/tutorial/lesson6.html


187p
Several pointers can point to the same thing.

188p
Pointers as Function Arguments

The only result of a function is a single return value.

http://en.wikipedia.org/wiki/Call_by_value#Call_by_value

http://www.cplusplus.com/doc/tutorial/functions2.html

NULL pointer
locale.h
http://www.cplusplus.com/reference/clibrary/clocale/

189p
const Pointers

const char *answer_ptr = "Forty-Two";

char *const name_ptr = "Test";

const char *const title_ptr = "Title";

191p
Pointers and Arrays

(reminding...) 서 교수님:
number[10] 이라고 배열 선언을 하면 컴파일러는 10개의 연속된 데이터를 위한 공간을 확보하고 그 첫번째 공간의 주소를 number 에 넣습니다. 그래서 number 는 number[0] 의 주소를 가지는 것입니다.

number[1] 은 배열에서  number[0] 다음의 값을 가지는데 그 공간의 주소값을 알고 싶으면 &number[1] 이라고 하든지 number+1  이라고 하면 됩니다.

거꾸로, number 에서 시작하여 두번째 즉 number[1] 의 값을 주소로부터 얻고 싶으면 number[1] 이라고  하든지 *(number+1) 로 하여 얻을 수 있습니다.

192p
A pointer can be used to find each element of the array.

197p
Using Pointers to Split a String

strchr()
http://www.cplusplus.com/reference/clibrary/cstring/strchr.html


201p
Pointers and Structures

Instead of having to move a lot of data around, we can declare an array of pointers and then sort the pointers.


Command-Line Arguments

main (int argc, char *argv[])
{
The parameter argc is the number of arguments on the command line (including the program name).
The array argv contains the actual arguments.

(reminding...)
터미널에서, 말씀하신대로 "./V2008122-01 input.txt"라고 치면 다음과 같이 나옵니다.
argc=2
argv[0]=./V2008122-01
argv[1]=input.txt

서 교수님:
argv[0] = 실행프로그램 이름; 1번째는 항상 실행프로그램의 패스/이름 이 들어갑니다.
이번에는 argv[1] 에 들어갈 두 번째 값을 주었기 때문에 그 값이 프린트 된 것입니다.
command-line arguments는 shell 프로그램이 fileio 함수를 호출할 때 매개변수로 주는 것이고, 좀 더 엄밀하게는 OS 가 main 함수를 호출할 때 주는 것입니다.



http://www.cplusplus.com/reference/clibrary/cstdio/fprintf.html

Example 13-12: print.c
// formats files for printing
// usage: print [options] file(s)

#include <stdio.h>
#include <stdlib.h>

int verbose = 0; // verbose mode (default = false)
char *out_file = "print.out"; //output filename
char *program_name; // name of the program for erros
int line_max = 66; // number of lines per page

void do_file(char *name)
{
    printf("Verbose %d Lines %d Input %s Output %s\n",
           verbose, line_max, name, out_file);
}

void usage (void)
{
    fprintf(stderr, "Usage is %s [options] [file-list]\n",
            program_name);
    fprintf(stderr, "Options\n");
    fprintf(stderr, "    -v    verbose\n");
    fprintf(stderr, "    -l<number> Number of line\n");
    fprintf(stderr, "    -o<name>    Set output filename\n");
    exit(8);
}

int main (int argc, char *argv[])
{
    program_name =argv[0];
   
    while ( (argc>1) && (argv[1][0] == '-') )
        // argv[1][1] is the actual option character
    {
        switch (argv[1][1]) {
            case 'v':
                verbose = 1;
                break;
               
            case 'o':
                out_file = &argv[1][2];
                break;
           
            case 'l':
                line_max = atoi(&argv[1][2]);
                break;
           
            default:
                fprintf(stderr, "Bad option %s\n", argv[1]);
                usage();
        }
       
        ++argv;
        --argc;
    }
   
    if (argc == 1) {
        do_file("printf.in");
    }
    else {
        while (argc>1)
        {
            do_file(argv[1]);
            ++argv;
            --argc;
        }
    }
   
    return(0);
}

Xcode 실행창:
Verbose 0 Lines 66 Input printf.in Output print.out

terminal:
999:~/cintro/ch13/eg12 lym$ ./ch13eg12
Verbose 0 Lines 66 Input printf.in Output print.out
999:~/cintro/ch13/eg12 lym$ ./ch13eg12 i am tired
Verbose 0 Lines 66 Input i Output print.out
Verbose 0 Lines 66 Input am Output print.out
Verbose 0 Lines 66 Input tired Output print.out
999:~/cintro/ch13/eg12 lym$ ./ch13eg12 -v -l128 -0title xfile yfile zfile
Bad option -0title
Usage is ./ch13eg12 [options] [file-list]
Options
        -v      verbose
        -l<number> Number of line
        -o<name>        Set output filename
999:~/cintro/ch13/eg12 lym$ ./ch13eg12 -v -l128 -otitle xfile yfile zfile
Verbose 1 Lines 128 Input xfile Output title
Verbose 1 Lines 128 Input yfile Output title
Verbose 1 Lines 128 Input zfile Output title


208p
A pointer does not create any new space for data, but just refers to data that is created elsewhere.


http://www.cplusplus.com/doc/tutorial/pointers.html
The identifier of an array is equivalent to the address of its first element, as a pointer is equivalent to the address of the first element that it points to, so in fact they are the same concept.

An array can be considered a constant pointer.

http://www.cprogramming.com/tutorial/lesson6.html
Arrays can act just like pointers.


'@GSMC > 서용덕: DMD Programming' 카테고리의 다른 글

Similarity Transformation  (0) 2008.06.10
hw 9 - ppm 이미지 회전시키기  (0) 2008.05.30
[Steve Oualline] 12. Advanced Types  (0) 2008.05.28
data type 정리  (0) 2008.05.24
[Steve Oualline] 11. Bit Operations  (0) 2008.05.14
posted by maetel
2008. 6. 7. 22:19 Computation/Cocoa
http://www.informit.com/store/product.aspx?isbn=0321503619

3rd edition:
http://proquest.safaribooksonline.com/9780321562739
-> reading online

2nd edition:
http://catdir.loc.gov/catdir/toc/ecip0414/2004003054.html


google book:
http://books.google.com/books?id=47IMAAAACAAJ

COCOA Programming for Mac OS X 2/E 상세보기
Hillegass 지음 | Addison Wesley 펴냄
Provides step-by-step instructions for learning COCOA, discussing such topics as Objective-C, controls, helper objects, archiving, Nib files and NSWindowController, and creating interface builder palettes.


Aaron Hillegass
http://www.bignerdranch.com/

ref.
Learn Objective-C on the Macintosh
By Mark Dalrymple and Scott Knaster
invalid-file

preview pdf


Cocoa Fundamentals Guide: What Is Cocoa?

Cocoa Application Tutorial: Introduction to Cocoa Application Tutorial

Cocoa Guides

http://en.wikipedia.org/wiki/Cocoa_%28API%29





Chapter 1
Cocoa: What Is It?

1p
A Little History


NeXTSTEP
http://en.wikipedia.org/wiki/NEXTSTEP


darwin
http://en.wikipedia.org/wiki/Darwin_(operating_system)
http://www.opendarwin.info/
http://developer.apple.com/opensource/index.html

X window server
http://en.wikipedia.org/wiki/X_Window_System


NeXTSTEP came with a set of libraries and tools to enable programmers to deal with the window manager in an elegant manner. The libraries were called frameworks. In 1993, the frameworks and tools were revised and renamed OpenStep, which was itself later renamed Cocoa.

사용자 삽입 이미지

Cocoa enables your application to receive events from the window server and draw to the screen.

Programming with the frameworks is done in a language called Objective-C.


4p
Tools

Mac OS X Developer Tools (Xcode, Interface Builder)
GNU C compiler (gcc)
GNU debugger (gdb)


Language

Objective-C
Java - portability

Swing - an API for providing a graphical user interface (GUI) for Java programs.
http://en.wikipedia.org/wiki/Swing_%28Java%29


5p
Objects, Classes, Methods, and Messages

An object takes up memory and has variables inside it.

Classes are structures that can create objects. Classes specify the variables that the object has, and they are responsible for allocating memory for the object. We say that the object is an instance of the class that created it.
To call a method, you send the object a message.


6p
Frameworks

A framework is a collection of classes that are intended to be used together. The classes are compiled together into a reusable library of code. Any related resources are put into a directory with the library. The directory is renamed with the extensioin .framework. You can find the built-in frameworks for your machine in /System/Library/Frameworks.

All Cocoa applications use two of these frameworks: Foundation and AppKit.


7p

posted by maetel
2008. 5. 27. 16:13 Cases

'Cases' 카테고리의 다른 글

Richard Dreyfuss: Improving Civic Education  (0) 2010.08.04
Oyster card  (0) 2008.08.14
Sandy Skoglund 샌디 스코글런드  (0) 2008.04.27
Mixed Reality Interface  (0) 2008.02.24
Sundance Channel : Art of Seduction  (0) 2008.02.19
posted by maetel
2008. 3. 24. 15:09 @GSMC/정문열: Generative Art

data structure

ref.
http://www.webopedia.com/TERM/d/data_structure.html

In programming, the term data structure refers to a scheme for organizing related pieces of information. The basic types of data structures include:
  • files
    • lists
  • arrays
  • trees
  • Each of these basic structures has many variations and allows different operations to be performed on the data.


    ref.
    http://en.wikipedia.org/wiki/Data_structure

    ref.
    http://cplusplus.com/doc/tutorial/structures.html




    tree structure


    사용자 삽입 이미지

    ref.
    http://www.webopedia.com/TERM/T/tree_structure.html

    ref.
    Steve Oualline, Practical C Programmin, 292-293p

    root
    node
    leaves

    "Recursion is extremely useful with trees. Our rules for recursion are:
    1. The function must make things simpler. This rule is satisfied by trees, because as you descend the hierarchy there is less to search.
    2. There must be some endpoint. A tree offers two endpoints, either you find a match, or you reach a null node.




    ref.
    http://en.wikipedia.org/wiki/Tree_%28data_structure%29


    binary search tree
    http://en.wikipedia.org/wiki/Binary_search_tree



    Eric F Charlton : Tree Data Structures


    '@GSMC > 정문열: Generative Art' 카테고리의 다른 글

    [이선애] study 1  (0) 2008.03.28
    class 3/27  (0) 2008.03.27
    class 3/20  (0) 2008.03.20
    references for basic programming  (0) 2008.03.17
    Inversion Method  (0) 2008.03.08
    posted by maetel
    Practical C Programming
    http://www.oreilly.com/catalog/pcp3/

    Chapter 4. Basic Declarations and Expressions


    Basic Program Structure


    The basic elements of a program are the data declarations, functions, and comments.

    main() 함수는 첫번째로 호출되는 함수이며, 이 main 함수가 다른 함수들을 직접 또는 간접으로 호출한다.

    return(0);는 프로그램이 정상적으로 (Status=0) 존재했었음을 OS에게 보고하기 위해 쓰인다. : return value가 클수록 error가 심각하다는 뜻이다.



    Variables
    Each variable has a variable type.
    A variable must be defined in a declaration statement just before the main() line at the top of a program.

    http://en.wikipedia.org/wiki/Computer_numbering_formats

    http://en.wikipedia.org/wiki/Signed_number_representations



    Assignment statements
    The general form of the assignment statement is:
    variable = expression;
    The = is used for assignment.



    printf Function

    printf

    : a standard function to output our message
    Print formatted data to stdout
    Writes to the standard output (stdout) a sequence of data formatted as the format argument specifies. After the format parameter, the function expects at least as many additional arguments as specified in format.
    The format tags follow this prototype:
    %[flags][width][.precision][length]specifier

    : 표준 입출력 함수- 표준 입출력 장치를 통해 데이터를 입력하거나 출력하는 기능을 갖고 있는 함수
    - 표준 입출력 함수를 사용하려면 #include <stdio.h>를 기술해 줘야 한다.
    [형식] printf(" 출력양식 ", 인수1,인수2...);
    - 서식문자열에는 모든 문자를 사용할 수 있으며 변환문자와 제어문자를 제외하고는 화면에 그대로 출력
    - 인수와 변환문자는 일대일 대응해야 하며 반드시 인수의 자료형과 문자의 자료형은 일치해야 한다.
    ex) printf("%d + %d= %d\n",10,20,30);
    출력결과 10+20=30


    stdout
    Standard output stream
    : the default destination of regular output for applications. It is usually directed to the output device of the standard console (generally, the screen).

    cf. library fuctions


    %d
    : integer conversion specification

    parameter list

    The general form of the printf statement is:
    printf(format, expression-1, expression-2, ...);
    where format is the string describing what to point.



    Characters

    escape character


    '@GSMC > 서용덕: DMD Programming' 카테고리의 다른 글

    hw2  (0) 2008.03.15
    week 2 review  (0) 2008.03.15
    hw1  (0) 2008.03.10
    Key concepts in programming: statement & expression  (1) 2008.03.09
    week 1 review - keywords & file I/O  (0) 2008.03.07
    posted by maetel
    2008. 2. 24. 01:40 Computation/Language
    아니 뭐 이런 천사 같은 사람들이 이렇게 많아...

    http://www.diveintopython.org/


    1
    How to Think Like a Computer Scientist
    Learning with Python (2nd Edition)
    by Jeffrey Elkner, Allen B. Downey and Chris Meyers
    illustrated by Udit Bhatnager and Chris Schmeelk

    -> 너무나 친절한 설명. 컴퓨터 프로그래밍 언어에 대한 개념을 처음 잡을 때 힘들게 정리했던 것들이 1장에 깔끔하게 요약되어 있고. @.@ 진도 진짜 천천히 나간다. 자연계라면 좀 지루할 정도. 손 놓고 있는 동안 다 잊어 버렸을까 걱정했는데 이거 한 번 보면 될 듯. 파이썬 아니, 코딩 처음 공부할 때 여기 알았으면 진짜 편했을텐데. ㅜㅜ

    2
    Python Tutorial
    Guido van Rossum
    Python Software Foundation

    -> 지금 보면 좀 나으려나? 설명이 압축적이라 막상 코딩을 짤 때에는 의외로 큰 도움이 되지 못했었다. 코딩에 대한 것이 아니라 언어 자체에 대한 설명이기 때문이다. 나한텐 어렵다. 내겐 필요 없는 내용도 많다. 그래도 필독. 일종의 사전이라고 생각한다. (사전 본다고 글이 써지는 건 아니잖아? ^^;)

    3
    Penzilla.net's Python Tutorial


    4
    O'Reilly Python Center

    -> 그래도 중급 이상 되기 전에는 안 사. ㅋ 오호. Jython이라...
    Jython is an implementation of the Python programming language written in Java, allowing Python programs to integrate seamlessly with any Java code.



    Python에서의 프로그래밍, Part 1



    etc.

    Text Processing in Python
    by David Mertz -- published by Addison Wesley

    -> 나중에 유용할 날이 있을 듯한 예감.


    http://coreapython.hosting.paran.com/

    'Computation > Language' 카테고리의 다른 글

    16진수 10진수로 변환 strtol()  (0) 2008.08.12
    numeric library  (0) 2008.03.18
    Using Python for CGI programming  (0) 2007.07.11
    classes in Python  (0) 2007.07.11
    Python  (0) 2007.06.26
    posted by maetel
    2007. 11. 17. 00:44 Techne/Greenberg: Creative Code
    사용자 삽입 이미지
    Processing: Creative Coding and Computational Art

    Ira Greenberg

    friends of ED, 2007

    소스코드 다운로드




    Ira Greenberg at Miami University, Ohio
    associate professor in the School of Fine Arts and Interactive Media Studies program
    affiliate member of the Department of Computer Science and System Analysis

    aesthetics and computation
    expressive programming
    emergent forms
    net-based art
    artificial intelligence
    physical computing
    computer art pedagogy

    Keith Peters
    Carole Katz
    Mark Napier  www.potatoland.org


    Questions to
    (1) support@friendsofed.com with "617x" in the subject of your e-mail.
    (2) processing@iragreenberg.com

    http://java.sun.com/j2se/1.4.2/docs/api/index.html





    Part One: Theory oof Processing and Computational Art

    1 Code Art


    'Techne > Greenberg: Creative Code' 카테고리의 다른 글

    [Ira Greenberg] 1. Code Art  (2) 2007.11.28
    posted by maetel