Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2019-06-07 19:02:55 +03:00
43 changed files with 446 additions and 112 deletions

View File

@@ -8,8 +8,8 @@ def my_ellipse(img, angle):
line_type = 8
cv.ellipse(img,
(W / 2, W / 2),
(W / 4, W / 16),
(W // 2, W // 2),
(W // 4, W // 16),
angle,
0,
360,
@@ -24,7 +24,7 @@ def my_filled_circle(img, center):
cv.circle(img,
center,
W / 32,
W // 32,
(0, 0, 255),
thickness,
line_type)
@@ -82,7 +82,7 @@ my_ellipse(atom_image, 45)
my_ellipse(atom_image, -45)
# 1.b. Creating circles
my_filled_circle(atom_image, (W / 2, W / 2))
my_filled_circle(atom_image, (W // 2, W // 2))
## [draw_atom]
## [draw_rook]
@@ -93,7 +93,7 @@ my_polygon(rook_image)
## [rectangle]
# 2.b. Creating rectangles
cv.rectangle(rook_image,
(0, 7 * W / 8),
(0, 7 * W // 8),
(W, W),
(0, 255, 255),
-1,
@@ -101,10 +101,10 @@ cv.rectangle(rook_image,
## [rectangle]
# 2.c. Create a few lines
my_line(rook_image, (0, 15 * W / 16), (W, 15 * W / 16))
my_line(rook_image, (W / 4, 7 * W / 8), (W / 4, W))
my_line(rook_image, (W / 2, 7 * W / 8), (W / 2, W))
my_line(rook_image, (3 * W / 4, 7 * W / 8), (3 * W / 4, W))
my_line(rook_image, (0, 15 * W // 16), (W, 15 * W // 16))
my_line(rook_image, (W // 4, 7 * W // 8), (W // 4, W))
my_line(rook_image, (W // 2, 7 * W // 8), (W // 2, W))
my_line(rook_image, (3 * W // 4, 7 * W // 8), (3 * W // 4, W))
## [draw_rook]
cv.imshow(atom_window, atom_image)
cv.moveWindow(atom_window, 0, 200)

View File

@@ -63,7 +63,7 @@ def main(argv):
# [horiz]
# Specify size on horizontal axis
cols = horizontal.shape[1]
horizontal_size = cols / 30
horizontal_size = cols // 30
# Create structure element for extracting horizontal lines through morphology operations
horizontalStructure = cv.getStructuringElement(cv.MORPH_RECT, (horizontal_size, 1))
@@ -79,7 +79,7 @@ def main(argv):
# [vert]
# Specify size on vertical axis
rows = vertical.shape[0]
verticalsize = rows / 30
verticalsize = rows // 30
# Create structure element for extracting vertical lines through morphology operations
verticalStructure = cv.getStructuringElement(cv.MORPH_RECT, (1, verticalsize))