Ask Your Question
0

HSV thresholding implemented in YUV domain

asked 2017-06-17 04:01:37 -0600

updated 2020-10-10 13:03:06 -0600

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-06-17 04:05:13 -0600

berak gravatar image

you can use inRange() on yuv images, too. it's just a little more complicated, since you have to threshold 2 color channels (UV), not a single one (H).

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-17 04:01:37 -0600

Seen: 342 times

Last updated: Jun 17 '17