[Solved] conversion of matlab code to opencv code

[ad_1]

There are many ways to do this. Most clean way would be setting ROI (Region of Interest) and then applying matrix operations. Something like:

subtract(x(Rect(1,0,NumCols-1,NumRows)),x(Rect(0,0,NumCols-1,NumRows),R)
singleLineMask = Mat(1,NumCols,CV_8U)
for (int i=1;i<NumCols;i++)
    singleLineMask.at<int>(1,i)=1;
repeat(singleLineMask,NumRows,1,MaskImage)
d=mean(R,MaskImage)
a=(8*mean(abs(R))-d)/7

assuming you create R and compute NumRows,NumCols prior to this operation and allocate MaskImage.

4

[ad_2]

solved conversion of matlab code to opencv code