Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open cv 旋转图像 #6

Open
zibuyu1995 opened this issue May 6, 2018 · 0 comments
Open

open cv 旋转图像 #6

zibuyu1995 opened this issue May 6, 2018 · 0 comments
Assignees
Labels
tutorial open cv tutorial

Comments

@zibuyu1995
Copy link
Owner

# coding=utf-8

import cv2
import numpy as np

in_image = cv2.imread('./image/image6.jpg')
h, w, ch = in_image.shape

forward_rotate = np.zeros((w, h, ch))
image_flip = np.fliplr(in_image)
for c in range(ch):
    for row in range(h):
        forward_rotate[:, row, c] = image_flip[row, :, c]

reverse_rotate = np.zeros((w, h, ch))
output = np.zeros((w, h, ch))
for c in range(ch):
    for row in range(h):
        output[:, h - 1 - row, c] = in_image[row, :, c]

cv2.imshow('in_image', in_image)
cv2.imshow('flip_image', image_flip)
cv2.imshow('forward_rotate', forward_rotate)
cv2.imshow('reverse_rotate', reverse_rotate)

# x86 cv2.waitKey(0) x64 cv2.waitKey(0) & 0xFF
key = cv2.waitKey(0) & 0xFF
if key == ord('q'):
    cv2.destroyAllWindows()
@zibuyu1995 zibuyu1995 added the tutorial open cv tutorial label May 6, 2018
@zibuyu1995 zibuyu1995 self-assigned this May 6, 2018
@zibuyu1995 zibuyu1995 added this to the opencv 图像处理阶段 milestone May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tutorial open cv tutorial
Projects
None yet
Development

No branches or pull requests

1 participant