If you define USE_AUDIO constant before including NtKinect.h, the functions and variables of NtKinect related to audio become effective.
Calling the setAudio() function will put the direction of the suond in the member variable "beamAngle". From the viewpoint of a person facing Kinect V2, when moving the right, it becomes a positive value, and when moving to the left, it becomes a negative value.
type of return value | function name | descriptions |
---|---|---|
void | setAudio(bool flag = false) |
Acquire audio and save it in a file during recording
|
void | drawAudioDirection(cv::Mat& image ) | Draw the direction of audio beam on image. |
bool | isOpenedAudio() | Returns whether or not recording is in progress. |
void | openAudio(string path ) | Open path as a recording file |
void | closeAudio() | Close the recording file. |
type | variable name | descriptions |
---|---|---|
float | beamAngle | Direction of audio (angle to the left and right) |
float | beamAngleConfidence | Confidence value of beamAngle (0.0 ... 1.0) |
UINT64 | audioTackingId | Speaker's skeletonTrackingId |
WaveFile.h should already have been added to the project.
Define USE_AUDIO constant before including NtKinect.h.
When calling setAudio(), audio data is acquired by the array microphone and the direction is calculated. The result is in the "beamAngle" and "beamAngleConfidence" member variables. Draw the audio direction on cv::Mat by the drawAudioDirection() function call.
main.cpp |
|
At the upper left of the window, the direction of audio and its reliability are displayed. The audio direction is displayed as a line in another window "beam".
Since the above zip file may not include the latest "NtKinect.h", Download the latest version from here and replace old one with it.