2020
09-24
09-24
python图片剪裁代码(图片按四个点坐标剪裁)
用了两种方法保存图片,opencv和Image,实践证明opencv非常快fromPILimportImageimportosimportcv2importtimeimportmatplotlib.pyplotaspltdeflabel2picture(cropImg,framenum,tracker):pathnew="E:\\img2\\"#cv2.imshow("image",cropImg)#cv2.waitKey(1)if(os.path.exists(pathnew+tracker)):cv2.imwrite(pathnew+tracker+'\\'+framenum+'.jpg',cropImg,[int(cv2.IMWRITE_JPEG_QUALITY),100])...
继续阅读 >