//图像显示privatestaticvoidshowImg(string w_name,Mat img,int flg=0){
Cv2.NamedWindow(w_name,0);
Cv2.ImShow(w_name, img);
Cv2.WaitKey(flg);}privatestaticvoidSubMat(){var src = Cv2.ImRead("./images/Lenna.png");if(src.Empty()){
Console.WriteLine("请检查图像输入!\n");}else{
Console.WriteLine("读取图像大小:["+ src.Rows +","+ src.Cols +"]");}showImg("src", src);// Assign small image to matvar small =newMat();
Cv2.Resize(src, small,newSize(100,100));
src[10,110,10,110]= small;showImg("src1", src);
src[370,470,400,500]= small.T();showImg("src2", src);// ↑ This is same as the following://small.T().CopyTo(src[370, 470, 400, 500]);// Get partial mat (similar to cvSetImageROI)Mat part = src[200,400,200,360];// Invert partial pixel values
Cv2.BitwiseNot(part, part);// Fill the region (50..100, 100..150) with color (128, 0, 0)
part = src.SubMat(50,100,400,450);
part.SetTo(128);using(newWindow("SubMat", src)){
Cv2.WaitKey();}
part.Dispose();}
histogram函数重要参数详解
def histogram(a, bins10, rangeNone, normedNone, weightsNone, densityNone):...位置参数a: The histogram is computed over the flattened array.(源码对参数a的解释) 从源码对参数a的解释来看,参…