本文整理汇总了Python中cv2.max方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.max方法的具体用法?Python cv2.max怎么用?Python cv2.max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv2
的用法示例。
在下文中一共展示了cv2.max方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CFMGetFM
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import max [as 别名]
def CFMGetFM(self, R, G, B):
# max(R,G,B)
tmp1 = cv2.max(R, G)
RGBMax = cv2.max(B, tmp1)
RGBMax[RGBMax <= 0] = 0.0001 # prevent dividing by 0
# min(R,G)
RGMin = cv2.min(R, G)
# RG = (R-G)/max(R,G,B)
RG = (R - G) / RGBMax
# BY = (B-min(R,G)/max(R,G,B)
BY = (B - RGMin) / RGBMax
# clamp nagative values to 0
RG[RG < 0] = 0
BY[BY < 0] = 0
# obtain feature maps in the same way as intensity
RGFM = self.FMGaussianPyrCSD(RG)
BYFM = self.FMGaussianPyrCSD(BY)
# return
return RGFM, BYFM
# orientation feature maps
示例2: CFMGetFM
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import max [as 别名]
def CFMGetFM(self, R, G, B):
# max(R,G,B)
tmp1 = cv2.max(R, G)
RGBMax = cv2.max(B, tmp1)
RGBMax[RGBMax <= 0] = 0.0001 # Prevent dividing by 0
# min(R,G)
RGMin = cv2.min(R, G)
# RG = (R-G)/max(R,G,B)
RG = (R - G) / RGBMax
# BY = (B-min(R,G)/max(R,G,B)
BY = (B - RGMin) / RGBMax
# clamp nagative values to 0
RG[RG < 0] = 0
BY[BY < 0] = 0
# Obtain feature maps in the same way as intensity
RGFM = self.FMGaussianPyrCSD(RG)
BYFM = self.FMGaussianPyrCSD(BY)
return RGFM, BYFM
# Orientation feature maps
示例3: setMaxDepth
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import max [as 别名]
def setMaxDepth(self, m=4.5):
""" Sets max considered depth """
self.maxDepth = m
示例4: applyKirschFilter
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import max [as 别名]
def applyKirschFilter(self):
gray = self.curImg
if gray.ndim > 2:
raise Exception("illegal argument: input must be a single channel image (gray)")
kernelG1 = np.array([[ 5, 5, 5],
[-3, 0, -3],
[-3, -3, -3]], dtype=np.float32)
kernelG2 = np.array([[ 5, 5, -3],
[ 5, 0, -3],
[-3, -3, -3]], dtype=np.float32)
kernelG3 = np.array([[ 5, -3, -3],
[ 5, 0, -3],
[ 5, -3, -3]], dtype=np.float32)
kernelG4 = np.array([[-3, -3, -3],
[ 5, 0, -3],
[ 5, 5, -3]], dtype=np.float32)
kernelG5 = np.array([[-3, -3, -3],
[-3, 0, -3],
[ 5, 5, 5]], dtype=np.float32)
kernelG6 = np.array([[-3, -3, -3],
[-3, 0, 5],
[-3, 5, 5]], dtype=np.float32)
kernelG7 = np.array([[-3, -3, 5],
[-3, 0, 5],
[-3, -3, 5]], dtype=np.float32)
kernelG8 = np.array([[-3, 5, 5],
[-3, 0, 5],
[-3, -3, -3]], dtype=np.float32)
g1 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG1), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g2 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG2), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g3 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG3), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g4 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG4), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g5 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG5), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g6 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG6), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g7 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG7), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
g8 = cv2.normalize(cv2.filter2D(gray, cv2.CV_32F, kernelG8), None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8UC1)
magn = cv2.max(g1, cv2.max(g2, cv2.max(g3, cv2.max(g4, cv2.max(g5, cv2.max(g6, cv2.max(g7, g8)))))))
self.curImg = magn
开发者ID:ebdulrasheed,项目名称:Diabetic-Retinopathy-Feature-Extraction-using-Fundus-Images,代码行数:41,代码来源:BloodVessels.py
示例5: make_long_frames
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import max [as 别名]
def make_long_frames(self):
# Start the image producer
self.imageQueue = queue.Queue(maxsize=2)
self.imageProducer = ImageProducer("Producer", self.imageQueue)
self.imageProducer.start()
self.max_index = 0
try:
self.max_image = self.imageQueue.get(timeout = QUEUE_TIMEOUT)
while True:
# Get the next image from the queue and update the max
self.im = self.imageQueue.get(timeout = QUEUE_TIMEOUT)
cv2.max(self.im, self.max_image, self.max_image)
self.max_index += 1
# Write a long image
if self.max_index >= NUM_LONG_MAX_IMAGES:
self.max_index = 0
cv2.imwrite(("long-" + self.imageProducer.get_currentimagefilename()), self.max_image)
self.max_image.fill(0)
except:
cv2.imwrite(("long-" + self.imageProducer.get_currentimagefilename()), self.max_image)
print("Exception checking file ", sys.exc_info()[0])
self.finish()
# Main program
示例6: check_key
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import max [as 别名]
def check_key(self):
self.key_pressed64 = cv2.waitKey(1) & 0xffff
self.key_pressed = self.key_pressed64 & 0xff
# if self.key_pressed64 != 255: print(hex(self.key_pressed64))
if (self.key_pressed64 < 0 or self.key_pressed64 == 255): return # No key pressed
elif(self.key_pressed == 0x1b) or (self.key_pressed == 0x71): # <Esc> or q key
self.finish()
elif (self.key_pressed == 0x72): # 'r' reset
self.short_max_im8u.fill(0)
elif (self.key_pressed == 0x0A): # 'Enter' key - pause and reset
self.pause = not self.pause
self.short_max_im8u.fill(0)
elif (self.key_pressed == 0x73): # 's' key - save image
cv2.imwrite(self.named_image.image_name + "-saved.png", self.short_max_im8u)
print("Saved image: ", self.named_image.image_name + "-saved.png")
elif (self.key_pressed == 0x20): # space key - pause
self.pause = not self.pause
self.single_step = False
elif (self.key_pressed == 0x6d): # m key - toggle max pixel display
self.short_max_im8u.fill(0)
self.show_max = not self.show_max
elif (self.key_pressed64 == 0x055): # pgup arrow - rewind 100 frames
self.short_max_im8u.fill(0)
self.imageProducer.move_index(-100)
self.clear_queue()
self.pause = False
elif (self.key_pressed64 == 0x056): # pgdown arrow - forward 300 frames
self.short_max_im8u.fill(0)
self.imageProducer.move_index(300)
self.clear_queue()
self.pause = False
elif (self.key_pressed == 65361) or (self.key_pressed64 == 0x051): # left arrow - rewind 100 frames
self.short_max_im8u.fill(0)
self.imageProducer.move_index(-100)
self.clear_queue()
self.pause = False
elif (self.key_pressed == 65363) or (self.key_pressed64 == 0x053): # right arrow - forward 100 frames
self.short_max_im8u.fill(0)
self.imageProducer.move_index(100)
self.clear_queue()
self.pause = False
elif (self.key_pressed == 65362) or (self.key_pressed64 == 0x052): # up arrow - flip display frame
self.short_max_im8u.fill(0)
self.flip = not self.flip
elif (self.key_pressed == 0x63): # 'c' key - change contrast
if len(self.display_image) == 3:
cv2.imshow("CheckNight", cv2.resize(self.clahe.apply(cv2.cvtColor(self.display_image, cv2.COLOR_RGB2GRAY)), (0,0), fx=self.scale, fy=self.scale))
else:
cv2.imshow("CheckNight", cv2.resize(self.clahe.apply(self.display_image), (0,0), fx=self.scale, fy=self.scale))
self.contrast = not self.contrast
self.pause = True
#elif (self.key_pressed == 0x76): # 'v' key to view latest frame using eog
# try:
# os.system ('eog ' + self.named_image.image_name)
# except:
# print("Unable to view image")
elif (self.key_pressed == 0x2e): # '.' key to single step
self.single_step = True
self.pause = False