Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions feature_mapper/pinch_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ def process_features(self, raw_landmarker_data: dict) -> dict:
distance = math.dist([index_pos.x, index_pos.y], [thumb_pos.x, thumb_pos.y])
middle = np.mean([index_pos.x, thumb_pos.x]), np.mean([index_pos.y, thumb_pos.y])
if distance < 0.1:
freq = 100000/((middle[0]**2) * 1000 + 100)
volume = middle[1]
freq = 200 * 50 ** (1-middle[0])
#freq = 100000/((middle[0]**2) * 1000 + 100)
volume = 1-middle[1]

self.audio_params['frequency'] = freq
self.audio_params['volume'] = volume
Expand Down
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@ def main(scenario_file: str):
while scenario.video_input.is_alive():
# Frame acquisition
frame: np.ndarray = scenario.video_input.get_frame()
# frame = cv2.flip(frame, 1)

# feature extractor output
features = scenario.feature_extractor.process(frame)

# draw landmarks
scenario.feature_extractor.draw_landmarks(frame, features['landmarks'])

# mapping between features and audio data
# audio_params = scenario.feature_mapper.process_features(features)
audio_params = scenario.feature_mapper.process_features(features)

# sending audio params
# scenario.audio_generator.data_to_send = audio_params
scenario.audio_generator.data_to_send = audio_params

# frame to display
display.frame = frame
Expand Down
16 changes: 16 additions & 0 deletions scenarios/main_scenario_flircam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
scenario: main

video_input:
class: Flircam

feature_extractor:
class: HandLandmarker

feature_mapper:
class: PinchGestureMapper

audio_generator:
class: OSCGenerator
params:
ip: "127.0.0.1"
port: 11111
3 changes: 2 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

# python main.py --scenario scenarios/main_scenario.yml
# python main.py --scenario scenarios/barycenter_scenario.yml
python main.py --scenario scenarios/pose_scenario.yml
source .venv/bin/activate
python main.py --scenario scenarios/pose_scenario_flircam.yml