예제 #1
0
 /** Returns the projection corresponding to an enum value.
   *
   * @param projection  Enum value.
   *
   * @return The projection program.
 **/
 inline cl::Program get(const modules &projection)
 {
     switch (projection)
     {
            case PERSPECTIVE: return perspective();
            case     FISHEYE: return fisheye();
         default            : throw std::logic_error("Unknown projection");
     }
 }
예제 #2
0
void DistortionFXFilter::filterImage()
{
    int w = m_orgImage.width();
    int h = m_orgImage.height();
    int l = d->level;
    int f = d->iteration;

    switch (d->effectType)
    {
        case FishEye:
            fisheye(&m_orgImage, &m_destImage, (double)(l / 5.0), d->antiAlias);
            break;

        case Twirl:
            twirl(&m_orgImage, &m_destImage, l, d->antiAlias);
            break;

        case CilindricalHor:
            cilindrical(&m_orgImage, &m_destImage, (double)l, true, false, d->antiAlias);
            break;

        case CilindricalVert:
            cilindrical(&m_orgImage, &m_destImage, (double)l, false, true, d->antiAlias);
            break;

        case CilindricalHV:
            cilindrical(&m_orgImage, &m_destImage, (double)l, true, true, d->antiAlias);
            break;

        case Caricature:
            fisheye(&m_orgImage, &m_destImage, (double)(-l / 5.0), d->antiAlias);
            break;

        case MultipleCorners:
            multipleCorners(&m_orgImage, &m_destImage, l, d->antiAlias);
            break;

        case WavesHorizontal:
            waves(&m_orgImage, &m_destImage, l, f, true, true);
            break;

        case WavesVertical:
            waves(&m_orgImage, &m_destImage, l, f, true, false);
            break;

        case BlockWaves1:
            blockWaves(&m_orgImage, &m_destImage, l, f, false);
            break;

        case BlockWaves2:
            blockWaves(&m_orgImage, &m_destImage, l, f, true);
            break;

        case CircularWaves1:
            circularWaves(&m_orgImage, &m_destImage, w / 2, h / 2, (double)l, (double)f, 0.0, false, d->antiAlias);
            break;

        case CircularWaves2:
            circularWaves(&m_orgImage, &m_destImage, w / 2, h / 2, (double)l, (double)f, 25.0, true, d->antiAlias);
            break;

        case PolarCoordinates:
            polarCoordinates(&m_orgImage, &m_destImage, true, d->antiAlias);
            break;

        case UnpolarCoordinates:
            polarCoordinates(&m_orgImage, &m_destImage, false, d->antiAlias);
            break;

        case Tile:
            tile(&m_orgImage, &m_destImage, 210 - f, 210 - f, l);
            break;
    }
}