mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Author: Steve Nicholson
|
||||
*
|
||||
* A program that illustrates intersectConvexConvex in various scenarios
|
||||
*/
|
||||
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
// Create a vector of points describing a rectangle with the given corners
|
||||
static vector<Point> makeRectangle(Point topLeft, Point bottomRight)
|
||||
{
|
||||
vector<Point> rectangle;
|
||||
rectangle.push_back(topLeft);
|
||||
rectangle.push_back(Point(bottomRight.x, topLeft.y));
|
||||
rectangle.push_back(bottomRight);
|
||||
rectangle.push_back(Point(topLeft.x, bottomRight.y));
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
static vector<Point> makeTriangle(Point point1, Point point2, Point point3)
|
||||
{
|
||||
vector<Point> triangle;
|
||||
triangle.push_back(point1);
|
||||
triangle.push_back(point2);
|
||||
triangle.push_back(point3);
|
||||
return triangle;
|
||||
}
|
||||
|
||||
// Run intersectConvexConvex on two polygons then draw the polygons and their intersection (if there is one)
|
||||
// Return the area of the intersection
|
||||
static float drawIntersection(Mat &image, vector<Point> polygon1, vector<Point> polygon2, bool handleNested = true)
|
||||
{
|
||||
vector<Point> intersectionPolygon;
|
||||
|
||||
vector<vector<Point> > polygons;
|
||||
polygons.push_back(polygon1);
|
||||
polygons.push_back(polygon2);
|
||||
|
||||
float intersectArea = intersectConvexConvex(polygon1, polygon2, intersectionPolygon, handleNested);
|
||||
|
||||
if (intersectArea > 0)
|
||||
{
|
||||
Scalar fillColor(200, 200, 200);
|
||||
// If the input is invalid, draw the intersection in red
|
||||
if (!isContourConvex(polygon1) || !isContourConvex(polygon2))
|
||||
{
|
||||
fillColor = Scalar(0, 0, 255);
|
||||
}
|
||||
vector<vector<Point> > pp;
|
||||
pp.push_back(intersectionPolygon);
|
||||
fillPoly(image, pp, fillColor);
|
||||
}
|
||||
polylines(image, polygons, true, Scalar(0, 0, 0));
|
||||
|
||||
return intersectArea;
|
||||
}
|
||||
|
||||
static void drawDescription(Mat &image, int intersectionArea, string description, Point origin)
|
||||
{
|
||||
const size_t bufSize=1024;
|
||||
char caption[bufSize];
|
||||
snprintf(caption, bufSize, "Intersection area: %d%s", intersectionArea, description.c_str());
|
||||
putText(image, caption, origin, FONT_HERSHEY_SIMPLEX, 0.6, Scalar(0, 0, 0));
|
||||
}
|
||||
|
||||
static void intersectConvexExample()
|
||||
{
|
||||
Mat image(610, 550, CV_8UC3, Scalar(255, 255, 255));
|
||||
float intersectionArea;
|
||||
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 10), Point(50, 50)),
|
||||
makeRectangle(Point(20, 20), Point(60, 60)));
|
||||
|
||||
drawDescription(image, (int)intersectionArea, "", Point(70, 40));
|
||||
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 70), Point(35, 95)),
|
||||
makeRectangle(Point(35, 95), Point(60, 120)));
|
||||
|
||||
drawDescription(image, (int)intersectionArea, "", Point(70, 100));
|
||||
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 130), Point(60, 180)),
|
||||
makeRectangle(Point(20, 140), Point(50, 170)),
|
||||
true);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (handleNested true)", Point(70, 160));
|
||||
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 190), Point(60, 240)),
|
||||
makeRectangle(Point(20, 200), Point(50, 230)),
|
||||
false);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (handleNested false)", Point(70, 220));
|
||||
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 250), Point(60, 300)),
|
||||
makeRectangle(Point(20, 250), Point(50, 290)),
|
||||
true);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (handleNested true)", Point(70, 280));
|
||||
|
||||
// These rectangles share an edge so handleNested can be false and an intersection is still found
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 310), Point(60, 360)),
|
||||
makeRectangle(Point(20, 310), Point(50, 350)),
|
||||
false);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (handleNested false)", Point(70, 340));
|
||||
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 370), Point(60, 420)),
|
||||
makeRectangle(Point(20, 371), Point(50, 410)),
|
||||
false);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (handleNested false)", Point(70, 400));
|
||||
|
||||
// A vertex of the triangle lies on an edge of the rectangle so handleNested can be false and an intersection is still found
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 430), Point(60, 480)),
|
||||
makeTriangle(Point(35, 430), Point(20, 470), Point(50, 470)),
|
||||
false);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (handleNested false)", Point(70, 460));
|
||||
|
||||
// Show intersection of overlapping rectangle and triangle
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 490), Point(40, 540)),
|
||||
makeTriangle(Point(25, 500), Point(25, 530), Point(60, 515)),
|
||||
false);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, "", Point(70, 520));
|
||||
|
||||
// This concave polygon is invalid input to intersectConvexConvex so it returns an invalid intersection
|
||||
vector<Point> notConvex;
|
||||
notConvex.push_back(Point(25, 560));
|
||||
notConvex.push_back(Point(25, 590));
|
||||
notConvex.push_back(Point(45, 580));
|
||||
notConvex.push_back(Point(60, 600));
|
||||
notConvex.push_back(Point(60, 550));
|
||||
notConvex.push_back(Point(45, 570));
|
||||
intersectionArea = drawIntersection(image,
|
||||
makeRectangle(Point(10, 550), Point(50, 600)),
|
||||
notConvex,
|
||||
false);
|
||||
|
||||
drawDescription(image, (int)intersectionArea, " (invalid input: not convex)", Point(70, 580));
|
||||
|
||||
imshow("Intersections", image);
|
||||
waitKey(0);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
intersectConvexExample();
|
||||
}
|
||||
@@ -116,8 +116,10 @@ double compose_megapix = -1;
|
||||
float conf_thresh = 1.f;
|
||||
#ifdef HAVE_OPENCV_XFEATURES2D
|
||||
string features_type = "surf";
|
||||
float match_conf = 0.65f;
|
||||
#else
|
||||
string features_type = "orb";
|
||||
float match_conf = 0.3f;
|
||||
#endif
|
||||
string matcher_type = "homography";
|
||||
string estimator_type = "homography";
|
||||
@@ -132,7 +134,6 @@ int expos_comp_type = ExposureCompensator::GAIN_BLOCKS;
|
||||
int expos_comp_nr_feeds = 1;
|
||||
int expos_comp_nr_filtering = 2;
|
||||
int expos_comp_block_size = 32;
|
||||
float match_conf = 0.3f;
|
||||
string seam_find_type = "gc_color";
|
||||
int blend_type = Blender::MULTI_BAND;
|
||||
int timelapse_type = Timelapser::AS_IS;
|
||||
@@ -196,7 +197,7 @@ static int parseCmdArgs(int argc, char** argv)
|
||||
else if (string(argv[i]) == "--features")
|
||||
{
|
||||
features_type = argv[i + 1];
|
||||
if (features_type == "orb")
|
||||
if (string(features_type) == "orb")
|
||||
match_conf = 0.3f;
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ using namespace cv;
|
||||
|
||||
const char* keys =
|
||||
"{ help h| | Print help message. }"
|
||||
"{ input1 | | Path to input image 1. }"
|
||||
"{ input2 | | Path to input image 2. }"
|
||||
"{ input3 | | Path to input image 3. }";
|
||||
"{ @input1 | | Path to input image 1. }"
|
||||
"{ @input2 | | Path to input image 2. }"
|
||||
"{ @input3 | | Path to input image 3. }";
|
||||
|
||||
/**
|
||||
* @function main
|
||||
|
||||
@@ -14,7 +14,7 @@ parser.add_argument('--median_filter', default=0, type=int, help='Kernel size of
|
||||
args = parser.parse_args()
|
||||
|
||||
net = cv.dnn.readNetFromTorch(cv.samples.findFile(args.model))
|
||||
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV);
|
||||
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
|
||||
|
||||
if args.input:
|
||||
cap = cv.VideoCapture(args.input)
|
||||
|
||||
@@ -27,7 +27,7 @@ args = parser.parse_args()
|
||||
|
||||
### Get OpenCV predictions #####################################################
|
||||
net = cv.dnn.readNetFromTensorflow(cv.samples.findFile(args.weights), cv.samples.findFile(args.prototxt))
|
||||
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV);
|
||||
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
|
||||
|
||||
detections = []
|
||||
for imgName in os.listdir(args.images):
|
||||
|
||||
@@ -134,7 +134,7 @@ def main():
|
||||
for j in range(4):
|
||||
p1 = (vertices[j][0], vertices[j][1])
|
||||
p2 = (vertices[(j + 1) % 4][0], vertices[(j + 1) % 4][1])
|
||||
cv.line(frame, p1, p2, (0, 255, 0), 1);
|
||||
cv.line(frame, p1, p2, (0, 255, 0), 1)
|
||||
|
||||
# Put efficiency information
|
||||
cv.putText(frame, label, (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0))
|
||||
|
||||
@@ -21,7 +21,7 @@ def tokenize(s):
|
||||
elif token:
|
||||
tokens.append(token)
|
||||
token = ""
|
||||
isString = (symbol == '\"' or symbol == '\'') ^ isString;
|
||||
isString = (symbol == '\"' or symbol == '\'') ^ isString
|
||||
|
||||
elif symbol == '{' or symbol == '}' or symbol == '[' or symbol == ']':
|
||||
if token:
|
||||
|
||||
@@ -122,7 +122,7 @@ def createSSDGraph(modelPath, configPath, outputPath):
|
||||
print('Input image size: %dx%d' % (image_width, image_height))
|
||||
|
||||
# Read the graph.
|
||||
inpNames = ['image_tensor']
|
||||
_inpNames = ['image_tensor']
|
||||
outNames = ['num_detections', 'detection_scores', 'detection_boxes', 'detection_classes']
|
||||
|
||||
writeTextGraph(modelPath, outputPath, outNames)
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
|
||||
|
||||
small = img
|
||||
for i in xrange(3):
|
||||
for _i in xrange(3):
|
||||
small = cv.pyrDown(small)
|
||||
|
||||
def onmouse(event, x, y, flags, param):
|
||||
|
||||
@@ -97,7 +97,7 @@ def main():
|
||||
obj_points.append(pattern_points)
|
||||
|
||||
# calculate camera distortion
|
||||
rms, camera_matrix, dist_coefs, rvecs, tvecs = cv.calibrateCamera(obj_points, img_points, (w, h), None, None)
|
||||
rms, camera_matrix, dist_coefs, _rvecs, _tvecs = cv.calibrateCamera(obj_points, img_points, (w, h), None, None)
|
||||
|
||||
print("\nRMS:", rms)
|
||||
print("camera matrix:\n", camera_matrix)
|
||||
@@ -106,7 +106,7 @@ def main():
|
||||
# undistort the image with the calibration
|
||||
print('')
|
||||
for fn in img_names if debug_dir else []:
|
||||
path, name, ext = splitfn(fn)
|
||||
_path, name, _ext = splitfn(fn)
|
||||
img_found = os.path.join(debug_dir, name + '_chess.png')
|
||||
outfile = os.path.join(debug_dir, name + '_undistorted.png')
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ def main():
|
||||
extrinsics = fs.getNode('extrinsic_parameters').mat()
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
from mpl_toolkits.mplot3d import Axes3D # pylint: disable=unused-variable
|
||||
|
||||
fig = plt.figure()
|
||||
ax = fig.gca(projection='3d')
|
||||
|
||||
@@ -46,7 +46,7 @@ class App():
|
||||
cam = video.create_capture(fn, fallback='synth:bg=baboon.jpg:class=chess:noise=0.05')
|
||||
|
||||
while True:
|
||||
flag, frame = cam.read()
|
||||
_flag, frame = cam.read()
|
||||
cv.imshow('camera', frame)
|
||||
|
||||
small = cv.pyrDown(frame)
|
||||
|
||||
@@ -38,7 +38,7 @@ def main():
|
||||
|
||||
cap = video.create_capture(fn)
|
||||
while True:
|
||||
flag, img = cap.read()
|
||||
_flag, img = cap.read()
|
||||
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
|
||||
thrs1 = cv.getTrackbarPos('thrs1', 'edge')
|
||||
thrs2 = cv.getTrackbarPos('thrs2', 'edge')
|
||||
|
||||
@@ -48,7 +48,7 @@ def main():
|
||||
cam = create_capture(video_src, fallback='synth:bg={}:noise=0.05'.format(cv.samples.findFile('samples/data/lena.jpg')))
|
||||
|
||||
while True:
|
||||
ret, img = cam.read()
|
||||
_ret, img = cam.read()
|
||||
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
|
||||
gray = cv.equalizeHist(gray)
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ def main():
|
||||
update()
|
||||
ch = cv.waitKey(0)
|
||||
if ch == ord('f'):
|
||||
global cur_func_name
|
||||
if PY3:
|
||||
cur_func_name = next(dist_func_names)
|
||||
else:
|
||||
|
||||
@@ -30,7 +30,7 @@ def main():
|
||||
circles = cv.HoughCircles(img, cv.HOUGH_GRADIENT, 1, 10, np.array([]), 100, 30, 1, 30)
|
||||
|
||||
if circles is not None: # Check if circles have been found and only then iterate over these and add them to the image
|
||||
a, b, c = circles.shape
|
||||
_a, b, _c = circles.shape
|
||||
for i in range(b):
|
||||
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv.LINE_AA)
|
||||
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv.LINE_AA) # draw center of circle
|
||||
|
||||
@@ -29,14 +29,14 @@ def main():
|
||||
|
||||
if True: # HoughLinesP
|
||||
lines = cv.HoughLinesP(dst, 1, math.pi/180.0, 40, np.array([]), 50, 10)
|
||||
a,b,c = lines.shape
|
||||
a, b, _c = lines.shape
|
||||
for i in range(a):
|
||||
cv.line(cdst, (lines[i][0][0], lines[i][0][1]), (lines[i][0][2], lines[i][0][3]), (0, 0, 255), 3, cv.LINE_AA)
|
||||
|
||||
else: # HoughLines
|
||||
lines = cv.HoughLines(dst, 1, math.pi/180.0, 50, np.array([]), 0, 0)
|
||||
if lines is not None:
|
||||
a,b,c = lines.shape
|
||||
a, b, _c = lines.shape
|
||||
for i in range(a):
|
||||
rho = lines[i][0][0]
|
||||
theta = lines[i][0][1]
|
||||
|
||||
@@ -33,7 +33,7 @@ def main():
|
||||
points, _ = make_gaussians(cluster_n, img_size)
|
||||
|
||||
term_crit = (cv.TERM_CRITERIA_EPS, 30, 0.1)
|
||||
ret, labels, centers = cv.kmeans(points, cluster_n, None, term_crit, 10, 0)
|
||||
_ret, labels, _centers = cv.kmeans(points, cluster_n, None, term_crit, 10, 0)
|
||||
|
||||
img = np.zeros((img_size, img_size, 3), np.uint8)
|
||||
for (x, y), label in zip(np.int32(points), labels.ravel()):
|
||||
|
||||
@@ -60,7 +60,7 @@ def main():
|
||||
cv.createTrackbar('%d'%i, 'level control', 5, 50, nothing)
|
||||
|
||||
while True:
|
||||
ret, frame = cap.read()
|
||||
_ret, frame = cap.read()
|
||||
|
||||
pyr = build_lappyr(frame, leveln)
|
||||
for i in xrange(leveln):
|
||||
|
||||
@@ -64,14 +64,14 @@ def main():
|
||||
fn = 0
|
||||
|
||||
cam = video.create_capture(fn)
|
||||
ret, prev = cam.read()
|
||||
_ret, prev = cam.read()
|
||||
prevgray = cv.cvtColor(prev, cv.COLOR_BGR2GRAY)
|
||||
show_hsv = False
|
||||
show_glitch = False
|
||||
cur_glitch = prev.copy()
|
||||
|
||||
while True:
|
||||
ret, img = cam.read()
|
||||
_ret, img = cam.read()
|
||||
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
|
||||
flow = cv.calcOpticalFlowFarneback(prevgray, gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
|
||||
prevgray = gray
|
||||
|
||||
@@ -51,7 +51,7 @@ def main():
|
||||
print('loading error')
|
||||
continue
|
||||
|
||||
found, w = hog.detectMultiScale(img, winStride=(8,8), padding=(32,32), scale=1.05)
|
||||
found, _w = hog.detectMultiScale(img, winStride=(8,8), padding=(32,32), scale=1.05)
|
||||
found_filtered = []
|
||||
for ri, r in enumerate(found):
|
||||
for qi, q in enumerate(found):
|
||||
|
||||
@@ -69,8 +69,8 @@ def main():
|
||||
out_points = points[mask]
|
||||
out_colors = colors[mask]
|
||||
out_fn = 'out.ply'
|
||||
write_ply('out.ply', out_points, out_colors)
|
||||
print('%s saved' % 'out.ply')
|
||||
write_ply(out_fn, out_points, out_colors)
|
||||
print('%s saved' % out_fn)
|
||||
|
||||
cv.imshow('left', imgL)
|
||||
cv.imshow('disparity', (disp-min_disp)/num_disp)
|
||||
|
||||
@@ -32,7 +32,7 @@ def main():
|
||||
|
||||
w, h = 512, 512
|
||||
|
||||
args, args_list = getopt.getopt(sys.argv[1:], 'o:', [])
|
||||
args, _args_list = getopt.getopt(sys.argv[1:], 'o:', [])
|
||||
args = dict(args)
|
||||
out = None
|
||||
if '-o' in args:
|
||||
|
||||
@@ -25,13 +25,13 @@ def access_pixel():
|
||||
y = 0
|
||||
x = 0
|
||||
## [Pixel access 1]
|
||||
intensity = img[y,x]
|
||||
_intensity = img[y,x]
|
||||
## [Pixel access 1]
|
||||
|
||||
## [Pixel access 3]
|
||||
blue = img[y,x,0]
|
||||
green = img[y,x,1]
|
||||
red = img[y,x,2]
|
||||
_blue = img[y,x,0]
|
||||
_green = img[y,x,1]
|
||||
_red = img[y,x,2]
|
||||
## [Pixel access 3]
|
||||
|
||||
## [Pixel access 5]
|
||||
@@ -42,12 +42,12 @@ def reference_counting():
|
||||
# Memory management and reference counting
|
||||
## [Reference counting 2]
|
||||
img = cv.imread('image.jpg')
|
||||
img1 = np.copy(img)
|
||||
_img1 = np.copy(img)
|
||||
## [Reference counting 2]
|
||||
|
||||
## [Reference counting 3]
|
||||
img = cv.imread('image.jpg')
|
||||
sobelx = cv.Sobel(img, cv.CV_32F, 1, 0);
|
||||
_sobelx = cv.Sobel(img, cv.CV_32F, 1, 0)
|
||||
## [Reference counting 3]
|
||||
|
||||
def primitive_operations():
|
||||
@@ -57,17 +57,17 @@ def primitive_operations():
|
||||
## [Set image to black]
|
||||
|
||||
## [Select ROI]
|
||||
smallImg = img[10:110,10:110]
|
||||
_smallImg = img[10:110,10:110]
|
||||
## [Select ROI]
|
||||
|
||||
## [BGR to Gray]
|
||||
img = cv.imread('image.jpg')
|
||||
grey = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
|
||||
_grey = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
|
||||
## [BGR to Gray]
|
||||
|
||||
src = np.ones((4,4), np.uint8)
|
||||
## [Convert to CV_32F]
|
||||
dst = src.astype(np.float32)
|
||||
_dst = src.astype(np.float32)
|
||||
## [Convert to CV_32F]
|
||||
|
||||
def visualize_images():
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ def gammaCorrection():
|
||||
res = cv.LUT(img_original, lookUpTable)
|
||||
## [changing-contrast-brightness-gamma-correction]
|
||||
|
||||
img_gamma_corrected = cv.hconcat([img_original, res]);
|
||||
cv.imshow("Gamma correction", img_gamma_corrected);
|
||||
img_gamma_corrected = cv.hconcat([img_original, res])
|
||||
cv.imshow("Gamma correction", img_gamma_corrected)
|
||||
|
||||
def on_linear_transform_alpha_trackbar(val):
|
||||
global alpha
|
||||
|
||||
@@ -85,13 +85,13 @@ contours, _ = cv.findContours(bw, cv.RETR_LIST, cv.CHAIN_APPROX_NONE)
|
||||
|
||||
for i, c in enumerate(contours):
|
||||
# Calculate the area of each contour
|
||||
area = cv.contourArea(c);
|
||||
area = cv.contourArea(c)
|
||||
# Ignore contours that are too small or too large
|
||||
if area < 1e2 or 1e5 < area:
|
||||
continue
|
||||
|
||||
# Draw each contour only for visualisation purposes
|
||||
cv.drawContours(src, contours, i, (0, 0, 255), 2);
|
||||
cv.drawContours(src, contours, i, (0, 0, 255), 2)
|
||||
# Find the orientation of each shape
|
||||
getOrientation(c, src)
|
||||
## [contours]
|
||||
|
||||
@@ -70,7 +70,7 @@ def main():
|
||||
draw_str(res, (20, 60), "frame interval : %.1f ms" % (frame_interval.value*1000))
|
||||
cv.imshow('threaded video', res)
|
||||
if len(pending) < threadn:
|
||||
ret, frame = cap.read()
|
||||
_ret, frame = cap.read()
|
||||
t = clock()
|
||||
frame_interval.update(t - last_frame_time)
|
||||
last_frame_time = t
|
||||
|
||||
@@ -42,7 +42,7 @@ def main():
|
||||
cv.createTrackbar("Focus", "Video", focus, 100, lambda v: cap.set(cv.CAP_PROP_FOCUS, v / 100))
|
||||
|
||||
while True:
|
||||
status, img = cap.read()
|
||||
_status, img = cap.read()
|
||||
|
||||
fourcc = decode_fourcc(cap.get(cv.CAP_PROP_FOURCC))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user