Is the sharpness of imaging different within the depth of field? Where is the sharpest? What I am asking is the distance from the lens to the object, not the image distance in the lens. How to calculate this distance?
The clearest image of an object is always when the object is in focus — at the plane of focus. That is, for a given lens of focal length ƒ, when the lens is positioned a distance v from the camera sensor, then an object at distance u from the lens is in focus in accordance with the thin lens approximation, ƒ-1 = u-1 + v-1.
Never forget: depth of field is a myth. The term is a convenient shorthand for a standard of how much defocus is acceptable, and is dependent on the ultimate size of the print or level of magnification in examination, as much as the magnification on the negative or sensor.
At the highest resolution examination, even with a very small aperture, the plane of focus is effectively a mathematical plane, having no thickness (and ignoring field curvature, which is an aberration of real lenses). All depth of field refers to is the thickness of the zone in which the level of defocus is "acceptable".
The image is sharpest at the focus distance. Many lenses have markings that roughly indicate that distance but you can also extract it from EXIF data shot from a digital camera.
Sharpness decreases away from the plane of focus. Depth-of-Field is simply a concept to describe a range of distances which are sufficiently sharp. Sufficiently sharp depends on the image viewing size and viewing distance, so most charts and calculators for Depth-of-Field assume a certain print size (10x8" is common) and viewing size.
If you want to know the distance from the lens to the object then you have to subtract the flange distance and length of the lens from the focus-distance. Keep in mind that most lenses change in length depending on the set focal-length (for a zoom) and focus-distance.
There is one more minor catch called Field Curvature. This is an optical default causing the focus-plane to be curved rather than an actual being actually flat as a plane would normally be. Only some lenses show this and it can vary by the set aperture and focus-distance. When Field-Curvature occurs, the distance to the sharpest points in the scene will depend on its position within the field-of-view.