vector subscript out of range [closed]

asked 2014-05-28 14:13:05 -0600

Hm gravatar image

updated 2014-05-28 14:18:46 -0600

berak gravatar image

i have acode for check the lbp code for pgm image if it is uniform code or not but when i run the code i have this vector out of range error: debug assertion failed vector out of range this is my code:

  void LBPFeatures::initUniform( int check)
   {

lookup.resize(255);
int index=0;

for(int i=0;i<=255;i++)
{
    bool status=checkUniform(check);
    if(status==true)
    {
        lookup[i]=index;
        index++;
    }
    else
    {
        lookup[i]=59;
    }
}
spatialhist Hist;
 Hist.initHistogram();

}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-04 15:51:57.648067

Comments

lookup.resize(255); // should be 256 (2^8)

(also, careful, the 59 bins assumption there is only valid for exactly 8 neighbours)

berak gravatar imageberak ( 2014-05-28 14:16:14 -0600 )edit

thanks that's right it work now

Hm gravatar imageHm ( 2014-05-28 14:43:00 -0600 )edit