石英2D / OpenGLES图像上的几何扭曲(最好使用CGImage)

时间:2022-08-07 20:03:48

What is the preferred method for implementing such geometric distortions as pinch/fisheye/etc. using the iPhone SDK? I know that the Core Image library for OSX has all these types of filters built in, but not for the iPhone SDK.

实现捏/鱼眼等几何变形的首选方法是什么?使用iPhone SDK?我知道OSX的Core Image库内置了所有这些类型的过滤器,但不适用于iPhone SDK。

I can create a displacement map at a specific location and radius given the original source bitmap data, but I'm not sure how to apply this bitmap data as a transformation on my CGImage.

给定原始源位图数据,我可以在特定位置和半径创建置换贴图,但我不确定如何将此位图数据应用为我的CGImage上的转换。

This isn't an affine transformation since lines are no longer parallel around the area of distortion/etc.

这不是仿射变换,因为线在变形/等区域周围不再平行。

Is it possible using CGImage or would I need to do this using OpenGLES?

是否可以使用CGImage或者我需要使用OpenGLES吗?

Thanks

1 个解决方案

#1


Actually, Flash 8's DisplacementMapFilter entry describes the general displacement map transformation given a displacement map made up of pixels component(x,y) as follows:

实际上,Flash 8的DisplacementMapFilter条目描述了给定由像素分量(x,y)组成的位移图的一般位移图变换,如下所示:

dstPixel[x, y] = srcPixel[ x + ((componentX(x, y) - 128) * scaleX) / 256, y + ((componentY(x, y) - 128) * scaleY) / 256 ]

dstPixel [x,y] = srcPixel [x +((componentX(x,y) - 128)* scaleX)/ 256,y +((componentY(x,y) - 128)* scaleY)/ 256]

#1


Actually, Flash 8's DisplacementMapFilter entry describes the general displacement map transformation given a displacement map made up of pixels component(x,y) as follows:

实际上,Flash 8的DisplacementMapFilter条目描述了给定由像素分量(x,y)组成的位移图的一般位移图变换,如下所示:

dstPixel[x, y] = srcPixel[ x + ((componentX(x, y) - 128) * scaleX) / 256, y + ((componentY(x, y) - 128) * scaleY) / 256 ]

dstPixel [x,y] = srcPixel [x +((componentX(x,y) - 128)* scaleX)/ 256,y +((componentY(x,y) - 128)* scaleY)/ 256]