Skip to content

Commit c840180

Browse files
committed
change colours
1 parent 34bffbe commit c840180

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

src/pupil_labs/gaze_on_facial_landmarks/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def run_all(args_input):
301301

302302
# Count percentages of mapped data on each AOI
303303
percentages_df = map_on_landmarks.get_percentages(merged_selected)
304-
percentages_path = os.path.join(output_path, "_percentages.csv")
304+
percentages_path = os.path.join(output_path, "percentages.csv")
305305
percentages_df.to_csv(percentages_path, index=False)
306306
logging.info(f"Percentages were saved at {percentages_path}")
307307

src/pupil_labs/gaze_on_facial_landmarks/map_on_landmarks.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
## Function to draw bounding box and facial landmarks on a frame
1515
def map_and_draw(frame, face_info, aoi_size, ellipse_size, gaze_crcl_size):
16-
transparency = 60 # Adjust this value as needed
16+
transparency = 60
1717
# Define colors for landmarks
18-
default_color = (255, 0, 0) # Default color for landmarks
19-
gaze_color = (0, 255, 0) # Color for the gazed landmark
18+
default_color = (120,120,120) # Default color for landmarks
19+
gaze_color = (0, 200, 0) # Color for the gazed landmark
2020

2121
# Draw bounding box
2222
p1 = (int(face_info["p1 x [px]"]), int(face_info["p1 y [px]"]))
@@ -73,7 +73,6 @@ def map_and_draw(frame, face_info, aoi_size, ellipse_size, gaze_crcl_size):
7373
):
7474
landmark_list.append(landmark)
7575
color = gaze_color
76-
7776
else:
7877
landmark_list.append("Not on landmark")
7978
color = default_color
@@ -173,21 +172,12 @@ def plot_percentages(df_perc, out_path):
173172
plt.bar(df_perc['landmark'], df_perc['percentage'], color=colors)
174173

175174
# Adjusting font size and style
176-
plt.title('Percentage of Gaze Mapped on Different Landmarks', fontsize=30, fontweight='bold')
175+
plt.title('Percentage of Gaze Mapped on Different Landmarks', fontsize=30, fontweight='bold', y =1.05)
177176
plt.xlabel('Landmark', fontsize=28)
178177
plt.ylabel('%-Gaze Mapped \n(out of all data detected on face)', fontsize=28)
179178
plt.xticks(rotation=45, fontsize=25)
180179
plt.yticks(fontsize=25)
181180
plt.tight_layout()
182-
figure_path = os.path.join(out_path, "_barplot.png")
181+
figure_path = os.path.join(out_path, "barplot.png")
183182
plt.savefig(figure_path, bbox_inches='tight', pad_inches=1.0)
184-
logging.info(f"Barplot saved at: {figure_path}")
185-
186-
# Plotting Pie Chart
187-
plt.figure(figsize=(12, 10))
188-
plt.pie(df_perc['percentage'], labels=df_perc['landmark'], colors=colors, autopct='%1.1f%%', startangle=140, textprops={'fontsize': 25}) # Adjust fontsize here
189-
plt.title('Percentage of Gaze Mapped on Different Landmarks', fontsize=30, fontweight='bold')
190-
pie_path = os.path.join(out_path, "_pie.png")
191-
# Save the plot to out_path
192-
plt.savefig(pie_path,bbox_inches='tight', pad_inches=1.0)
193-
logging.info(f"Pie chart saved at: {pie_path}")
183+
logging.info(f"Barplot saved at: {figure_path}")

0 commit comments

Comments
 (0)