opencv multi channel element access

前端 未结 5 1883
长情又很酷
长情又很酷 2020-11-28 03:08

I\'m trying to learn how to use openCV\'s new c++ interface.

How do I access elements of a multi channel matrix. for example:

Mat myMat(size(3, 3), C         


        
5条回答
  •  醉酒成梦
    2020-11-28 03:31

    You can access the underlying data array directly:

    Mat myMat(size(3, 3), CV_32FC2);
    
    myMat.ptr(y)[2*x]; // first channel
    myMat.ptr(y)[2*x+1]; // second channel
    

提交回复
热议问题