I have no experience in AForge, but in image processing in general.
- first of all, I am not sure that converting to grayscale is a good idea. You might loos significant information.
- try to build and test your app step by step. In the
aforge documentation[
^] the sample contains only two statements: create the extractor filter and apply it to the image. The result will be the bigest object. Save it, or show it in your test app, to see if it works.
- did you intentionally re-apply the filter (h = fil2.Apply(aq).Height;)? Better save it on the first apply.
- are you sure that the height of the result is equal to it's width?
- by the way, what is the center pixel of an object?