riflosnake / HumanCursor

Simulate Human Cursor Movement for Automated Scripts
MIT License
87 stars 16 forks source link

Parameters in HumanMouseTrajectory class to obtain a realistic cursor movement #5

Closed KathrineSN closed 9 months ago

KathrineSN commented 10 months ago

Hi!

I am developing a psychological experiment in PsychoPy where I need to mimic human cursor movements between two points. For this purpose I am utilizing the HumanMouseTrajectory (https://github.com/riflosnake/HumanCursor/blob/main/humancursor/utilities/human_curve_generator.py#L7). However, I am struggling to make the trajectories appear realistic enough for my purposes and I believe the main reason why the trajectories do not look realistic is because I am struggling with choosing the right input parameters. Currently, I am using the parameter in the image below. However, the movements are often times more S-shaped than a realistic human cursor movement. billede

Do you have any recommendations for how I can make the movements look more believeable?

NB! My framerate is 61.1 FPS

riflosnake commented 10 months ago

The offset boundaries limit the movement (left or right) for x, and (up or down) for y. So lower values of these will produce a straighter and narrower line, bigger values will produce broader and bigger lines.

The distortion parameters just add irregularity, somewhat simulating the shaking or unstability of the user. They are not important in your question.

Target points are self explanatory, the number of points plotted into graph, they define fluency of the movement.

The parameter you are looking for, is knots_count. This adds vertexes on the line, where it turns and bends. So if you set it as 1, it will do a normal, curved line. 2 knots will produce that S shape you mentioned, which is default the most probable option the program chooses. Knots count of 3, 4 and higher, will produce lines with more of these turns, you can just experiment which one looks best to you. I would suggest a combination of knots_count of 1, 2, 3, 4, 5.

My package of course needs a lot of improvements and retouches, the parameters and probabilites chosen for each of them are tweaked from my personal experimenting, maybe you can send feedback and help make it better.

KathrineSN commented 10 months ago

Thank you so much for the explanation! I will try to experiment with the knots_count parameter. I will happily send feedback as well once I am further with my experimentation.