-
Notifications
You must be signed in to change notification settings - Fork 16
/
genertae_pyramid.py
54 lines (42 loc) · 1.41 KB
/
genertae_pyramid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 25 09:42:22 2022
@author: nnafati
"""
import numpy as np
import cv2
import matplotlib.pyplot as plt
from skimage import data
from skimage.transform import pyramid_gaussian
from skimage import data
import imageio as io
from math import sqrt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
from skimage import feature, exposure
import cv2
import numpy as np
import skimage.io as io
image = cv2.imread('/home/nnafati/Desktop/Data/images_tiff/spots.tif')
rows, cols, dim = image.shape
image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
pyramid = tuple(pyramid_gaussian(image, downscale=2, channel_axis=-1))
composite_image = np.zeros((rows, cols + cols // 2, 3), dtype=np.double)
# composite_image[:rows, :cols, :3] = pyramid[0]
composite_image[:rows, :cols,:3] = pyramid[0]
i_row = 0
for p in pyramid[1:]:
n_rows, n_cols = p.shape[:2]
print('image composite n_row col+col/2',composite_image[i_row:i_row + n_rows, cols:cols + n_cols].shape)
print('p shape',p.shape)
if(composite_image[i_row:i_row + n_rows, cols:cols + n_cols].shape==p.shape):
composite_image[i_row:i_row + n_rows, cols:cols + n_cols] = p
i_row += n_rows
else:
break
fig, ax = plt.subplots()
ax.imshow(composite_image)
plt.show()