- contourArea因为以边缘像素中心为边长计算,所以面积会小于实际面积
- opencv python:https://docs.opencv.org/4.x/d3/d05/tutorial_py_table_of_contents_contours.html
- C++:https://docs.opencv.org/4.x/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0
# coding=utf8
import cv2
import numpy as np
im=cv2.imread("lwd.jpg")
h,w,c=im.shape
# 全0图
raw=np.zeros((h,w,c))
# 把矩形框对应的图像复制到全0图,coco格式
for line in open("lwd.txt"):
sp=line.split()
x = int