기본 콘텐츠로 건너뛰기

2009의 게시물 표시

[MATLAB]3점에 의한 원의 중심 구하기...

원문 출처 : http://mathworld.wolfram.com/Circle.html 중 일부  입니다.   The equation of a circle passing through the three points for , 2, 3 (the circumcircle of the triangle determined by the points) is   (25) The center and radius of this circle can be identified by assigning coefficients of a quadratic curve   (26) where and (since there is no cross term). Completing the square gives   (27) The center can then be identified as   (28)   (29)   and the radius as   (30) where   (31)   (32)   (33)   (34) Four or more points which lie on a circle are said to be concyclic . Three points are trivially concyclic since three noncollinear points determine a circle.     아래는 원문중 원의 공식을 이용해 MATLAB과 OpenCV 행렬 함수를 이용해서 구현된 소스입니다.   학교 과제할때 참고한 공식으로 유용하게 사용했습니다.^^   관심점 3점을 추출하여 중심점을 계산하기

IplImage to DC

......... {      .....      DrawIplToHDC(iplBufColor, IDC_STA_IMAGE); } void DrawIplToHDC(IplImage *image, UINT ID) {       CDC* pDC = GetDlgItem(ID)->GetDC();       CRect rcView;       GetDlgItem(ID)->GetClientRect(&rcView);       CvvImage* cvvImgage;       cvvImgage->CopyOf(image);       cvvImgage->DrawToHDC(pDC->GetSafeHdc(), &rcView);       ReleaseDC(pDC); }

빠른 픽셀 연산...

화면 전체를 가득 메우는 픽셀연산은 느립니다.   마우스로 드래그하는 시스템을 구성하여 당겨 흔들어 보면   알 수 있습니다. 오늘 그것을 빠르게 구성해 봅시다.       1. 느린 이유   용량이 많은 작업인 것은 어쩔 수 없습니다.   그것을 제외하고 이유는 보통 3가지입니다.   (클리핑을 통해 더 빨리 만든다던지, 처음작업시 이미지를 구성해서   매번 뿌린다던지의 꽁수는 각 작업상의 상황에 따른 것이니 논외로 합니다.)       1) 픽셀함수호출시간  2) for의 조건문과 픽셀접근계산  3) RGB를 분리했다 결합하는 연산       1번은 픽셀처리의 for문안에 절대 다른 함수를 호출해서는 안됩니다.   GetPixel, SetPixel은 독약입니다. 이유는 매 픽셀 "함수호출시간 + 클리핑계산 + 비트수맞춤"입니다.       2번은 memcpy식의 루프로 바꿉니다.   // 보통의 코드 RGBQUID* offset = 시작주소; INT width = 이미지가로길이, height = 이미지세로길이; INT row = 4배수정렬된 가로점의 갯수; // 바이트수가 아님 /////////////////////////////////////////////// for(int y = CY, yend = CY + CH; y < yend; ++y) for(int x = CX, xend = CX + CW; x < xend; ++x) {     offset[x + row * (height - y - 1)] = 0x00BBGGRR; }   // memcpy식 코드 RGBQUID* offset = 시작주소; INT width = 이미지가로길이, height = 이미지세로길이; INT row = 4배수정렬된 가로점의 갯수; // 바이트수가 아님 INT jump = width

OpenCV lib Setting

/* OpenCV use ====================================== */ #if (defined(DEBUG) || defined(_DEBUG)) #pragma comment(lib, "cxcored.lib") #pragma comment(lib, "cvd.lib") #pragma comment(lib, "highguid.lib") #else #pragma comment(lib, "cxcore.lib") #pragma comment(lib, "cv.lib") #pragma comment(lib, "highgui.lib") #endif #include "cv.h" #include "cxcore.h" #include "highgui.h" /#include "cvcam.h" // OpenCV_pre1.1 -> highgui.h /* OpenCV use end ================================== */

RRT(Rapidly Exploring Random Tree)를 이용한 2차원 해를 찾는 알고리즘

<출처 : by 피코로 >     또 공부하고 싶은걸 찾았다.. ㅡㅜ; 나이 먹을수록 공부해야 할 숙제가 하나씩 늘어나는 이느낌.. ㅎㅎ   참고자료 : http://msl.cs.uiuc.edu/rrt/ Growing a 2D RRT Random Mazes Planning: Point Robot Planning: Rigid Body Articulated Bodies A Car-Like Robot Smooth-Steering Car Forward-Only Car Left-forward-only Car Car w/Trailer Car w/Trailers A Narrow Corridor Translating Hovercraft Rotating Hovercraft Translating Spacecraft Rotating Spacecraft A Lunar Lander Closed Linkages Moving Obstacles X-Wing Fighter w/Dynamics Shooting a Basket Asteroid Navigation Reckless Driving Alpha 1.0 Puzzle