Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
stawel committed Oct 25, 2016
1 parent 007438f commit 215aa5f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client_lines2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def v2(x,y):
cam_DX=v(0.855/1944.,0.,0.), cam_DY=v(0.,0.,0.995/2592.), cam_resolution=v2(1944.,2592.),
laser_N=lN, laser_O=v(-0.37,0.,0.))

for i in range(10000,10500,20):
for i in range(12000,12500,20):

start = timer()
line = Line(path + str(i) + ".jpg", path + str(i+1) + ".jpg")
Expand Down
7 changes: 4 additions & 3 deletions colors_hls_3d_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import matplotlib
import pi2R.lines2d
file_nr = 13090
file_nr = 11050
#file_nr = 11050
file_nr = 12000

path = './s4/'
name1 = path + str(file_nr) + '.jpg'
Expand All @@ -25,10 +26,10 @@ def transform(disp_img, img1, img2, t=25):
res = disp_img
mask, (x,y) = pi2R.lines2d.transform(img1, img2, t)

res[mask] = [0.,0.,0.]
# res[mask] = [0.,0.,0.]
color = [0,255,255]
res[x,y] = color
# res[x+1,y] = color
res[x+1,y] = color
res[x-1,y] = color
res[x,y+1] = color
res[x,y-1] = color
Expand Down
2 changes: 1 addition & 1 deletion pi2R/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get_points_2d_(self):
# if len(a) > 25000:
# print 'error rgb:', len(a)

if len(x) > 2*3500:
if len(x) > 3500:
print 'error reduce:', len(x)
return []
return zip(y,x)
Expand Down
20 changes: 13 additions & 7 deletions pi2R/lines2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,24 @@ def transform(img1, img2, t=25):
h2,l2,s2 = split(img2)

y_data = l2-l1
y_data[y_data<0.02] = 0.02
dy = 0.03
y_data[y_data<dy] = dy

kernel_size_x = 25
kernel_size_y = 11
kernel_x = np.ones((kernel_size_x), dtype=np.float32)*-1
kernel_x[kernel_size_x/4:kernel_size_x*3/4] = 1.
kernel = np.outer(signal.gaussian(kernel_size_y,7),kernel_x)
kernel/=kernel_size_y*kernel_size_x*2

kernel_x[kernel_size_x/4:(kernel_size_x*3)/4] = 1.
kernel = np.outer(signal.gaussian(kernel_size_y,7,),kernel_x)
# kernel/= kernel.sum()#kernel_size_y*kernel_size_x*2
kernel.astype(np.float32)
# a = kernel.sum()
y_data = signal.fftconvolve(y_data, kernel, mode='same')

ymax = y_data.max()
print 'kernel sum:', kernel.sum(), 'ymax:', ymax
d = ymax/40
#d = 0
#d = ymax/10
print y_data
d = 0.5
mask_not = y_data < d
mask_not[:,0:20] = True
mask_not[:,-20:] = True
Expand All @@ -75,6 +78,9 @@ def transform(img1, img2, t=25):
y_data[mask_not] = d
x,y = max_laser(y_data)

# y_data = (l2-l1)


end = timer()
print 'transform time:',end - start

Expand Down

0 comments on commit 215aa5f

Please sign in to comment.