Lines Matching refs:yuv
7 #undef YUV
9 typedef Vec3b YUV;
23 virtual YUV read(const Mat& yuv, int row, int col) = 0;
74 virtual void write(Mat& yuv, int row, int col, const YUV& val) = 0;
135 void write(Mat& yuv, int row, int col, const YUV& val)
137 int h = yuv.rows * 2 / 3;
139 yuv.ptr<uchar>(row)[col] = val[0];
142 yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)] = val[2];
143 yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)] = val[1];
150 void write(Mat& yuv, int row, int col, const YUV& val)
152 int h = yuv.rows * 2 / 3;
154 yuv.ptr<uchar>(row)[col] = val[0];
157 yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)] = val[1];
158 yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)] = val[2];
178 YUV read(const Mat& yuv, int row, int col)
180 uchar y = yuv.ptr<uchar>(row)[col];
181 uchar u = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2 + 1];
182 uchar v = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2];
184 return YUV(y, u, v);
191 YUV read(const Mat& yuv, int row, int col)
193 uchar y = yuv.ptr<uchar>(row)[col];
194 uchar u = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2];
195 uchar v = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2 + 1];
197 return YUV(y, u, v);
203 YUV read(const Mat& yuv, int row, int col)
205 int h = yuv.rows * 2 / 3;
206 uchar y = yuv.ptr<uchar>(row)[col];
207 uchar u = yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)];
208 uchar v = yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)];
210 return YUV(y, u, v);
216 YUV read(const Mat& yuv, int row, int col)
218 int h = yuv.rows * 2 / 3;
219 uchar y = yuv.ptr<uchar>(row)[col];
220 uchar u = yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)];
221 uchar v = yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)];
223 return YUV(y, u, v);
229 YUV read(const Mat& yuv, int row, int col)
231 uchar y = yuv.ptr<Vec2b>(row)[col][1];
232 uchar u = yuv.ptr<Vec2b>(row)[(col/2)*2][0];
233 uchar v = yuv.ptr<Vec2b>(row)[(col/2)*2 + 1][0];
235 return YUV(y, u, v);
241 YUV read(const Mat& yuv, int row, int col)
243 uchar y = yuv.ptr<Vec2b>(row)[col][0];
244 uchar u = yuv.ptr<Vec2b>(row)[(col/2)*2][1];
245 uchar v = yuv.ptr<Vec2b>(row)[(col/2)*2 + 1][1];
247 return YUV(y, u, v);
253 YUV read(const Mat& yuv, int row, int col)
255 uchar y = yuv.ptr<Vec2b>(row)[col][0];
256 uchar u = yuv.ptr<Vec2b>(row)[(col/2)*2 + 1][1];
257 uchar v = yuv.ptr<Vec2b>(row)[(col/2)*2][1];
259 return YUV(y, u, v);
265 YUV read(const Mat& yuv, int row, int col)
267 return yuv.at<YUV>(row, col);
322 RGB convert(YUV yuv)
324 int y = std::max(0, yuv[0] - 16);
325 int u = yuv[1] - 128;
326 int v = yuv[2] - 128;
338 uchar convert(YUV yuv)
340 return yuv[0];
347 YUV convert(RGB rgb)
357 return YUV(y, u, v);
520 void referenceYUV2RGB(const Mat& yuv, Mat& rgb, YUVreader* yuvReader, RGBwriter* rgbWriter)
526 rgbWriter->write(rgb, row, col, cvt.convert(yuvReader->read(yuv, row, col)));
530 void referenceYUV2GRAY(const Mat& yuv, Mat& rgb, YUVreader* yuvReader, GRAYwriter* grayWriter)
536 grayWriter->write(rgb, row, col, cvt.convert(yuvReader->read(yuv, row, col)));
540 void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter* yuvWriter)
546 yuvWriter->write(yuv, row, col, cvt.convert(rgbReader->read(rgb, row, col)));