Difference between uint8 and logical

3 次查看(过去 30 天)
1. Does matlab only make caculations with logical numbers?
2. Sometimes two matrices are in different format, such as one is logical and the other is uint8, shall we transfer the uint8 one into logical one?
3. Even if both matrices are uint8, when making caculations, does matlab still transfer them into logical ones then transfer the result back to uint8 one?

采纳的回答

Walter Roberson
Walter Roberson 2012-6-16
MATLAB does not make calculations with logical numbers, except for logical tests. When a logical matrix is used in an arithmetic calculation with a numeric matrix, the logical matrix is treated as numeric.
Please put in a breakpoint in your code at the step before "f = uint8(f)" and examine the range of values in the original "f" matrix. The uint8() type conversion rounds values, so if all entries in the original "f" matrix are less than 1/2 then the result would be all 0's.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by