This forum is disabled, please visit https://forum.opencv.org

1 | initial version |

Try multiply(M.col(i), 1.0/(sum(M.col(i))(0)), M.col(i));

This takes the column, finds the sum, and multiplies the column by 1/sum. Then use the reduce to check.

2 | No.2 Revision |

Try multiply(M.col(i), 1.0/(sum(M.col(i))(0)), M.col(i));

This takes the column, finds the sum, and multiplies the column by 1/sum. Then use the reduce to check.

If you want to use the normalize function, you need to change the norm type to NORM_L1, and it will do the same thing. Actually, just do this, that's better.

3 | No.3 Revision |

Try multiply(M.col(i), 1.0/(sum(M.col(i))(0)), M.col(i));

This takes the column, finds the sum, and multiplies the column by 1/sum. Then use the reduce to check.

If you want to use the normalize function, you need to change the norm type to NORM_L1, and it will do the same thing. Actually, just do this, that's ~~better.~~better. Here's the documentation on the normalize function so you can see why NORM_L2 wasn't working and why NORM_L1 will.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.