fixed "Invalid background description file" bug, #1676
This commit is contained in:
parent
afd9523ff2
commit
f341ce2665
@ -52,6 +52,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "highgui.h"
|
#include "highgui.h"
|
||||||
|
|
||||||
@ -1230,8 +1231,8 @@ CvBackgroundData* icvCreateBackgroundData( const char* filename, CvSize winsize
|
|||||||
if( !fgets( imgfilename, PATH_MAX - (int)(imgfilename - full) - 1, input ))
|
if( !fgets( imgfilename, PATH_MAX - (int)(imgfilename - full) - 1, input ))
|
||||||
break;
|
break;
|
||||||
len = (int)strlen( imgfilename );
|
len = (int)strlen( imgfilename );
|
||||||
if( len > 0 && imgfilename[len-1] == '\n' )
|
for( ; len > 0 && isspace(imgfilename[len-1]); len-- )
|
||||||
imgfilename[len-1] = 0, len--;
|
imgfilename[len-1] = '\0';
|
||||||
if( len > 0 )
|
if( len > 0 )
|
||||||
{
|
{
|
||||||
if( (*imgfilename) == '#' ) continue; /* comment */
|
if( (*imgfilename) == '#' ) continue; /* comment */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user