I wish to process an image (YUV domain) and do basic thresholding for purpose of object detection. I have currently used HSV frames (converted from BGR) to come up with thresholding values which helps me extract the object of interest. However, I would like to make use of YUV frame directly (instead of BGR frames) without any conversion to HSV/BGR to save computation to achieve the same result. Following is the code snippet which I would like to convert to make it work in YUV domain.
Thresholding implemented in HSV domain : currframe(BGR frame)
cvtColor(currFrame, HSVThreshImage, CV_BGR2HSV ,0); Scalar threshmin = Scalar(13, 0, 114); Scalar threshmax = Scalar(128, 255, 255); inRange(HSVThreshImage , threshmin, threshmax, HSVThreshImage);
I am able to get the object region using this code snippet.Kindly guide me to somehow achieve the same result as I am getting using this snippet but in YUV domain. Is there a way to directly convert thresholding and obtain values in YUV domain. Please help me out. Once I get the implementation I would like to apply it for YUV420p image format