Re: [bonsai-users] rats head orientation tracking

476 views
Skip to first unread message
Message has been deleted

Gonçalo Lopes

unread,
Jul 6, 2017, 8:27:23 PM7/6/17
to Joan Esteve Agraz, Bonsai Users
Hi Joan and welcome to the forums!

Can you explain a bit more about what you want to extract from the video? Also, what is the area of interest you are looking at? Is it just the inside arena where the two animals meet, or do you also care about the edges that have the moving doors?

If it's just the inside space, I have run BackgroundSubtraction on the video and it seems to work fine. You get a bit of single-pixel noise but this can be easily filtered out in the FindContours node by setting a MinArea for detected objects. Do you find problems in other videos?

Also, if you are interested in following each animal independently, since they are separated by a partition you can use independent branches to track each of them, with a different Crop node at the beginning of each branch. This way you can get for each region the largest binary object and this should always correspond to one of the animals.

I noticed you used the BinaryRegionExtremes node to keep track of the furthermost point (head). That is not a bad way to get started, although it may fail in some conditions. Tracking features like the ears or nose may or may not work depending on illumination and movement constraints. If you want to take into account possible 3D movements of the animal it can get really hard with this view.

You may have to consider other ways of making it easier to identify features of interest in the video (colour?).



On 6 July 2017 at 20:54, Joan Esteve Agraz <joan.est...@gmail.com> wrote:

Hi all!

I'm really new at this stuff, so sorry in advance for 'unappropiate' questions I may ask...
I'm trying to get the tracking of 2 rats simultaneously in a behavioural arena. 
There're some important aspects I want to ask you... 

- I guessed for getting a proper tracking, as the arena is plenty of stuff that boders and sometimes I lose parts of the animal, I would have to do a background substraction, But I'm a bit desperate about how can I get rid of those things that doesn't 'disappear' by the Backgroud Substraction node so I've been thinking about getting a frame of the background without the animals and substract it from all the frames of the rest of the video. How may I do that propperly? (attached example of video)

- How could I focus on the position and orientation of the head. Is it possible to do for the two animals at the same time? I've reading the workflow for tracking the zebrafish head, and I got some ideas of possible triangulating the nose and ears of the rats, if it would be possible...

I also attach the workflow I've get so far.

I would really appreciate any type of help!

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/b3b236a4-6629-4a79-87b7-42a340c0e07b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Gonçalo Lopes

unread,
Jul 8, 2017, 4:50:31 AM7/8/17
to Joan Esteve Agraz, Bonsai Users
Glad to hear that it's working for you. Regarding tracking with multiple branches, I just wanted to say that if you use Zip to combine the results from the branches the tracking will be synchronized, so you don't need to worry about that.

On 7 July 2017 at 08:47, Joan Esteve Agraz <joan.est...@gmail.com> wrote:
Hey Gonçalo,

thank you for the answer!!
I did not thought about the two branches, is just that simple and useful! :D

Actually, I aim to 'measure' and quantify the 'social' interaction between the two rats (i.e. every time they gaze each other, each time one rats pokes into the other...) 
So in order to get this, I thought tracking both of them at the same time would be better for the offline analysis. If I track them separately, I would have to synchronize it.

I've been thinking and, by now is the area where they meet where I need to focus on. So it's better in terms of getting rid of the doors and other stuff.

I used  BinaryRegionExtremes in order to get the head-tail points for position and orientation (mainly for head-position). By now, that's the illumination and camera-vision that we're going to have so far (we use red light). So I will have to get along with it. :D


Again, thank you!


El viernes, 7 de julio de 2017, 2:27:23 (UTC+2), goncaloclopes escribió:
Hi Joan and welcome to the forums!

Can you explain a bit more about what you want to extract from the video? Also, what is the area of interest you are looking at? Is it just the inside arena where the two animals meet, or do you also care about the edges that have the moving doors?

If it's just the inside space, I have run BackgroundSubtraction on the video and it seems to work fine. You get a bit of single-pixel noise but this can be easily filtered out in the FindContours node by setting a MinArea for detected objects. Do you find problems in other videos?

Also, if you are interested in following each animal independently, since they are separated by a partition you can use independent branches to track each of them, with a different Crop node at the beginning of each branch. This way you can get for each region the largest binary object and this should always correspond to one of the animals.

I noticed you used the BinaryRegionExtremes node to keep track of the furthermost point (head). That is not a bad way to get started, although it may fail in some conditions. Tracking features like the ears or nose may or may not work depending on illumination and movement constraints. If you want to take into account possible 3D movements of the animal it can get really hard with this view.

You may have to consider other ways of making it easier to identify features of interest in the video (colour?).

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/bonsai-users.

Joan Esteve Agraz

unread,
Jul 14, 2017, 5:12:48 AM7/14/17
to Bonsai Users, joan.est...@gmail.com
Hey Gonçalo,

was considering that you said about tracking the ears or eyes of the rats. That's why I used BinaryRegionExtremes, and as you said, sometimes the points switch or select other parts of the rats. Is there any other way that I can measure the orientation of the nose? Trying to triangulate the nose with the ears or eyes would be possible ir order to get that?

Cheers! 
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages