从输入图像中获取RGB像素,并在opencv中重建输出图像
问题描述:
我想在opencv中加载图像并将图像分割成通道(RGB),我想增加任何一种颜色并获得相应的输出图像。是否有最简单的方法来解决这个问题?
I want to load the image in opencv and split the image into channels(RGB) and i want to increase any one of the colors and getting that corresponding output image.is there any easiest way to do this problem?
答
@karlphillip:通常是RGB图像的更好解决方案 - 处理行尾的任何填充,也可以与OMP很好地并行化!
@karlphillip: Generally a better solution for RGB images - handles any padding at row ends, also parallelizes nicely with OMP !
for (int i=0; i < height;i++)
{
unsigned char *pRow = pRGBImg->ptr(i);
for (int j=0; j < width;j+=bpp)
// For educational puporses, here is how to print each R G B channel:
std::cout << std::dec << "R:" << (int) pRow->imageData[j] <<
" G:" << (int) pRow->imageData[j+1] <<
" B:" << (int) pRow->imageData[j+2] << " ";
}
}