Recognize open and closed shapes opencv?

how to detect open and closed shapes in opencv. These are simple sample shapes I want to detect. I have detected ...