cv::convertTo
生活随笔
收集整理的這篇文章主要介紹了
cv::convertTo
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
m – 目標矩陣。如果m在運算前沒有合適的尺寸或類型,將被重新分配。rtype – 目標矩陣的類型。因為目標矩陣的通道數與源矩陣一樣,所以rtype也可以看做是目標矩陣的位深度。如果rtype為負值,目標矩陣和源矩陣將使用同樣的類型。alpha – 尺度變換因子(可選)。beta – 附加到尺度變換后的值上的偏移量(可選)。
-
known conditions
-
source range?and?target range
-
to get source to target scale
-
target type
-
-
then convert
-
cv 8u1 to cv 32f1When you use convertTo from CV_8U1 to CV_32F1, a pixel value, for example, 255 becomes 255.0. But when you try `imshow’ the resulting image, the command expects all pixel values to be between 0.0 and 1.0. that’s why, without rescaling the image, the image will look all white. So this will do the trick as zzz pointed out (thanks).input.convertTo(output, CV_32F, 1.0/255.0)the difference between?CV_8U&CV_32F&CV_32S?,you can see?
-
https://blog.csdn.net/qq_41598072/article/details/90241033
-
https://stackoverflow.com/questions/12837876/opencv-convertto-returns-white-image-sometimes
總結
以上是生活随笔為你收集整理的cv::convertTo的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 直接线性变换(DLT)求解单应性矩阵
- 下一篇: c++11随机数产生器default_r