블로그 이미지
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 31
  • total
  • today
  • yesterday

Category

2010. 5. 30. 01:59

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

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
2008. 8. 13. 17:10 Method/CG

ftp://medialab.sogang.ac.kr
폴더: 오동훈>opengl

C관련 참고 사이트
www.winapi.co.kr

추천 교재
OpenGL 3판, 정보교육사

컴퓨터 그래픽스, 한빛미디어

http://nehe.gamedev.net

1. Setting OpenGL
다음의 세 파일을 컴퓨터에 설치한다

1) glut.h
소스코드에서 아래와 같이 하면
#include <gl/glut.h>
다음 경로에서 헤더 파일을 호출한다
C:\Program Files\Microsoft Visual Studio\VC98\Include\GL

2) glut32.dll
dll
dynamic link library
다음 위치에 복사한다
C:\WINDOWS\system32

3) glut32.lib
다음 위치에 복사한다
C:\Program Files\Microsoft Visual Studio\VC98\Lib


2. 예제 코드 Simple.c

* call back 함수
glutDisplayFunc(RenderScene)
여기서 argument로 쓰인 RenderScene은 함수이다

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
여기서 argument는 buffer를 single로 할지 double로 할지를 선택한다.

glFlush() - single일 때
glSwapBuffer() - double일 때


SetupRC()
RC=rendering context

glutMainLoop()
일종의 while문이라고 생각하면 된다.
무한 루프를 돌면서 어떤 이벤트가 생기는지 검사한다.


'Method > CG' 카테고리의 다른 글

OpenGL Super Bible  (0) 2008.08.02
Rendering for an Interactive 360 Light Field Display  (0) 2008.07.11
Game Blender  (0) 2008.02.24
Maya tutorials  (0) 2008.02.18
curved surfaces 곡면  (0) 2008.02.12
posted by maetel
2008. 8. 2. 20:59 Method/CG

'Method > CG' 카테고리의 다른 글

[오동훈] OpenGL #1  (0) 2008.08.13
Rendering for an Interactive 360 Light Field Display  (0) 2008.07.11
Game Blender  (0) 2008.02.24
Maya tutorials  (0) 2008.02.18
curved surfaces 곡면  (0) 2008.02.12
posted by maetel
Dave Pape is a member of the Department of Media Study at the University at Buffalo.
The course was informed by Ed.

DMS 423/523: Programming Graphics 1
Fall 2007

Course Info

When: Tuesday/Thursday 2:00 - 3:50 pm
Where: CFA 242

Instructor: Dave Pape
e-mail: depape at buffalo.edu
Office: CFA 250
Office hours: Wed 12-1pm; Tues/Thurs 1-2pm

Website: http://resumbrae.com/ub/dms423/

Course Description

This production course introduces students to the concepts and practice of programming 2-D and 3-D computer graphics using OpenGL. The major focus is on developing the skills needed to create interactive, real-time CG experiences. Students write their own code to create customized computer tools and visuals and learn the fundamentals of graphics.

Upon completing this course, a student should have an understanding of basic computer graphics technical concepts - e.g., be able to describe the different types of geometric transformations, define what a normal vector is and what it's used for, understand how a texture image is applied to a shape, etc. The student should also be comfortable with using programming and mathematics (trigonometry, interpolation, vectors) to build and control a graphical scene.

Textbook

There is no single required text. Rather, students should choose one of the following texts, based on their background and programming experience:

  • OpenGL Programming Guide, Fourth Edition, David Shreiner et al.
  • OpenGL Distilled, Paul Martz
  • Computer Graphics with OpenGL, Donald Hearn, Pauline Baker.
  • Interactive Computer Graphics: A Top-Down Approach Using OpenGL, Edward Angel.

Useful websites:

Topics

The major topics that we will cover are:

  • Color
  • Geometry (shapes)
  • Transformations
  • Projections
  • Lighting
  • Texturing
  • Sound
  • Math



Draft Schedule

Aug 28/30 Introduction
Sep 4/6 Images, frame buffer
Sep 11 Geometry, coordinate systems
Sep 20/22 Transformations
Sep 25/27 More transformations, 3D coordinates
Oct 2/4 Depth cues
Oct 9/11 Math
Oct 16/18 Interaction
Oct 23/25 Texturing
Oct 30/Nov 1 Lighting
Nov 6/8 Motion math
Nov 13/15 Sound
Nov 20 Alpha
Nov 27/29 PD
Dec 4/6 Special topics TBD

posted by maetel