this is actually a very broad question to my understanding. The object detection is not a single function work. I didn't quite understand your question since you mentioned that you can do the edge detection, then what parts in the image you want to detect other than the edge?
To get rid of the un-favored part, after you can successfully extract the detected parts, you can set all others to 0's. If this is what you mean.