c# - Get maximum HSV values from image in emguCV -
i'm trying maximum values of hue, saturation , value image converted hsv in c# using emgucv. in opencv can use vec3b how can same effect in c#?
i not sure there direct equivalent. if want max of each channel can split hsv mat 3 channels , getrangevalue should return max , min each channel.
mat orig = new mat(@"c:\users\public\pictures\sample pictures\koala.jpg", imreadmodes.color); using (mat hsv = new mat()) { cvinvoke.cvtcolor(orig, hsv, colorconversion.bgr2hsv); mat[] channels = hsv.split(); rangef h = channels[0].getvaluerange(); rangef s = channels[1].getvaluerange(); rangef v = channels[2].getvaluerange(); console.writeline(string.format("max h {0} min h {1}", h.max, h.min)); console.writeline(string.format("max s {0} min s {1}", s.max, s.min)); console.writeline(string.format("max v {0} min v {1}", v.max, v.min)); mcvscalar mean = cvinvoke.mean(hsv); console.writeline(string.format("mean v {0} mean s {1} mean v {2} ", mean.v0, mean.v1, mean.v2)); ; }
doug
Comments
Post a Comment