eliminating a color in image
Hi i wanted to eliminate gray color from my image, i just need black or white
So i used this code,but in beagle bone black and in some computers, code crashes but in my laptop it works fine what is happening?
code:
typedef cv::Point3_<uint8_t> Pixel;
for (Pixel &p : cv::Mat_<Pixel>(frame))
{
if(p.x<127 ||p.y<127 ||p.z<127 )
{
p.x = 0;
p.y = 0;
p.z = 0;
}
}
gives me this error: OpenCV Error: Bad argument (The total number of matrix elements is not divisible by the new number of rows) in reshape
"compilers give me this error" ? that's not a compiler error
a good idea is to split frame and use threshold method : threshold(frame,frame,127,255,THRESH_TOZERO_INV )
you are right not a compiler error
" i wanted to eliminate gray color from my image, i just need black or white" -- that's not really, whatyour code is doing, in the 1st place.
my input image has only white black and gray colors, so under 127 will eliminate gray