下面的代码仍以baby美图为例具体程序如下:
import cv2.cv as cv
image = cv.LoadImage('angelababy.jpg',1)
size = (image.width,image.height)
iUD = cv.CreateImage(size,image.depth,image.nChannels)
iLR = cv.CreateImage(size,image.depth,image.nChannels)
iAcross = cv.CreateImage(size,image.depth,image.nChannels)
h = image.height
w = image.width
for i in range(h):
for j in range(w):
iUD[h-1-i,j] = image[i,j]
iLR[i,w-1-j] = image[i,j]
iAcross[h-1-i,w-1-j] = image[i,j]
cv.ShowImage('image',image)
cv.ShowImage('iUD',iUD)
cv.ShowImage('iLR',iLR)
cv.ShowImage('iAcross',iAcross)
cv.WaitKey(0)
以上就是python中镜像实现方法的详细内容,更多请关注Gxl网其它相关文章!
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did82463