//图像显示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 valuesCv2.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();}
代码和效果图
先上能够正常显示页码页脚的Python代码和效果图,之后再解释原理和思路
from docx import Document
from docx.shared import Pt
from docx.oxml import OxmlElement
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.oxml.ns import qn…