Why Scalar does not work?

asked 2017-04-28 02:02:51 -0600

artdam gravatar image

Following code results in build success, but no window. Without "m = Scalar(0);", it creates black window. Why including Scalar does not work?

int main() {

Mat m = Mat::zeros(200,200,CV_8UC1);
m = Scalar(0);

imshow("m", m);
waitKey();

}

edit retag flag offensive close merge delete

Comments

1

What are you expected ? please read doc

LBerger gravatar imageLBerger ( 2017-04-28 02:23:44 -0600 )edit
1

You mean m = Scalar::all(0); ???

hoang anh tuan gravatar imagehoang anh tuan ( 2017-04-28 02:42:50 -0600 )edit

your code works as it should be. what it your OpenCV version?

sturkmen gravatar imagesturkmen ( 2017-04-28 03:54:59 -0600 )edit