'Jitter효과'에 해당되는 글 1건

  1. 2009.03.18 라이브러리 함수 사용자 작성
Study/CxImage2009. 3. 18. 15:32

Jitter효과

- 새로운 클래스 생성 후 math 헤더파일 추가

- 코드

 

 RGBQUAD color;
 int rnd_height, rnd_width;

 // 영상의 높이와 너비를 가져온다.
 int height = m_pImage->GetWidth();
 int width = m_pImage->GetWidth();

 for(int i=0; i<height; i++)
 {
  for(int j=0; j<width; j++)
  {
   rnd_height = i + (long)((rand() / (float)RAND_MAX - 0.5) * (radius * 2));
   rnd_width = j + (long)((rand() / (float)RAND_MAX - 0.5) * (radius * 2));

   // 영상의 범위를 넘어서면
   if(rnd_height > height || rnd_width > width)
   {
    rnd_height = height;
    rnd_width = width;
   }

   // 영상(rnd_width, rnd_height)내 화소값에서 R,G,B값을 가져온다.
   color = m_pImage->GetPixelColor(rnd_width, rnd_height);


   // 영상 내 화소값의 R,G,B에 할당한다.
   m_pImage->SetPixelColor(j, i, color);
  }
 }

 

- 메뉴바에 새로운 메뉴 생성 후 호출 함수 정의 (View클래스)

 // 도큐먼트 클래스에 있는 m_pImage를 가져오기 위해 참조 호출한다.
 CKDY013Doc *pDoc = GetDocument();
 ASSERT_VALID(pDoc);

 CFilter cFilter;
 cFilter.GS_Jitter(pDoc->m_pImage, 4);

 // 화면 갱신
 Invalidate(FALSE);

 

 

 

'Study > CxImage' 카테고리의 다른 글

컬러 공간 분석  (0) 2009.03.23
CxImage 제공 함수  (0) 2009.03.18
CxImage 라이브러리 함수  (0) 2009.03.18
기본 시작 함수  (0) 2009.03.18
CxImage 소개 및 기본 설치  (0) 2009.03.11
Posted by 열ㅇl