Mat::convertTo() float to uchar broken when all values are negative (Bug #1218)


Added by Josh Klontz over 13 years ago. Updated over 13 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

When all values in a floating point matrix are negative, the resulting uchar matrix is all zero.


History

Updated by Vadim Pisarevsky over 13 years ago

uchar can only represent values from 0 to 255. Negative values are converted to the closest representable value, i.e. 0. Try converting floats to signed char (CV_8S) or use convertScaleAbs().

  • Status changed from Open to Done
  • (deleted custom field) set to invalid

Also available in: Atom PDF