Reputation:
I am creating an app that detect the edge of document using the Open-CV framework
but result is not great.
Than i came to this project GPUImage
. I am don't know anything about this project can anyone suggest me how to detect edge using GPUImage
. Code or tutorial will be really helpful.
Upvotes: 6
Views: 2889
Reputation: 10938
I am pretty sure you could achieve this with GPUImage. For instance take a look at the FilterShowcase's "Harris Corner Detection":
In the underlying class you have this code from where it seems you could pull coordinates:
NSString *const kGPUImageHarrisCornerDetectionFragmentShaderString = SHADER_STRING
(
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float sensitivity;
const mediump float harrisConstant = 0.04;
void main()
{
mediump vec3 derivativeElements = texture2D(inputImageTexture, textureCoordinate).rgb;
mediump float derivativeSum = derivativeElements.x + derivativeElements.y;
mediump float zElement = (derivativeElements.z * 2.0) - 1.0;
// R = Ix^2 * Iy^2 - Ixy * Ixy - k * (Ix^2 + Iy^2)^2
mediump float cornerness = derivativeElements.x * derivativeElements.y - (zElement * zElement) - harrisConstant * derivativeSum * derivativeSum;
gl_FragColor = vec4(vec3(cornerness * sensitivity), 1.0);
}
);
If not this one, there are many filters there that you could give a try.
Upvotes: 4
Reputation: 21244
OpenCV is a computer vision library, that does do feature detection. When used properly it can find edges and tell your application where in the image they are. Based on your question this appears to be what you need.
GPUImage is an image filtering library. It applies effects to images. It has several filters that use edge detection, but it will not tell you where those edges are. It applies the filter to the image and that is it.
You should stick with OpenCV. If you are having problems getting the feature detection results you need, that would be a different question to ask.
Upvotes: 5