本文整理汇总了Python中utils.imageIO.imread函数的典型用法代码示例。如果您正苦于以下问题:Python imread函数的具体用法?Python imread怎么用?Python imread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_Poisson
def test_Poisson():
y=50
x=10
useLog=True
fg=io.imread('data/bear.png')
bg=io.imread('data/waterpool.png')
mask=io.imread('data/mask.png')
h, w=fg.shape[0], fg.shape[1]
mask[mask>0.5]=1.0
mask[mask<0.6]=0.0
bg2=(bg[y:y+h, x:x+w]).copy()
out=bg.copy()
if useLog:
bg2[bg2==0]=1e-4
fg[fg==0]=1e-4
bg3=np.log(bg2)+3
fg3=np.log(fg)+3
else:
bg3=bg2
fg3=fg
tmp=a8.Poisson(bg3, fg3, mask, 3000)
if useLog:
out[y:y+h, x:x+w]=np.exp(tmp-3)
else: out[y:y+h, x:x+w]=tmp
io.imwrite(out, 'poisson.png')
示例2: test_myown
def test_myown():
y=150
x=300
useLog=True
fg=io.imread('dolphin.png')
bg=io.imread('bg.png')
mask=io.imread('dolphin_mask.png')
# out=a8.naiveComposite(bg, fg, mask, 50, 50)
# io.imwrite(out, 'myownnative11.png')
h, w=fg.shape[0], fg.shape[1]
mask[mask>0.5]=1.0
mask[mask<0.6]=0.0
bg2=(bg[y:y+h, x:x+w]).copy()
out=bg.copy()
if useLog:
bg2[bg2==0]=1e-4
fg[fg==0]=1e-4
bg3=np.log(bg2)+3
fg3=np.log(fg)+3
else:
bg3=bg2
fg3=fg
tmp=a8.PoissonCG(bg3, fg3, mask, 150)
if useLog:
out[y:y+h, x:x+w]=np.exp(tmp-3)
else: out[y:y+h, x:x+w]=tmp
io.imwrite(out, 'myowncomposite.png')
示例3: my_test_PoissonCG40
def my_test_PoissonCG40():
y=20
x=410
useLog=True
fg=io.imread('data/dog_frisbee.png')
bg=io.imread('data/boston-skyline.png')
mask=io.imread('data/dog_frisbee-mask.png')
h, w=fg.shape[0], fg.shape[1]
mask[mask>0.5]=1.0
mask[mask<0.6]=0.0
bg2=(bg[y:y+h, x:x+w]).copy()
out=bg.copy()
if useLog:
bg2[bg2==0]=1e-4
fg[fg==0]=1e-4
bg3=np.log(bg2)+3
fg3=np.log(fg)+3
else:
bg3=bg2
fg3=fg
tmp=a8.PoissonCG(bg3, fg3, mask, 40)
if useLog:
out[y:y+h, x:x+w]=np.exp(tmp-3)
else: out[y:y+h, x:x+w]=tmp
io.imwrite(out, 'my_poisson_CG40.png')
示例4: test_RANSAC
def test_RANSAC():
im1=io.imread('pano/stata-1.png', 1.0)
im2=io.imread('pano/stata-2.png', 1.0)
correspondences=np.load('corrs.npy')
H, inliers =a7.RANSAC(correspondences)
io.imwrite(_magicDrawCorrespondences(correspondences, im1, im2, inliers), \
'correspondence_ransac.png', 1.0)
示例5: test_two_scale_blending2
def test_two_scale_blending2():
im1=io.imread('pano/guedelon-1.png', 1.0)
im2=io.imread('pano/guedelon-2.png', 1.0)
im3=io.imread('pano/guedelon-3.png', 1.0)
im4=io.imread('pano/guedelon-4.png', 1.0)
im_list=[im1, im2, im3, im4]
out=a7.two_scale_blending(im_list, 1)
io.imwrite(out, 'output/two_scale_blending2.png', 1.0)
示例6: test_linear_blending2
def test_linear_blending2():
im1=io.imread('pano/guedelon-1.png', 1.0)
im2=io.imread('pano/guedelon-2.png', 1.0)
im3=io.imread('pano/guedelon-3.png', 1.0)
im4=io.imread('pano/guedelon-4.png', 1.0)
im_list=[im1, im2, im3, im4]
out=a7.linear_blending(im_list, 1)
io.imwrite(out, 'linear_blending2.png', 1.0)
示例7: castle_autostitch
def castle_autostitch():
im1=io.imread('pano/castle-1.png', 1.0)
im2=io.imread('pano/castle-2.png', 1.0)
im3=io.imread('pano/castle-3.png', 1.0)
im4=io.imread('pano/castle-4.png', 1.0)
im_list=[im1, im2, im3, im4]
out=a7.autostitch(im_list, 1)
io.imwrite(out, 'output/castle_panorama.png', 1.0)
示例8: test_autostitch2
def test_autostitch2():
im1=io.imread('pano/guedelon-1.png', 1.0)
im2=io.imread('pano/guedelon-2.png', 1.0)
im3=io.imread('pano/guedelon-3.png', 1.0)
im4=io.imread('pano/guedelon-4.png', 1.0)
im_list=[im1, im2, im3, im4]
out=a7.autostitch(im_list, 1)
io.imwrite(out, 'panorama2.png', 1.0)
示例9: castle_two_scale_blending2
def castle_two_scale_blending2():
im1=io.imread('pano/castle-1.png', 1.0)
im2=io.imread('pano/castle-2.png', 1.0)
im3=io.imread('pano/castle-3.png', 1.0)
im4=io.imread('pano/castle-4.png', 1.0)
im_list=[im1, im2, im3, im4]
out=a7.two_scale_blending(im_list, 1)
io.imwrite(out, 'output/castle_two_blending.png', 1.0)
示例10: test_findCorrespondence
def test_findCorrespondence():
im1=io.imread('pano/stata-1.png', 1.0)
im2=io.imread('pano/stata-2.png', 1.0)
corners1=a7.HarrisCorners(im1)
features1=a7.computeFeatures(im1, corners1)
corners2=a7.HarrisCorners(im2)
features2=a7.computeFeatures(im2, corners2)
correspondences = a7.findCorrespondences(features1, features2)
np.save('corrs', correspondences)
io.imwrite(_magicDrawCorrespondences(correspondences, im1, im2), \
'correspondence.png', 1.0)
示例11: test_weight_map
def test_weight_map():
im1=io.imread('pano/castle-1.png', 1.0)
im2=io.imread('pano/castle-2.png', 1.0)
im3=io.imread('pano/castle-3.png', 1.0)
im4=io.imread('pano/castle-4.png', 1.0)
im_list=[im1, im2, im3, im4]
square=a7.weight_map(750, 750)
long=a7.weight_map(750, 350)
wide=a7.weight_map(350, 750)
io.imwrite(square, 'output/weight_map_squre.png', 1.0)
io.imwrite(long, 'output/weight_map_long.png', 1.0)
io.imwrite(wide, 'output/weight_map_wide.png', 1.0)
示例12: test_grad_descent
def test_grad_descent():
im=io.imread('data/pru.png')
kernel=a8.gauss2D(1)
im_blur=a8.convolve3(im, kernel)
io.imwrite(im_blur, 'pru_blur.png')
im_sharp=a8.deconvGradDescent(im_blur, kernel);
io.imwrite(im_sharp, 'pru_sharp.png')
示例13: test_conjugate_grad_descent
def test_conjugate_grad_descent():
im=io.imread('data/pru.png')
kernel=a8.gauss2D(1)
im_blur=a8.convolve3(im, kernel)
io.imwrite(im_blur, 'output/pru_blur.png')
im_sharp=a8.deconvCG(im_blur, kernel);
io.imwrite(im_sharp, 'output/pru_sharp_CG.png')
示例14: test_real_psf25
def test_real_psf25():
im=io.imread('data/pru.png')
f=open('psf', 'r')
psf=[map(float, line.split(',')) for line in f ]
kernel=np.array(psf)
im_blur=a8.convolve3(im, kernel)
#kernel=kernel[::-1, ::-1]
io.imwrite(im_blur, 'pru_blur_real25.png')
io.imwriteGrey(kernel/np.max(kernel), 'psf25.png')
im_sharp=a8.deconvCG(im_blur, kernel, 25);
io.imwrite(im_sharp, 'pru_sharp_CG_real25.png')
示例15: test_conjugate_grad_descent_reg
def test_conjugate_grad_descent_reg():
im=io.imread('data/pru.png')
kernel=a8.gauss2D(1)
im_blur=a8.convolve3(im, kernel)
noise=np.random.random(im_blur.shape)-0.5
im_blur_noisy=im_blur+0.05*noise
io.imwrite(im_blur_noisy, 'pru_blur_noise.png')
im_sharp=a8.deconvCG_reg(im_blur_noisy, kernel);
im_sharp_wo_reg=a8.deconvCG(im_blur_noisy, kernel);
io.imwrite(im_sharp, 'pru_sharp_CG_reg.png')
io.imwrite(im_sharp_wo_reg, 'pru_sharp_CG_wo_reg.png')