Runtime error opencvHaarFInderExample

When I try to run the opencvHaarFInderExample example code from addonsexamples, I
get the following runtime error in the PixelType class on this line:

std::swap(pixels_ptr[0],pixels_ptr[2]);

“Program received signal: EXEC BAD ACCESS”

Has anyone else run into this/know how to solve?

From Kyle McD:
“i saw this exact problem from another student, and we fixed it by
commenting out the swapRgb call… but then the image R and B channels
were incorrect :/”

Thanks,
Jack

yes, this is fixed in github in both the master and develop branches, if you don’t want to use the version from git, just change the swapRgb method in ofPixels.cpp with:

  
  
template<typename PixelType>  
void ofPixels_<PixelType>::swapRgb(){  
    if (channels >= 3){  
        int sizePixels = width*height*channels;  
        for (int i=0; i< sizePixels; i+=channels){  
            std::swap(pixels[i],pixels[i+2]);  
        }  
    }  
}