I want to average pixel color between two similar pixels. White pixels between black pixels should become black and vice versa. This rule must apply in all directions. This is the complete example of what should happen:
Horizontal:
□■□ -> □□□
Vertical:
□ -> □
■ -> □
□ -> □
■□■ -> ■■■
■ -> ■
□ -> ■
■ -> ■
□■□ -> □□□ -> □□□
■■■ -> ■■■ -> ■□■
■□■ -> ■□■ -> ■□■
Can OpenCV do this? Can anyone make algorighm like this? This is what I tried:
while(i<image->width){
while(j<image->height){
if(pixel[i,j-1] == pixel[i,j+1]){
pixel[i,j] = pixel[i,j-1];
}else if(pixel[i-1,j] == pixel[i+1,j]){
pixel[i,j] = pixel[i-1,j];
}
j++;
}
i++;
}