Cannot Access Mean Values

前端 未结 1 1824
南笙
南笙 2021-01-27 08:01

I have computed mean and standart deviation values of a region in the image. The code:

Mat img=imread(\"a.jpg\");
Mat hsv1;
Mat mean, stdev;
cvtColor(img, hsv1,         


        
1条回答
  •  北恋
    北恋 (楼主)
    2021-01-27 08:17

    The problem here is that you're trying to access a CV_64F Mat using at.

    You can solve this like:

    double Mi = mean.at(0,0);
    

    Or declaring Scalar instead of Mat:

    Scalar mean, stdev;
    cv::meanStdDev(hsv1, mean, stdev, superpixel_mask);
    double Mi = mean[0]; 
    

    0 讨论(0)
提交回复
热议问题