当前位置: 首页>>代码示例>>Python>>正文


Python cv2.pyrUp方法代码示例

本文整理汇总了Python中cv2.pyrUp方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.pyrUp方法的具体用法?Python cv2.pyrUp怎么用?Python cv2.pyrUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cv2的用法示例。


在下文中一共展示了cv2.pyrUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pyramid

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def pyramid(image, minSize):
    yield image

    if image.shape[0] < minSize[0] and image.shape[1] < minSize[1]:
        # image too small - upscaling until we hit window level
        image = cv2.pyrUp(image)

        while (image.shape[0] <= minSize[0] or image.shape[1] <= minSize[1]):
            yield image
            image = cv2.pyrUp(image)
    else:
        # image too big - downscaling until we hit window level
        image = cv2.pyrDown(image)

        while (image.shape[0] >= minSize[0] or image.shape[1] >= minSize[1]):
            yield image
            image = cv2.pyrDown(image)


# Malisiewicz et al. 
开发者ID:AVGInnovationLabs,项目名称:DoNotSnap,代码行数:22,代码来源:util.py

示例2: cartoonise

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def cartoonise(self, img_rgb, num_down, num_bilateral, medianBlur, D, sigmaColor, sigmaSpace):
        # 用高斯金字塔降低取样
        img_color = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2BGR)
        for _ in range(num_down):
            img_color = cv2.pyrDown(img_color)
        # 重复使用小的双边滤波代替一个大的滤波
        for _ in range(num_bilateral):
            img_color = cv2.bilateralFilter(img_color, d=D, sigmaColor=sigmaColor, sigmaSpace=sigmaSpace)
        # 升采样图片到原始大小
        for _ in range(num_down):
            img_color = cv2.pyrUp(img_color)
        if not self.Save_Edge:
            img_cartoon = img_color
        else:
            img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2GRAY)
            img_blur = cv2.medianBlur(img_gray, medianBlur)
            img_edge = cv2.adaptiveThreshold(img_blur, 255,
                                             cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                             cv2.THRESH_BINARY,
                                             blockSize=self.Adaptive_Threshold_Block_Size,
                                             C=self.C)
            img_edge = cv2.cvtColor(img_edge, cv2.COLOR_GRAY2RGB)
            img_edge = cv2.resize(img_edge, img_color.shape[:2][::-1])
            img_cartoon = cv2.bitwise_and(img_color, img_edge)
        return cv2.cvtColor(img_cartoon, cv2.COLOR_RGB2BGR) 
开发者ID:MashiMaroLjc,项目名称:rabbitVE,代码行数:27,代码来源:Cartoonlization.py

示例3: build_lappyr

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def build_lappyr(img, leveln=6, dtype=np.int16):
    img = dtype(img)
    levels = []
    for i in xrange(leveln-1):
        next_img = cv2.pyrDown(img)
        img1 = cv2.pyrUp(next_img, dstsize=getsize(img))
        levels.append(img-img1)
        img = next_img
    levels.append(img)
    return levels 
开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:12,代码来源:lappyr.py

示例4: merge_lappyr

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def merge_lappyr(levels):
    img = levels[-1]
    for lev_img in levels[-2::-1]:
        img = cv2.pyrUp(img, dstsize=getsize(lev_img))
        img += lev_img
    return np.uint8(np.clip(img, 0, 255)) 
开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:8,代码来源:lappyr.py

示例5: process_scale

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def process_scale(a_lods, lod):
        d = a_lods[lod] - cv2.pyrUp(a_lods[lod+1])
        for i in xrange(lod):
            d = cv2.pyrUp(d)
        v = cv2.GaussianBlur(d*d, (3, 3), 0)
        return np.sign(d), v 
开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:8,代码来源:turing.py

示例6: LaplacianPyramid

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def LaplacianPyramid(img, leveln):
    LP = []
    for i in range(leveln - 1):
        next_img = cv2.pyrDown(img)
        LP.append(img - cv2.pyrUp(next_img, img.shape[1::-1]))
        img = next_img
    LP.append(img)
    return LP 
开发者ID:cynricfu,项目名称:dual-fisheye-video-stitching,代码行数:10,代码来源:blending.py

示例7: reconstruct

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def reconstruct(LS):
    img = LS[-1]
    for lev_img in LS[-2::-1]:
        img = cv2.pyrUp(img, lev_img.shape[1::-1])
        img += lev_img
    return img 
开发者ID:cynricfu,项目名称:dual-fisheye-video-stitching,代码行数:8,代码来源:blending.py

示例8: main

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def main():
    image = cv2.imread("../data/4.2.03.tiff", 1)

    first_layer_down = cv2.pyrDown(image)
    first_layer_up = cv2.pyrUp(first_layer_down)

    laplasian = cv2.subtract(image, first_layer_up)

    cv2.imshow("Orignal Image", image)
    cv2.imshow("Laplasian Image", laplasian)

    cv2.waitKey(0)
    cv2.destroyAllWindows() 
开发者ID:amarlearning,项目名称:Finger-Detection-and-Tracking,代码行数:15,代码来源:Pyramids.py

示例9: double_upsampling

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def double_upsampling(input):
  return cv2.pyrUp(cv2.pyrUp(input)) 
开发者ID:nsavinov,项目名称:SPTM,代码行数:4,代码来源:util.py

示例10: show_edges

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def show_edges (self):

		# diff = (self.image_region_normalized - self.last_image_region_normalized)
		# gray = cv2.cvtColor ()
		# cv2.imshow ('NORMALIZED', cv2.pyrUp(cv2.pyrUp(np.abs(self.image_region_normalized - self.last_image_region_normalized))))

		cv2.imshow ('EDGES', cv2.pyrUp(cv2.pyrUp(self.edges)))
		cv2.imshow ('REGION', cv2.pyrUp(cv2.pyrUp(self.image_region)))

		key = 0
		while key != 27:
			key = cv2.waitKey (30) 
开发者ID:nebbles,项目名称:DE3-ROB1-CHESS,代码行数:14,代码来源:Square.py

示例11: get_image_diff

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def get_image_diff (img1, img2):
	"""
		Function: get_image_diff
		------------------------
		given two images, this finds the eroded/dilated difference 
		between them on a coarse grain.
		NOTE: assumes both are full-size, color
	"""
	#=====[ Step 1: convert to gray	]=====
	img1_gray = cv2.cvtColor (img1, cv2.COLOR_BGR2GRAY)
	img2_gray = cv2.cvtColor (img2, cv2.COLOR_BGR2GRAY)	

	#=====[ Step 2: downsample 	]=====
	img1_small = cv2.pyrDown(cv2.pyrDown(img1_gray))
	img2_small = cv2.pyrDown(cv2.pyrDown(img2_gray))	

	#=====[ Step 3: find differnece	]=====
	difference = img2_small - img1_small

	#=====[ Step 4: erode -> dilate	]=====
	kernel = np.ones ((4, 4), np.uint8)
	difference_ed = cv2.dilate(cv2.erode (difference, kernel), kernel)

	#=====[ Step 5: blow back up	]=====
	return cv2.pyrUp (cv2.pyrUp (difference_ed))






####################################################################################################
##############################[ --- CORNER DETECTION/DESCRIPTION--- ]###############################
#################################################################################################### 
开发者ID:nebbles,项目名称:DE3-ROB1-CHESS,代码行数:36,代码来源:CVAnalysis_old.py

示例12: show_image

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def show_image (image, title):
	cv2.imshow (title, cv2.pyrUp(cv2.pyrUp(image))) 
开发者ID:nebbles,项目名称:DE3-ROB1-CHESS,代码行数:4,代码来源:image_region_analysis.py

示例13: LaplacianPyramid

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def LaplacianPyramid(self, img, level):
        gp = self.GaussianPyramid(img, level)
        lp = [gp[level-1]]
        for i in range(level - 1, -1, -1):
            GE = cv2.pyrUp(gp[i])
            GE = cv2.resize(GE, (gp[i - 1].shape[1], gp[i - 1].shape[0]), interpolation=cv2.INTER_CUBIC)
            L = cv2.subtract(gp[i - 1], GE)
            lp.append(L)
        return lp, gp 
开发者ID:Keep-Passion,项目名称:ImageStitch,代码行数:11,代码来源:ImageFusion.py

示例14: reconstruct

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def reconstruct(self, input_pyramid):
        out = input_pyramid[0]
        for i in range(1, len(input_pyramid)):
            out = cv2.pyrUp(out)
            out = cv2.resize(out, (input_pyramid[i].shape[1],input_pyramid[i].shape[0]), interpolation = cv2.INTER_CUBIC)
            out = cv2.add(out, input_pyramid[i])
        return out 
开发者ID:Keep-Passion,项目名称:ImageStitch,代码行数:9,代码来源:ImageFusion.py

示例15: main

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import pyrUp [as 别名]
def main():
    # read an image 
    img = cv2.imread('../figures/flower.png')
    print(img.shape)

    lower_resolution1 = cv2.pyrDown(img)
    print(lower_resolution1.shape)

    lower_resolution2 = cv2.pyrDown(lower_resolution1)
    print(lower_resolution2.shape)

    lower_resolution3 = cv2.pyrDown(lower_resolution2)
    print(lower_resolution3.shape)

    higher_resolution3 = cv2.pyrUp(lower_resolution3)
    print(higher_resolution3.shape)

    higher_resolution2 = cv2.pyrUp(higher_resolution3)
    print(higher_resolution2.shape)

    higher_resolution1 = cv2.pyrUp(higher_resolution2)
    print(higher_resolution1.shape)




    
    # Do plot
    plot_lr_img(img, lower_resolution1, lower_resolution2, lower_resolution3)
    plot_hy_img(lower_resolution3, higher_resolution3, higher_resolution2, higher_resolution1) 
开发者ID:PacktPublishing,项目名称:Practical-Computer-Vision,代码行数:32,代码来源:03_pyramid_down_smaple.py


注:本文中的cv2.pyrUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。