If you'd like to do object recognition with only the contours, use Shape Context.
Essentially, you will have a database of shapes apriori, where you know the label of each shape (gun, something_harmless_1, knife, something_harmless_2). At query time, you take the contour of your object and compute the Shape Context Distance between your query shape and all shapes in your database. The shape with the shortest Shape Context Distance is then deemed as the true class of your object.
Alternatively, if you wanted to use the histogram of the object, you could do a similar matching but with a different distance metric. Instead of using the Shape Context Distance, you could store a histogram for all objects in your database and compute the Earth Mover's Distance between your query object and all other objects in your database.
It is possible to encode both of these distances in your final result. You can come up with some weighting scheme between them that makes sense for you.