// load image Mat img = new Mat("path/to/image.jpg", ImreadModes.Color); // obtain individual channels of the image Mat[] channels = Cv2.Split(img); // access the Red channel Mat redChannel = channels[0]; // access the Green channel Mat greenChannel = channels[1]; // access the Blue channel Mat blueChannel = channels[2];
// load image Mat img = CvInvoke.Imread("path/to/image.jpg", ImreadModes.Color); // convert image to HSV color space Mat hsvImg = new Mat(); CvInvoke.CvtColor(img, hsvImg, ColorConversion.Bgr2Hsv); // obtain individual channels of the image Mat[] channels = hsvImg.Split(); // access the Hue channel Mat hueChannel = channels[0]; // access the Saturation channel Mat satChannel = channels[1]; // access the Value channel Mat valChannel = channels[2];In both examples, the package libraries used were OpenCVSharp and Emgu CV, respectively. These libraries are widely used in computer vision and image processing tasks in CSharp.