At the last phase of spacecrafts docking, for accurate control in real time, the spacecraft must be able to self-measuring the relative position and attitude against another Fix a three-circles-target onto the object spacecraft, and then take pictures of the target with a digital camera, which has been fixed onto the tracking spacecraft. According to the pattern characters of this target image, a kind of the algorithm was designed, based. on perspective projection principle, to calculate the normal direction of the target plane and the circular center position. Then a kind of the sub-pixel processing method was designed. By this method the locating accuracy of better then 0.1 pixel will be got when calculating the position of the circular center image. It can be used to calibrate principal parameters of the camera against known parameters of this target, and calculate the relative position and attitude of spacecrafts in real time. It also can be applied to self-estimate the relative position and orientation of the unmanned helicopter and the desired landing point, when the unmanned helicopter is landing; or can be used to calibrate the angular displacement sensors of aileron, flap, jaw rudder and elevator of aircraft in real time.