Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual c++ 如果使用minMaxLoc函数,如何替换像素值_Visual C++_Opencv_Artificial Intelligence_Neural Network_Backpropagation - Fatal编程技术网

Visual c++ 如果使用minMaxLoc函数,如何替换像素值

Visual c++ 如果使用minMaxLoc函数,如何替换像素值,visual-c++,opencv,artificial-intelligence,neural-network,backpropagation,Visual C++,Opencv,Artificial Intelligence,Neural Network,Backpropagation,我试图从图像中选择一个3x3不重叠的感兴趣区域,然后选择该3x3的最大值,然后对其进行处理。现在处理后,我想将新处理的值保存在原始图像像素位置,从该位置选择最大值,而不是在3x3的ROI区域。我正在努力,但做不好。minMaxLoc给出最大值位置,但该位置在3x3区域,而不是原始图像中,任何主体都可以提供帮助。我会很感激的 int totalRowsMAx = totalRows-receptiveField+1; for(int rowsInd=0;rowsInd<totalRowsMA

我试图从图像中选择一个3x3不重叠的感兴趣区域,然后选择该3x3的最大值,然后对其进行处理。现在处理后,我想将新处理的值保存在原始图像像素位置,从该位置选择最大值,而不是在3x3的ROI区域。我正在努力,但做不好。minMaxLoc给出最大值位置,但该位置在3x3区域,而不是原始图像中,任何主体都可以提供帮助。我会很感激的

int totalRowsMAx = totalRows-receptiveField+1;
for(int rowsInd=0;rowsInd<totalRowsMAx;rowsInd+=receptiveField){
int jj=0;
int totalColsMAx = totalCols-receptiveField+1;
for(int colsInd=0;colsInd<totalColsMAx;colsInd+=receptiveField){                       
    Mat imgROI1 = img1(cv::Rect(colsInd,rowsInd,receptiveField,receptiveField));
        if(maxpooling==true){
          minMaxLoc( imgROI1, &minVal, &maxVal, &minLoc, &maxLoc );
          cout<<"maxVa adress with and sign "<<&maxLoc<<endl;
          cout<<"maxValue in ROI"<<imgROI1.at<double>(maxLoc)<<endl;
          cout<<"maxValue address without and sign"<<maxLoc<<endl;
          cout<<"maxValue in full image "<<img1.at<double>(maxLoc)<<endl;    }   }  }
int totalRowsMAx=totalRows接收字段+1;

对于(int rowsInd=0;rowsInd您正在使用ROI来选择3X3区域,那么为什么不使用相同的ROI来设置像素呢

比如说

Mat src;//source image
Rect R(x,y,W,H); //ROI rect
Mat ROI=src(R);

getminmaxonROI() //get your minmax
假设你有极小极大的位置,比如ROI_X和ROI_Y,在你的源图像中

SRC_X=ROI_X+R.x;
SRC_Y=ROI_Y+R.y;

我尝试了相同的ROI_X+R.X,我的意思是rowsInd+X和colsInd+y,但仍然给出了errorcv::Rect(colsInd,rowsInd,receptiveField,receptiveField));我们必须先给出x或y?我的意思是rowsInd或colInd?在Mat cols中,总是在x方向,而行总是在y方向。