A medical or dental imaging system for generating an image of at least one part of the head of a patient, comprising: a frame, a rotation unit having an x-ray source for the emission of x-rays towards the head of the patient and an x-ray detector which is configured to receive at least a portion of the x-rays emitted by the x-ray source, wherein the rotation unit is rotatably coupled to the frame and is configured to move around the head so that the x-ray source and the x-ray detector take up a plurality of different positions to generate a plurality of x-ray images of the at least one part of the head at said different positions, a tracking device (7A-7D) which is configured to provide sensor data indicative of any movement of the at least one part of the head during the acquisition of the plurality of x-ray images of the at least one part of the head, and a computer communicatively coupled to the x-ray detector and to the tracking device (7A-7D) and configured to receive and process the sensor data of the tracking device (7A - 7D) to generate tracking data and to calculate a three-dimensional x-ray image of the at least one part of the head based on the plurality of x-ray images generated at different positions and on the tracking data to compensate for any movement of said at least one part of the head during the acquisition of the plurality of x-ray images, characterized in that the tracking device (7A-7D) comprises at least one camera and an attachment device for detachable attachment of the at least one camera to the patient such that the at least one camera faces and records at least one tracking marker of the tracking device (7A-7D) in order to generate the sensor data comprising images of the at least one tracking marker. a frame, a rotation unit having an x-ray source for the emission of x-rays towards the head of the patient and an x-ray detector which is configured to receive at least a portion of the x-rays emitted by the x-ray source, wherein the rotation unit is rotatably coupled to the frame and is configured to move around the head so that the x-ray source and the x-ray detector take up a plurality of different positions to generate a plurality of x-ray images of the at least one part of the head at said different positions, a tracking device (7A-7D) which is configured to provide sensor data indicative of any movement of the at least one part of the head during the acquisition of the plurality of x-ray images of the at least one part of the head, and a computer communicatively coupled to the x-ray detector and to the tracking device (7A-7D) and configured to receive and process the sensor data of the tracking device (7A - 7D) to generate tracking data and to calculate a three-dimensional x-ray image of the at least one part of the head based on the plurality of x-ray images generated at different positions and on the tracking data to compensate for any movement of said at least one part of the head during the acquisition of the plurality of x-ray images, characterized in that the tracking device (7A-7D) comprises at least one camera and an attachment device for detachable attachment of the at least one camera to the patient such that the at least one camera faces and records at least one tracking marker of the tracking device (7A-7D) in order to generate the sensor data comprising images of the at least one tracking marker.