Also (even though there are many right answers here), every of these methods in jQuery, such as children(), siblings(), parents(), closest(), etc. accept a jQuery selector as a parameter.
So doing
$("#some_id").children("img").length
should return what you need as well.