
opencv
yjl9122
做出一些事,影响一些人
展开
-
python-opencv旋转图像,保持图像不被裁减
# -*- coding:gb2312 -*-import cv2from math import *import numpy as npimg = cv2.imread("3-2.jpg")height,width=img.shape[:2]degree=45#旋转后的尺寸heightNew=int(width*fabs(sin(radians(degree)))+height*fabs原创 2017-04-26 22:32:48 · 14811 阅读 · 4 评论 -
opencv-Python旋转矩形框裁减
经常遇见旋转矩形框的裁减问题,那么思路是,将矩形框旋转正然后再裁减# -*- coding:gb2312 -*-import cv2from math import *import numpy as npimport timedef rotateImage(img,degree,pt1,pt2,pt3,pt4): height,width=img.shape[:2] heig原创 2017-05-05 17:52:56 · 6822 阅读 · 2 评论 -
opencv不能用imshow
Python装好了opencv 但是不能用imshow,又不想调试,于是用下列方法解决显示问题import cv2import matplotlib.pyplot as pltimgSrc=cv2.imread("../images/0.jpg")plt.imshow(imgSrc)plt.show()原创 2017-04-24 12:43:54 · 2891 阅读 · 1 评论 -
python实现HOG+SVM
该程序可以在gitHub上找到 https://github.com/yjl9122/object-detector-master.git主函数为#!/usr/bin/pythonimport os# Link to the UIUC Car Database# http://l2r.cs.uiuc.edu/~cogcomp/Data/Car/CarData.tar.gz# dataset_u原创 2017-05-26 14:00:13 · 15704 阅读 · 4 评论 -
matplotlib画矩形框
更全面的在Draw rectangles with matplotlibimport matplotlib.patches as patchesimport matplotlib.pyplot as pltimport cv2img=cv2.imread("images/1.jpg")plt.figure(8)plt.imshow(imgSrc)currentAxis=plt.gca()原创 2017-04-25 18:46:38 · 26689 阅读 · 4 评论 -
使用opencv在图片中加入文字
# -*- coding:gb2312 -*-import cv2import numpy as npimg = np.zeros((1000,500,3), np.uint8)font = cv2.FONT_HERSHEY_SIMPLEX# 加入多行# text=" C /n B /n H /n U /n /n 4 /n 4 /n 0 /n 9 /n 7 /n 9"# y0, dy = 1原创 2017-04-25 22:04:56 · 5173 阅读 · 0 评论 -
python-opencv实现切变换,不裁减图片
# -*- coding:gb2312 -*-import cv2from math import *import numpy as npimg = cv2.imread("3-2.jpg")height,width=img.shape[:2]degreeAffine=45#切变换最后结果heightAffine=heightwidthAffine=int(2*height*tan(rad原创 2017-04-27 14:31:10 · 1160 阅读 · 0 评论 -
opencv像素操作
1–bit_depth—比特数—代表8bite,16bites,32bites,64bites—举个例子吧–比如说,如 如果你现在创建了一个存储–灰度图片的Mat对象,这个图像的大小为宽100,高100,那么,现在这张 灰度图片中有10000个像素点,它每一个像素点在内存空间所占的空间大小是8bite,8位–所以它对 应的就是CV_8 ...原创 2018-02-09 14:11:06 · 487 阅读 · 0 评论