opencv - Printing the pixel values of YUV image -


when convert image yuv rgb cant value of y when try printing pixels. value 377 , when cast integer 255. presume incorrect. there better way or rather correct way print values of yuv image pixels.

actually priting values (int)src.at<vec3b>(j,i).val[0]= 255 , src.at<vec3b>(j,i).val[0] = 377

also on note, y combination of rgb calculated constants according note. confused how value of y.

this problem of opencv. opencv not gracefully handle (scale) yuv or hsv color spaces uchar format. vec3b have 3-channel uchar, , ranges [0;255].

the solution use matrix type. cv::mat3f have 3-channel floating point image. values correctly converted cvtcolor function. can mat3f mat3b assignment.

another solution uses less memory may mat3s , mat3w types, if supported cvtcolor.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -