How can I recognize the height and the width of a human body in an image?
问题:
回答1:
You need some point of reference. A simple photo will not do, unless you know the camera setup (placement, zoom, lens distortion, etc.), and the location of the person relative to the camera.
If you do have a reference (like a grid in the background or something) then you can measure the grid and go from there. Doesn't sound like what you need though.
回答2:
To expand on what others have said, you can break down this complicated task into several (still difficult) components.
Identify the square of pixels containing the human.
Identify the square of pixels containing a reference object of which you know its real-world dimensions. (e.g. a coke can, a ruler, etc.)
Identify the 3D relation between the two objects, so you can translate pixels of the reference object into the same scale as the human's pixels.
Calculate the human's dimensions using the formula:
human.real_height = human.pixel_height*reference.real_height/reference.pixel_height
Granted, this process is far from foolproof, and still quite hard, but it should provide a reasonable approximation. I haven't played around with the existing toolkits much, but you might start with OpenCV, with has Python bindings. Also, the SIFT algorithm is an interesting technique that might work here, but I think there's only a C# implementation.
The third step would likely be the most difficult if you're only using a single image. People extract 3D image data through stereoscopy (i.e. we use images from both of our eyes to "deduce" depth), but even then it's not foolproof since color and shading can throw us off. I'd imagine it's possible to do using a single image, but would likely be even more error prone. This is an area of active research, so I'd lookup books on computer vision to get a better idea of what's currently practical.
回答3:
As Brad pointed out, this isn't really doable, unless pictures are made in controlled conditions. If not, then you're probably out of luck, since forced perspective can trick even the best of algorithms that detect human height and width.