-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathisolate_kernel.py
More file actions
51 lines (37 loc) · 1.1 KB
/
Copy pathisolate_kernel.py
File metadata and controls
51 lines (37 loc) · 1.1 KB
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
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 9 15:28:27 2018
@author: Dustin
"""
import cv2
import sfr_detection_functions as sfr
import sys
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage, signal
sfr_reference = cv2.imread('Pictures for Dustin/RCCB_Quad_SFR.pgm',0)
sfr_reference = sfr.rescale( sfr_reference)
x,y = sfr_reference.shape
ham_thresh = np.zeros((x,y))
thresh = 70
for i in range(0,x):
for j in range(0,y):
if sfr_reference[i,j] > thresh:
ham_thresh[i,j] = 255
else:
ham_thresh[i,j] = 0
#plt.imshow(ham_thresh,'gray')
#sfr.SFR_routine_cv2(sfr_reference)
'''
k2 = np.array([1,1,1,1,0,-1,-1,-1,-1])
k_SFR = np.array([k2,k2,k2,k2,np.zeros((9,)),-k2,-k2,-k2,-k2])
img_SFR = ndimage.convolve( sfr_reference, k_SFR, )
img_SFR = sfr.rescale(img_SFR)
img_SFR1 = signal.fftconvolve(sfr_reference, k_SFR,'full')
img_SFR1 = sfr.rescale(img_SFR1)
img_SFR2 = sfr.apply_kernel(sfr_reference, k_SFR)
cv2.imshow('prebuilt',img_SFR)
cv2.imshow('fft',img_SFR1)
cv2.imshow('my algorithm', img_SFR2)
'''
sfr.SFR_routine( ham_thresh, 160 )