Skip to content

Instantly share code, notes, and snippets.

@berak
Created October 21, 2019 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berak/912668a2dda3834e8e16297541d9f970 to your computer and use it in GitHub Desktop.
Save berak/912668a2dda3834e8e16297541d9f970 to your computer and use it in GitHub Desktop.
cv::Mat divide problem
Mat m1(3,3,CV_32FC3,Scalar(3,2,1));
Mat m2;
cout << m1 << endl << m2 << endl;
Mat n = m1/m2;
cout << n << endl;
divide(1,m1,n);
cout << n << endl;
[3, 2, 1, 3, 2, 1, 3, 2, 1;
3, 2, 1, 3, 2, 1, 3, 2, 1;
3, 2, 1, 3, 2, 1, 3, 2, 1]
[]
[0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1;
0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1;
0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1]
[0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1;
0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1;
0.33333334, 0.5, 1, 0.33333334, 0.5, 1, 0.33333334, 0.5, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment