Skip to content

Instantly share code, notes, and snippets.

@mokemokechicken
Created May 22, 2012 06:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mokemokechicken/2766974 to your computer and use it in GitHub Desktop.
Save mokemokechicken/2766974 to your computer and use it in GitHub Desktop.
Patch of apps/traincascade/imagestorage.cpp in OpenCV2.4
--- imagestorage.cpp.orig 2012-05-22 06:03:04.257949013 +0000
+++ imagestorage.cpp 2012-05-18 04:03:03.093470949 +0000
@@ -149,15 +149,15 @@
bool CvCascadeImageReader::PosReader::get( Mat &_img )
{
CV_Assert( _img.rows * _img.cols == vecSize );
+ if( feof( file ) || last++ >= count )
+ return false;
+
uchar tmp = 0;
size_t elements_read = fread( &tmp, sizeof( tmp ), 1, file );
CV_Assert(elements_read == 1);
elements_read = fread( vec, sizeof( vec[0] ), vecSize, file );
CV_Assert(elements_read == (size_t)(vecSize));
- if( feof( file ) || last++ >= count )
- return false;
-
for( int r = 0; r < _img.rows; r++ )
{
for( int c = 0; c < _img.cols; c++ )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment