/* * gluLookAt.h * * This is a modified version of the function of the same name from * the Mesa3D project ( http://mesa3d.org/ ), which is licensed * under the MIT license, which allows use, modification, and * redistribution * * In order to work under OpenGL ES, all instances of GLdouble * had to be changed to GLfloat, and all "d" function calls had * to be changed to the "f" versions. * * Original developer's comments have been left in place. * * Out of respect for the original authors, this is licensed under * the Mesa (MIT) license. Original license follows: * * ----------------------------------------------------------------------- * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #import<Foundation/Foundation.h> #import<OpenGLES/EAGL.h> #import<OpenGLES/ES1/gl.h> #import<OpenGLES/ES1/glext.h>
가우시안 필터가 이미지를 부드럽게 만드는 것이라면 UnSharp Mask Filter는 이미지를 날카롭게 만드는 방법이다.
기본적으로 UnSharp는 원본이미지와 Bluring된 원본이미지가 필요하다.
그리고 아래와 같이 연산을 하면 된다.
g(x, y) = f(x, y) - f_smooth(x, y)
h(x, y) = f(x, y) + g(x, y)
f(x, y)는 원본 이미지의 픽셀이고, f_smooth(x, y)는 앞에서 설명한 가우시안 필터를 이용하여 생성해 낸 픽셀이다.
g(x, y)는 원본 이미지와 Bluring 이미지를 뺀 값인데 결과적으로 영상의 경계선 부분만 검출된다.
원본 블러
경계선결과
저 수식을 그림으로 표현하면 아래와 같다.
결과적으로 Highpass 부분만 남은 (c)를 (a)에 더함으로써 경계선 부분이 선명한 이미지가 출력되었다.
수식을 보면 알겠지만 g(x, y)에 k라는 factor를 두어 영상의 경계선을 더욱더 부각시킬수도 있고
경계선을 없애버릴 수도 있다. k는 일반적으로 0.0f 이상을 사용해야 하지만 음수여도 상관은 없다.
수정된 공식은 아래와 같다.
h(x, y) = f(x, y) + k * g(x, y)