colored image to greyscale image using CUDA parallel processing

前端 未结 12 1236
失恋的感觉
失恋的感觉 2021-02-04 19:10

I am trying to solve a problem in which i am supposed to change a colour image to a greyscale image. For this purpose i am using CUDA parallel approach.

The kerne code i

12条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 20:13

    You still should have a problem with run time - the conversion will not give a proper result.

    The lines:

    1. uchar4 rgba = rgbaImage[absolute_image_position_x + absolute_image_position_y];
    2. greyImage[absolute_image_position_x + absolute_image_position_y] = channelSum;

    should be changed to:

    1. uchar4 rgba = rgbaImage[absolute_image_position_x + absolute_image_position_y*numCols];
    2. greyImage[absolute_image_position_x + absolute_image_position_y*numCols] = channelSum;

提交回复
热议问题