A driving block includes a plurality of magnetic-field generating elements and a driving signal generating section for generating a magnetic field by supplying a driving signal to the plurality of the magnetic-field generating elements, and the magnetic field generated by the plurality of magnetic-field generating elements is detected by a plurality of magnetic-field detecting elements configuring the detecting block. A shape calculating block calculates a shape of an insertion portion by calculating positions of the plurality of magnetic-field generating elements disposed in the insertion portion of an endoscope or the plurality of magnetic-field detecting elements, based on a frequency component corresponding to a frequency of the driving signal in a detection signal detected by the plurality of magnetic-field detecting elements. Oscillation frequency of the reference clock for deciding the frequency of the driving signal is changeably set by the frequency setting section, and the reference clock with oscillation frequency set by the frequency setting section is supplied to both of the driving block and the shape calculating block.