Thread Subject: Orientation of an animal's head

Subject: Orientation of an animal's head

From: Thomas Hippocampus

Date: 2 Sep, 2010 20:34:19

Message: 1 of 8

I'm creating tracking software for animal behavior studies using a camera overhead an arena. I can segment the animal almost perfectly, but I need to know which direction its head is pointing. I can't segment the head by itself (unless someone knows how), but I do know that the head is very triangular with respect to the rest of the segmented image. I'm also doing this real-time off a video feed, so faster is better.

Any ideas?

Subject: Orientation of an animal's head

From: ImageAnalyst

Date: 2 Sep, 2010 20:39:36

Message: 2 of 8

Post some sample images (more than just 2 or 3) to http://drop.io.

Subject: Orientation of an animal's head

From: Thomas Hippocampus

Date: 2 Sep, 2010 20:52:06

Message: 3 of 8

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <ceece21b-f1b6-4da6-bb13-2a5dffce4f76@f6g2000yqa.googlegroups.com>...
> Post some sample images (more than just 2 or 3) to http://drop.io.

Sorry, didn't know that img sharing is so easy nowadays.

http://drop.io./dentategyrus

I know you said more than 2 or 3, but these are the first two I could grab. One shows the normal video feed and the other shows the segmented rat. Ignore the accidental segmentation of the rat's reflection, today I'm using a temporary box that is unfortunately very glossy.

Thanks in advance, I can gladly post some more pics, I'm just not sure what else you'd like to see.

Subject: Orientation of an animal's head

From: ImageAnalyst

Date: 2 Sep, 2010 22:44:26

Message: 4 of 8

Looks challenging. I guess what I'd try is to first get rid of the
tail, hopefully by using a morphological opening. Then I'd probably
get the boundary with bwboundaries() and run along looking for the
sharpest angle, which might be the nose. But if it had its nose
tucked into its side, you might have a spurious sharp angle there.
Another thing to try would be to figure out how many boundary pixels
comprise the head. Let's say you have a reference image and you
determine that the head is 500 pixels from left side of its neck to
the tip of the nose to the right side of the neck. Now, those 500
boundary pixels will be some area, which you can determine with
polyarea. Let's say that turned out to be 25000 pixels. Now you have
a known thing to look for - a stretch of 500 pixels that, when closed
off to form a roughly triangular region, should be about 25000
pixels. Now take a random rat. Clip its tail off (actually this
might not be necessary with this algorithm), then find the boundary.
Then start running around looking at areas of 500 pixel long boundary
regions. Probably not many will be 25000 pixels big except for some
around the head zone. You may have several that meet the
requirements, since, after all, there are probably several places
where you can define the start of the left neck and right neck that
give roughly the same area. So you might have to do some fine tuning
when you find that region. Maybe take the middle stretch that gives
you 25000 pixel areas, or something like that.

Well that's just a guess based on. . . well, nothing actually - just
my intuition. But it might work. You might find better methods by
looking at the pattern recognition literature (http://iris.usc.edu/
Vision-Notes/bibliography/contents.html) or by asking in
sci.image.processing.

Subject: Orientation of an animal's head

From: Patrick Mineault

Date: 2 Sep, 2010 22:44:38

Message: 5 of 8

On Sep 2, 4:52 pm, "Thomas Hippocampus"
<amygdalohippocam...@gmail.com> wrote:
> ImageAnalyst <imageanal...@mailinator.com> wrote in message <ceece21b-f1b6-4da6-bb13-2a5dffce4...@f6g2000yqa.googlegroups.com>...
> > Post some sample images (more than just 2 or 3) tohttp://drop.io.
>
> Sorry, didn't know that img sharing is so easy nowadays.
>
> http://drop.io./dentategyrus
>
> I know you said more than 2 or 3, but these are the first two I could grab. One shows the normal video feed and the other shows the segmented rat. Ignore the accidental segmentation of the rat's reflection, today I'm using a temporary box that is unfortunately very glossy.
>
> Thanks in advance, I can gladly post some more pics, I'm just not sure what else you'd like to see.

One possibility is to first fit a skeleton to the shape. Then finding
the head and its direction is trivial. For example:

http://www.win.tue.nl/~alext/ALEX/PAPERS/VisSym02/dskel.pdf

From a quick Google scholar search though people tend to solve this in
a much more pragmatic fashion, that is, by taping a green and a red
LED to the back of the rat.

Subject: Orientation of an animal's head

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 3 Sep, 2010 10:17:18

Message: 6 of 8

Thomas Hippocampus <amygdalohippocampus@gmail.com> wrote:
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <ceece21b-f1b6-4da6-bb13-2a5dffce4f76@f6g2000yqa.googlegroups.com>...
>> Post some sample images (more than just 2 or 3) to http://drop.io.
>
> Sorry, didn't know that img sharing is so easy nowadays.
>
> http://drop.io./dentategyrus
>

Do you need to know which way the head is pointing, or just which end has
the head? If the latter, perhaps the simpler thing to determine is which
end is not the head. That long tail looks easy to spot.

--
Dr Tristram J. Scott
Energy Consultant

Subject: Orientation of an animal's head

From: Thomas

Date: 3 Sep, 2010 13:10:28

Message: 7 of 8

I think that finding the skeleton shouldn't be a problem (just about to try). But, given a skeletonized image, I don't know how to get the orientation of the head.

Patrick Mineault <patrick.mineault@gmail.com> wrote in message <dbb916c8-6656-4680-bbbb-b163165ebf21@m1g2000yqo.googlegroups.com>...
> On Sep 2, 4:52 pm, "Thomas Hippocampus"
> <amygdalohippocam...@gmail.com> wrote:
> > ImageAnalyst <imageanal...@mailinator.com> wrote in message <ceece21b-f1b6-4da6-bb13-2a5dffce4...@f6g2000yqa.googlegroups.com>...
> > > Post some sample images (more than just 2 or 3) tohttp://drop.io.
> >
> > Sorry, didn't know that img sharing is so easy nowadays.
> >
> > http://drop.io./dentategyrus
> >
> > I know you said more than 2 or 3, but these are the first two I could grab. One shows the normal video feed and the other shows the segmented rat. Ignore the accidental segmentation of the rat's reflection, today I'm using a temporary box that is unfortunately very glossy.
> >
> > Thanks in advance, I can gladly post some more pics, I'm just not sure what else you'd like to see.
>
> One possibility is to first fit a skeleton to the shape. Then finding
> the head and its direction is trivial. For example:
>
> http://www.win.tue.nl/~alext/ALEX/PAPERS/VisSym02/dskel.pdf
>
> From a quick Google scholar search though people tend to solve this in
> a much more pragmatic fashion, that is, by taping a green and a red
> LED to the back of the rat.

Subject: Orientation of an animal's head

From: Thomas

Date: 3 Sep, 2010 13:12:09

Message: 8 of 8

I think the easiest solution to my question is that I need to 'Rudolph' the rat - place a huge red dot over the end of his nose so I can tell when his nose touches an object. Since I was having trouble with this, I was thinking of trying to get the head orientation and project a line through the nose. Either way should work if anyone knows how to do it.

tristram.scott@ntlworld.com (Tristram Scott) wrote in message <i5qhve$l5s$1@news.eternal-september.org>...
> Thomas Hippocampus <amygdalohippocampus@gmail.com> wrote:
> > ImageAnalyst <imageanalyst@mailinator.com> wrote in message <ceece21b-f1b6-4da6-bb13-2a5dffce4f76@f6g2000yqa.googlegroups.com>...
> >> Post some sample images (more than just 2 or 3) to http://drop.io.
> >
> > Sorry, didn't know that img sharing is so easy nowadays.
> >
> > http://drop.io./dentategyrus
> >
>
> Do you need to know which way the head is pointing, or just which end has
> the head? If the latter, perhaps the simpler thing to determine is which
> end is not the head. That long tail looks easy to spot.
>
> --
> Dr Tristram J. Scott
> Energy Consultant

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com