bitwise_and giving Sizes of input arguments do not match
I'm trying to use bitwise in order to exclude all the rest of an image based on a threshold but when i try it gives
OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array') in binary_op, file /home/schirrel/Github/opencv/opencv-2.4.10/modules/core/src/arithm.cpp, line 1021 terminate called after throwing an instance of 'cv::Exception' what(): /home/schirrel/Github/opencv/opencv-2.4.10/modules/core/src/arithm.cpp:1021: error: (-209) The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array' in function binary_op
My code is
Mat src, src_gray, dst;
int main() {
src = imread("robosoccer.jpg", 1);
cvtColor(src, src_gray, CV_BGR2GRAY);
threshold(src_gray, dst, 150, 255, 1);
Mat res;
bitwise_and(src, dst, res);
imshow("AND", res);
("hold", res);
waitKey(0);
return (0);
}
Can u guys help me?