Get RGB pixels from input image and reconstruct an output image in opencv

前端 未结 4 2011
灰色年华
灰色年华 2020-12-22 07:04

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 a

4条回答
  •  悲&欢浪女
    2020-12-22 07:20

    @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] << " "; 
        }
    }
    

提交回复
热议问题