Skip to content

Instantly share code, notes, and snippets.

@cannium
cannium / aes-256-gcm.go
Last active May 9, 2021 20:19
golang aes-256-gcm
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)
@wyudong
wyudong / rgb2cmyk.cpp
Last active January 23, 2024 14:35
OpenCV: From RGB to CMYK
// RGB to CMYK conversion
void rgb2cmyk(cv::Mat& img, std::vector<cv::Mat>& cmyk) {
// Allocate cmyk to store 4 componets
for (int i = 0; i < 4; i++) {
cmyk.push_back(cv::Mat(img.size(), CV_8UC1));
}
// Get rgb
std::vector<cv::Mat> rgb;
cv::split(img, rgb);