def gimpMarkup(self, hints = gimpContours, image = "2x2-red-1.jpg", feature = "top-left-monitor"):
r = Rectangle(*hints[image][feature])
contour = r.asContour()
cv2.drawContours(self.img, [contour], -1, (0, 255, 0), 5 )
title = self.tgen.next(feature)
if self.show: ImageViewer(self.img).show(window=title, destroy = self.destroy, info = self.info, thumbnailfn = title)
roi = r.getRoi(self.img)
self.rois[feature] = roi
# Histogram the ROI to get the spread of intensities, in each channel and grayscale
title = '%s-roi.jpg' % feature
if self.show: ImageViewer(roi).show(window=title, destroy = self.destroy, info = self.info, thumbnailfn = title)
colors = ('b','g','r')
for i,col in enumerate(colors):
hist = cv2.calcHist([roi], [i], None, [256], [0,256])
plt.plot(hist, color = col)
plt.xlim([0,256])
#plt.hist(roi.ravel(), 256, [0,256])
plt.show()
cmap = ColorMapper(roi)
cmap.mapit(1)
title = self.tgen.next('colourMapping')
if self.show: ImageViewer(self.img).show(window=title, destroy = self.destroy, info = self.info, thumbnailfn = title)
cv2.waitKey()
评论列表
文章目录