Bilateral filter
Implementation
void cv_apply_bilateral_filter(Image* img, float sigma, int kernSize) {
/* ... */
unsigned char* tempBytes = (unsigned char*)malloc(width * height * ch * sizeof(unsigned char));
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
unsigned char R = compute_bilateral_filter_for_channel(img, sigma, kernSize, j, i, 0);
unsigned char G = compute_bilateral_filter_for_channel(img, sigma, kernSize, j, i, 1);
unsigned char B = compute_bilateral_filter_for_channel(img, sigma, kernSize, j, i, 2);
tempBytes[(i * width + j) * ch + 0] = R;
tempBytes[(i * width + j) * ch + 1] = G;
tempBytes[(i * width + j) * ch + 2] = B;
}
}
/* ... */
}
Result


Last updated