1 / 31

멀티미디어 정보처리 #1

멀티미디어 정보처리 #1. 박 찬 우 cwpark@cse.hanyang.ac.kr. C++. C++ 의 특징 C : 절차 중심 언어 C++ : 객체 지향 언어 객체 (Object) 란 ? 우리가 흔히 보는 사물 , 물건 ( 자동차 , 컴퓨터 등등 ) 객체 지향 프로그래밍 시 객체를 프로그램을 구성하는 기본 단위로 해서 만들겠다는 의미. C++(Con’t). 클래스 란 ? 객체를 생성하기 위한 도구 데이터 (Variable), 함수 (Function) 을 포함. 클래스. 객체.

zoe-noble
Download Presentation

멀티미디어 정보처리 #1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 멀티미디어 정보처리#1 박 찬 우 cwpark@cse.hanyang.ac.kr

  2. C++ • C++ 의 특징 • C : 절차 중심 언어 • C++ : 객체 지향 언어 • 객체 (Object) 란? • 우리가 흔히 보는 사물, 물건(자동차, 컴퓨터 등등) • 객체 지향 • 프로그래밍 시 객체를 프로그램을 구성하는 기본 단위로 해서 만들겠다는 의미 Computer Vision & Pattern Recognition Lab.

  3. C++(Con’t) • 클래스 란? • 객체를 생성하기 위한 도구 • 데이터(Variable), 함수(Function)을 포함 클래스 객체 Computer Vision & Pattern Recognition Lab.

  4. C++(Con’t) • 클래스의 구현 • // marine.h class Marine { public: int health; void move(); void patrol(); void attack(); } • // marine.cpp void Marine::move(){ // 이동 구현 } void Marine::attack(){ // 공격 구현 } • int main(void) { Marine m1; m1.move(); Marine m2; m2.attack(); } Computer Vision & Pattern Recognition Lab.

  5. Windows Programming • 윈도우 프로그램 • Event Driven 방식 • Event : 사용자가 컴퓨터를 조작한 것에 의해 일어나는 사건 Computer Vision & Pattern Recognition Lab.

  6. C++ Application MFC Windows API 윈도우 API를 캡슐화한 MFC MFC(Microsoft Foundation Class) • Microsoft가 자체적으로 개발한 윈도우용 C++ 프로그램 라이브러리 Computer Vision & Pattern Recognition Lab.

  7. MFC(Microsoft Foundation Class) (Con’t) • 장점 • 윈도우 Application을 만들기 위한 노력의 최소화 • C 언어로 된 API에 버금가는 실행 속도, 코드 크기의 최소화 • 코드의 재사용성 향상 • 프로그램의 유지보수가 쉬움 • 프로그램을 확장 하거나 새로운 기능을 추가 하기 쉬움 Computer Vision & Pattern Recognition Lab.

  8. 윈도우 프로그램 작성 단계 1. Visual C++ 프로그램을 실행한 다음 [File] 메뉴에서 [New] 항목 선택 Computer Vision & Pattern Recognition Lab.

  9. 윈도우 프로그램 작성 단계(Con’t) 2. [Projects] 탭을 선택한 다음 “MFC AppWizard(exe)”를 선택. Location 상자에서 폴더 위치 지정, Project name 상자에 프로그램 이름을 입력. Computer Vision & Pattern Recognition Lab.

  10. 윈도우 프로그램 작성 단계(Con’t) 3. Single document 선택 Computer Vision & Pattern Recognition Lab.

  11. 윈도우 프로그램 작성 단계(Con’t) 4. Step 6 에서 Base class를 CScrollView를 선택하고 Finish Computer Vision & Pattern Recognition Lab.

  12. 윈도우 프로그램 작성 단계(Con’t) 5. 실행 Computer Vision & Pattern Recognition Lab.

  13. 메뉴 생성 및 연결 함수 작성 1. [Resource View] 탭에서 Menu 선택 Computer Vision & Pattern Recognition Lab.

  14. 메뉴 생성 및 연결 함수 작성(Con’t) 2. 메뉴에서 빈칸을 선택하고 “실습” 입력 해서 새로운 주 메뉴 생성 Computer Vision & Pattern Recognition Lab.

  15. 메뉴 생성 및 연결 함수 작성(Con’t) 3. 부 메뉴에서 빈칸을 선택하고 ID와 Caption을 입력하여 새로운 부 메뉴 생성 Computer Vision & Pattern Recognition Lab.

  16. 메뉴 생성 및 연결 함수 작성(Con’t) 4. 새로 생성한 부메뉴에 연결 함수 작성을 위한 MFC ClassWizard 실행(마우스 오른쪽 또는 Ctrl + w) Computer Vision & Pattern Recognition Lab.

  17. 메뉴 생성 및 연결 함수 작성(Con’t) 5. MFC ClassWizard 대화 상자에서 Messages 상자 안에 있는 “COMMAND”항목을 선택한 다음에 [Add Function] 버튼을 클릭 Computer Vision & Pattern Recognition Lab.

  18. 메뉴 생성 및 연결 함수 작성(Con’t) 6. Add Member Function 대화 상자에서 함수 이름을 지정하고 [OK] 버튼 선택 Computer Vision & Pattern Recognition Lab.

  19. 메뉴 생성 및 연결 함수 작성(Con’t) 7. MFC ClassWizard 대화상자에서 [Edit Code] 버튼을 클릭하여 생성한 함수를 편집 Computer Vision & Pattern Recognition Lab.

  20. 메뉴 생성 및 연결 함수 작성(Con’t) 8. OnPrintHelloworld() 함수 내용을 다음과 같이 편집 하고 실행 9. 실행 결과 Computer Vision & Pattern Recognition Lab.

  21. 화면 출력 1. View 클래스 OnDraw 멤버 함수에 작성 Computer Vision & Pattern Recognition Lab.

  22. 화면 출력(Con’t) 2. 실행 화면 Computer Vision & Pattern Recognition Lab.

  23. 마우스 처리 1. View 클래스에 마우스 클릭 좌표값을 저장할 멤버 변수 추가 Computer Vision & Pattern Recognition Lab.

  24. 마우스 처리(Con’t) 2. View 클래스의 생성자에 멤버 변수 초기화 Computer Vision & Pattern Recognition Lab.

  25. 마우스 처리(Con’t) 3. View 클래스의 OnDraw 수정 Computer Vision & Pattern Recognition Lab.

  26. 마우스 처리(Con’t) 4. MFC ClassWizard 대화상자에서 [WM_LBUTTONDOWN] 메시지 추가 Computer Vision & Pattern Recognition Lab.

  27. 마우스 처리(Con’t) 5. MFC ClassWizard 대화상자에서 [Edit Code] 버튼을 클릭하여 생성한 함수를 편집 Computer Vision & Pattern Recognition Lab.

  28. 마우스 처리(Con’t) 6. 마우스 포인트의 좌표를 m_ClickMousePoint에 저장하고 화면을 갱신한다 Computer Vision & Pattern Recognition Lab.

  29. 마우스 처리(Con’t) 7. 실행 화면 Computer Vision & Pattern Recognition Lab.

  30. 실습 • 640 x 480 크기의 빨간색 배경을 그린다. • 반지름의 크기가 50인 노란색 원을 그린다. • 마우스 왼쪽 버튼 클릭 시 노란색 원을 클릭한 포인트로 이동 시킨다. • 마우스 클릭한 포인트에서 노란색 원이 벗어날 경우 메시지를 출력하고 포인트를 정정 해준다. Computer Vision & Pattern Recognition Lab.

  31. 실습 (Con’t) • 실행 Computer Vision & Pattern Recognition Lab.

More Related