How to access the elements of single channel IplImage in Opencv

前端 未结 3 1084
無奈伤痛
無奈伤痛 2021-01-20 19:51

How can I access the Elements of an IplImage (single channel and IPL_DEPTH_8U depth).

I want to change the pixel value at a particu

3条回答
  •  悲哀的现实
    2021-01-20 20:31

    The fast way to get the pixel value is use macro.

    CV_IMAGE_ELEM( image_header, elemtype, y, x_Nc ) 
    

    And in your case, the Image is single channel.So you can get the i,j pixel value by

    CV_IMAGE_ELEM(image, unsigned char, i, j)
    

提交回复
热议问题