Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Is it possible to count the number of objects that pass through a specified line (boundary) in a video?

Subject: Is it possible to count the number of objects that pass through a specified line (boundary) in a video?

From: Olu A

Date: 9 Sep, 2010 13:24:11

Message: 1 of 4

After looking at the viptraffic and viptrafficof demos in the video and image processing blockset, I was wondering if it is possible to determine and count objects that cross a line (region of interest/boundary) that is placed onto the video.

Both demos mentioned above have a line that separates the video into two sections (top and bottom). They also contain a counter that counts the number of objects in the bottom section. Is it possible to count objects that move from the top section to the bottom section? Basically it is possible to determine objects that cross a boundary in particular direction?

Subject: Is it possible to count the number of objects that pass through a specified line (boundary) in a video?

From: Sean

Date: 9 Sep, 2010 13:40:26

Message: 2 of 4

"Olu A" <nothing@yahoo.com> wrote in message <i6an5r$gsm$1@fred.mathworks.com>...
> After looking at the viptraffic and viptrafficof demos in the video and image processing blockset, I was wondering if it is possible to determine and count objects that cross a line (region of interest/boundary) that is placed onto the video.
>
> Both demos mentioned above have a line that separates the video into two sections (top and bottom). They also contain a counter that counts the number of objects in the bottom section. Is it possible to count objects that move from the top section to the bottom section? Basically it is possible to determine objects that cross a boundary in particular direction?

It is possible. What does your data look like?
If you just treat your video as a 3D matrix you can then you can do a connected components analysis, define your ROI, and see everything that intersects it.

Subject: Is it possible to count the number of objects that pass through a specified line (boundary) in a video?

From: Olu A

Date: 9 Sep, 2010 14:13:23

Message: 3 of 4

>
> It is possible. What does your data look like?
> If you just treat your video as a 3D matrix you can then you can do a connected components analysis, define your ROI, and see everything that intersects it.

==
I am using a regular webcam. Video is coming in as RGB which can be converted to intensity.

I was thinking of doing something like you mentioned where I "AND" the ROI and the object and see if they are overlapping.

Thinking out loud, to detect what direction the object is moving, I think I will need two or more ROI (boundaries) and see if an object crosses them sequentially. To do this a "label" will have to be associated with the object over times (over frames)

Subject: Is it possible to count the number of objects that pass through a specified line (boundary) in a video?

From: Sean

Date: 9 Sep, 2010 14:20:24

Message: 4 of 4

"Olu A" <nothing@yahoo.com> wrote in message <i6aq23$rtu$1@fred.mathworks.com>...
> >
> > It is possible. What does your data look like?
> > If you just treat your video as a 3D matrix you can then you can do a connected components analysis, define your ROI, and see everything that intersects it.
>
> ==
> I am using a regular webcam. Video is coming in as RGB which can be converted to intensity.
>
> I was thinking of doing something like you mentioned where I "AND" the ROI and the object and see if they are overlapping.
>

Exactly!

> Thinking out loud, to detect what direction the object is moving, I think I will need two or more ROI (boundaries) and see if an object crosses them sequentially. To do this a "label" will have to be associated with the object over times (over frames)

Another way would be to find the centroid of the object in each 2d slice and then just calculate your displacement components (v = r1-r2),(u = c1-c2).

Tags for this Thread

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.

Contact us