Skip to content

Commit afb78a6

Browse files
committed
day5: optim. itseez-academy#1
1 parent cae83a3 commit afb78a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/convertcolor.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ void ConvertColor_BGR2GRAY_BT709_fpt(const cv::Mat& src, cv::Mat& dst)
6767

6868
for (int x = 0; x < sz.width; x++)
6969
{
70-
float color = 0.2126 * psrc[x][2-bidx] + 0.7152 * psrc[x][1] + 0.0722 * psrc[x][bidx];
71-
pdst[x] = (int)(color + 0.5);
70+
short int color = (2126 * psrc[x][2-bidx] + 7152 * psrc[x][1] + 722 * psrc[x][bidx] +5000)/10000;
71+
72+
pdst[x] = (int)(color);
7273
}
7374
}
7475
}

0 commit comments

Comments
 (0)