Code covered by the BSD License  

Highlights from
Foreground segmentation

3.77778

3.8 | 9 ratings Rate this file 97 Downloads (last 30 days) File Size: 639 KB File ID: #6860
image thumbnail

Foreground segmentation

by

 

04 Feb 2005 (Updated )

Uses graph cuts to segment foreground objects from a static background in video.

| Watch this File

File Information
Description

This package contains m-files for the segmentation of a moving foreground from video with a static background, using graph cuts to achieve a clean result.

For more details and an accompanying paper please see http://cs.smith.edu/~nhowe/research/code/

MATLAB release MATLAB 7.0.1 (R14SP1)
Other requirements Indeo 5 codec for sample video.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
06 Dec 2014 Adnan

Not working.. error in opening SampleVideo.avi. I tried (.avi) video from own dataset and got error
Undefined function 'gcut' for input arguments of type 'double'.

Error in graphLabel (line 16)
cut = gcut([zeros(2),C;C',P],[1 2]);

26 Sep 2014 Mohammad Mahdi Derakhshani

Hello Dears,
when I executed this script in Maltab I received this error,
Undefined function 'gcut' for input arguments
of type 'double'.
Error in graphLabel (line 16)
cut = gcut([zeros(2),C;C',P],[1 2]);
Error in extractForeground (line 113)
label =
reshape(graphLabel(alpha*[max(2*significanceThreshold-deviation(:)',0);deviation(:)'],connections),size(deviation));

Error in RUNME (line 29)
fg = extractForeground(frames);

So how can I solve it? Please help me it's so crucial for me to settle that!!
Thanks!

07 May 2014 Turgay Senlet

The problem comes from the places where original code converts int's to pointers. In 32-bit machine this is okay, but with 64-bit, you need to use a 64-bit type instead of int. In this case, if you read the error in detail, it tells you that mwIndex (a 64-bit pointer of type unsigned long *) is being assigned to an int. If you go to that line you see ir = mxGetIr(prhs[0]); Find where ir is defined (line 127: int *ir, *jc;) and change its type to a unsigned long *. unsigned long *ir, *jc; And repeat a similar procedure for this kind of errors (occurs 5-6 times, including the ones in pixCon.cpp).
I did this and I was able to compile with large arrays, but my Matlab crashes when running the code. Good luck.

07 Aug 2013 Kiwon Yun

I also have the same problem to compile the 'gcut.cpp' file by using 'mex' in a 64-bits machine. Does somebody solve this?

05 Feb 2013 Cedric

I have this problem while doing the mex file (linux 64-bits version):

mex gcut.cpp -largeArrayDims

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

gcut.cpp: In function ‘void matlabParse(int, const mxArray**, long int*, long int*, node**, arc**, long int**, node**, node**, long int*)’:
gcut.cpp:144:25: error: cannot convert ‘mwIndex* {aka long unsigned int*}’ to ‘int*’ in assignment
gcut.cpp:145:25: error: cannot convert ‘mwIndex* {aka long unsigned int*}’ to ‘int*’ in assignment

mex: compile of ' "gcut.cpp"' failed.

04 May 2011 zhang

thank you

04 May 2011 zhang

thank you!

25 Mar 2009 Sean Connery

That`s exactly what I need now.Thank you so much~!

09 Sep 2008 saidi lotfi  
23 May 2007 Krishna Sridhar

Really cool code.. I dont have much of a vision expertise and I wanted the foreground images..
This code works with such ease.. Just remember to do mex gcut.cpp when u copy into ur machine..

11 Apr 2006 Piyorot Khongchuay

cool

07 Mar 2006 Alex Denone  
17 Nov 2005 anand karemola

This is the best one for caputuring image,i wan use this code for my project.Could you please help for getting the graph cut images of different frames.I will appreciate if you could help me out.

29 Jun 2005 Ayesha Malik

Can you convert this piece of code for foreground segmentation on a live video?? I would certainly appreciate if you help me out in doing so.

16 Jun 2005 Kamran Iqbal  
10 Feb 2005 MO Ahmed

Thank you

Contact us