To realize a technique for calculating a positional relationship between a target coordinate axis fixed with respect to a detection target and a reference coordinate axis defined independently of motion and the like of the detection target, a first and a second linear magnetic fields in known directions on the reference coordinate axis are generated and a direction of the first and the second linear magnetic fields on the target coordinate axis are detected by a magnetic field sensor installed in an capsule endoscope (2), which is the detection target. By comparing the directions, which are detected by the magnetic field sensor, of the first and the second linear magnetic fields on the target coordinate axis and the known directions of the first and the second linear magnetic fields on the reference coordinate axis, a deviation of the direction of the target coordinate axis with respect to the reference coordinate axis is detected. Further, a positional relationship of an origin of the target coordinate axis with respect to an origin of the reference coordinate axis is calculated by generating diffuse magnetic field, other than the first and the second magnetic fields, whose strength decreases corresponding to a distance.