• Twitter
  • Facebook
  • Google+
  • Instagram
  • Youtube

About me

Let me introduce myself


A bit about me

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident.

I have more than 5 years’ experience related to manufacturing of optical design ,Camera Module and also have some experience on coding . Having years of RD experience that cooperated with international ODM/OEM partners and optics-mechanical products development/DataAnalysis/research/process.

Profile

Deepak Bhagya

Personal info

Deepak Bhagya

If I have seen further than others, it is by standing upon the shoulders of giants.

Birthday: 21 Dec 1984
Phone number: +886
Website: https://bobobo746.blogspot.com
E-mail: 2dkjd1k@gmail.com

RESUME

Know more about my past


Employment

  • 2016-future

    https://www.ixensor.com/ix_web/ @ Optical-Software Programmer

    Optical-Signal algorithm and analysis: 1). Using smart phone’s front camera as optical-analysis device to observe color signal change. 2). Color signal change is based on the blood reacts with strips. 3.) By those signal change, trying to figure out a curve line to represent the bio-reacts on strips and use those feature to construct a measurement system. 4.) Trying to improve the bias, accuracy and precision. 5.) Issues fixed. Image process algorithm: 1.) Image Recognition: Analysis the image to make sure whether the optical device’s uniformity is qualified or not. Experiment Data Build: 1.) Using SQL to build Database for Experiment data. 2.) Producing API for co-workers to access and get some data source, reducing the data collecting time. 3.) Maintaining data base and trying to improve data schemas.

  • 2013-2016

    http://www.primax.com.tw/ @ Sr.Optical and Software Engineer

    1). Camera lens optical specifications define and analysis optical issue, likes the Flare, MTF(SFR), Alignment, Optical Center, and NG-sample analysis. 3). Lens focusing image recognition: Programming an application for machine to recognize the image and focus lens. 4). Con-call and report to customer, and vendor management.

  • 2010-2013

    www.Ledlink.com @ Optical Engineer

    1/ LED lighting lens module development, LED module development of TV backlight, new module development and spec. define. 2/ Optical design of LED lighting lens, jigs design, and solve process problems. 3/ Precision process development, new film materials analysis. 4/ New patent application . 5/ Optical simulation analysis

Education

  • 2006-2009

    University of NCUE @ graduated

    bachelor of science (physics)

  • *********.

Skills & My Love

Engineer
80%
software
WorkOut
91%
Fitting
Coding
95%
Python

Portfolio

My latest projects


2017年4月3日 星期一

均勻度

均勻度


#均勻度
%matplotlib notebook
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from matplotlib import gridspec
from scipy import ndimage
from skimage import measure
import skimage



img = mpimg.imread('HiGary_OriginImage.png')       # float32
pp= skimage.img_as_float(img)                      # 轉 float64 ,(720, 1280, 4) ; signal range:0~1
#pp= skimage.img_as_ubyte(pp)                      # 轉u8-bit int ; signal range: 0~255

# 分兩個,0~255的為計算用
img1= (pp)
img1= img1*255
lum_img = img1[:,:,0]  

# 0~1 的為 找邊界用
img2= ((pp)*5.5/3)**22
img2= ndimage.gaussian_filter(img2,10)
img2[0:200,:,:]=0             
img2[520:720,:,:]=0           
lum_img2 = img2[:,:,0]      

#plt.imshow(lum_img,'gray')

# sobel 參數設定
mod= 'mirror'               
sx = ndimage.sobel(lum_img2, axis=0, mode=mod)
sy = ndimage.sobel(lum_img2, axis=1, mode=mod)
sob = np.hypot(sx, sy)
plt.figure(figsize=(8,6))
plt.imshow(sob,cmap='gray')
plt.show()

# find countour
contours = measure.find_contours(sob, 100)  
x_axis_data=[]
y_axis_data=[]

# 將找到輪廓的x,y座標存起來,裡面的每個array代表該輪廓的所有位置,x表示x所有位置,y表示y所有位置
for n, contour in enumerate(contours):    
  plt.plot(contour[:, 1], contour[:, 0], linewidth=2)
  x_axis_data= x_axis_data+ [contour[:, 1]]
  y_axis_data= y_axis_data+ [contour[:, 0]]

# 設定輪廓大小,假定x輪廓位置總數>500 才列入要找的輪廓,也才接近正圓,因為目前專案圓周大小約2*3.14*60 
x_wanted =[]    
for i in range(len(x_axis_data)):
  if len(x_axis_data[i])>500 and len(x_axis_data[i])<1000:
  x_wanted= x_wanted+[x_axis_data[i]]

y_wanted =[]
for i in range(len(y_axis_data)):
  if len(y_axis_data[i])>500 and len(x_axis_data[i])<1000:
  y_wanted= y_wanted+[y_axis_data[i]]


# 將找到的正圓輪廓找到圓心
x_center=[]
for i,label in enumerate(x_wanted):
  tempx= np.mean(x_wanted[i])
  x_center= x_center +[tempx]

y_center=[]
for i,label in enumerate(y_wanted):
  tempy= np.mean(y_wanted[i])
  y_center= y_center +[tempy]
xc,yc=[],[]
xj,xi=[],[]
# 因為找到的正圓輪廓可能大於三個,所以圓心也大於三個,於是要篩選:  
if len(x_center)>3:

  for i in range(len(x_center)-1):
  for j in range(-i+len(x_center)):
  # 如果圓心的x距離相差<50 且抽取的兩個樣本不同:
  if abs(x_center[j+i]-x_center[i])<50 and x_center[j+i]!=x_center[i]:
  xcc= (x_center[j+i]+x_center[i])/2
  xj= xj+[x_center[j+i]]
  xj=sorted(xj)
  xi= xi+[x_center[i]]
  xi=sorted(xi)
  xc= xc+[xcc]
  xc=sorted(xc)
  # 依照x找到的位置去找對應的y的位置

  for i in range(len(xj)):
  ycc=(y_center[x_center.index(xj[i])]+y_center[x_center.index(xi[i])])/2
  yc= yc+[ycc]

#畫圓心
  plt.figure(figsize=(8,6))
  plt.imshow(img)
  for gg in range(len(xj)):
  plt.scatter(xc[gg],yc[gg],marker= '*',c='r',s= 20)  
# 若沒到三個輪廓 或剛好,依樣顯示出來,不過有可能會沒定位到,可以先看圖再修正 曝光參數或輪廓邊界參數
else:
  xc= x_center
  xc= sorted(xc)
  for i in range(len(xc)):
  ycc=y_center[x_center.index(x_center[i])]
  yc= yc+[ycc]
  yc=sorted(yc)
  plt.figure(figsize=(8,6))
  plt.imshow(img)
  for gg in range(len(x_center)):
  plt.scatter(x_center[gg],y_center[gg],marker= '*',c='r',s= 20)   




# 計算均勻度           
x, y = np.meshgrid(np.arange(0, 1280, 1), np.arange(0, 720, 1))
contor_all=[]
for ij in range(len(xc)):
  contor = np.sqrt((x-xc[ij]) ** 2 + (y-yc[ij] )** 2)
  for j in range(720):
  for i in range(1280): 
  if contor[j][i]<30 :
  contor[j][i] =1.0
  else:
  contor[j][i]=0.0
  contor_all= contor_all+[contor]      

A= ((lum_img*contor_all[0]).sum())/(contor_all[0].sum())   
B= ((lum_img*contor_all[1]).sum())/(contor_all[1].sum())
C= ((lum_img*contor_all[2]).sum())/(contor_all[2].sum())
if C>B:
  ratio1= A/B
  ratio2= A/C
  ratio3= B/C
else:
  ratio1= A/B
  ratio2= A/C
  ratio3= C/B

# 畫掃描圖
fig = plt.figure(figsize=(8, 6)) 
gs = gridspec.GridSpec(2, 1, height_ratios=[5, 1.5]) # 因為圖片比例 與 畫圖 比例不對 必須重新設定比例
#plt.subplot(211)
plt.subplot(gs[0])
plt.imshow(lum_img,cmap='jet')
plt.plot( np.linspace(0,(img.shape[1])-10,num=(img.shape[1])-10,dtype=int) ,
  [360]*(img.shape[1]-10),lw=1,c='r')

upper = [360 + 30]*(img.shape[1]-10)
lower = [360 - 30]*(img.shape[1]-10)
plt.fill_between(np.linspace(0,(img.shape[1])-10,num=(img.shape[1])-10,dtype=int) , 
  lower, upper, color='#888888', alpha=0.4)

#plt.subplot(212)
plt.subplot(gs[1])

ybox=[]
for cc in range(lum_img.shape[1]-10):
  box= np.mean(lum_img[360-30:360+30,cc]) #算平均
  ybox=ybox+[box]
plt.plot(np.linspace(0,(img.shape[1])-10,num=(img.shape[1])-10,dtype=int) ,
  ybox,lw=2 ,c='g',alpha=0.1) # image 是三維矩陣查看方式: image[直,橫,rgb]
plt.grid()
plt.fill_between(np.linspace(0,(img.shape[1])-10,num=(img.shape[1])-10,dtype=int) ,
  ybox,lw=2 ,color='g',alpha=0.2)
plt.show()


print 'HDL/TG:{}'.format(ratio1),' HDL/TC:{}'.format(ratio2),' TG/TC:{}'.format(ratio3)





這封郵件來自 Evernote。Evernote 是您專屬的工作空間,免費下載 Evernote

圓心定位

圓心定位

一樣該import 的先import:

%matplotlib notebook
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from matplotlib import gridspec
from scipy import ndimage
from skimage import measure
import skimage

以我專案碰的問題,來做處理: 因為過曝 所以不用再做filter處理

img = mpimg.imread('circleCenter.png') # float32
pp= skimage.img_as_float(img)          # 轉 float64 ,(720, 1280, 4) ; signal range:0~1
# pp2= skimage.img_as_ubyte(pp)        # 轉u8-bit int ; signal range: 0~255
# print pp2.dtype

# 過曝寫法
gamma= 1000
mag_signal =100

itest= (pp)
img2 = (itest)**gamma                 # 因為曝光,拉高對比度 所以乘以1000次方
img2[0:100,:,:]=0                    # 上面0~100 設為全黑
img2[600:720,:,:]=0                 # 下面600~720 設為全黑
l = img2[:,:,0]*mag_signal         # [x,y,channel] channel:0,1,2
plt.imshow(l,'gray')

mod= 'mirror'                     # sobel 參數設定
sx = ndimage.sobel(l, axis=0, mode=mod)
sy = ndimage.sobel(l, axis=1, mode=mod)
sob = np.hypot(sx, sy)
# plt.figure(figsize=(8,6))
# plt.imshow(sob,cmap='gray')

contours = measure.find_contours(sob, 100)    # find countour
x_axis_data=[]
y_axis_data=[]

# 將找到輪廓的x,y座標存起來,裡面的每個array代表該輪廓的所有位置,x表示x所有位置,y表示y所有位置
for n, contour in enumerate(contours):    
  #plt.plot(contour[:, 1], contour[:, 0], linewidth=2)
  x_axis_data= x_axis_data+ [contour[:, 1]]
  y_axis_data= y_axis_data+ [contour[:, 0]]

# 設定輪廓大小,假定x輪廓位置總數>500 才列入要找的輪廓,也才接近正圓,因為目前專案圓周大小約2*3.14*60 
x_wanted =[]    
for i in range(len(x_axis_data)):
  if len(x_axis_data[i])>500 and len(x_axis_data[i])<1000 :
  x_wanted= x_wanted+[x_axis_data[i]]

y_wanted =[]
for i in range(len(y_axis_data)):
  if len(y_axis_data[i])>500 and len(x_axis_data[i])<1000:
  y_wanted= y_wanted+[y_axis_data[i]]


# 將找到的正圓輪廓找到圓心
x_center=[]
for i,label in enumerate(x_wanted):
  tempx= np.mean(x_wanted[i])
  x_center= x_center +[tempx]

y_center=[]
for i,label in enumerate(y_wanted):
  tempy= np.mean(y_wanted[i])
  y_center= y_center +[tempy]

# 因為找到的正圓輪廓可能大於三個,所以圓心也大於三個,於是要篩選:  
if len(x_center)>3:
  xc =[]
  xj,xi=[],[]
  for i in range(len(x_center)-1):
  for j in range(-i+len(x_center)):
  # 如果圓心的x距離相差<50 且抽取的兩個樣本不同:
  if abs(x_center[j+i]-x_center[i])<50 and x_center[j+i]!=x_center[i]:
  xcc= (x_center[j+i]+x_center[i])/2
  xj= xj+[x_center[j+i]]
  xi= xi+[x_center[i]]
  xc= xc+[xcc]
  # 依照x找到的位置去找對應的y的位置
  yc =[]
  for i in range(len(xj)):
  ycc=(y_center[x_center.index(xj[i])]+y_center[x_center.index(xi[i])])/2
  yc= yc+[ycc]


  plt.figure(figsize=(8,6))
  plt.imshow(img)
  for gg in range(len(xj)):
  plt.scatter(xc[gg],yc[gg],marker= '*',c='r',s= 20)  
# 若沒到三個輪廓 或剛好,依樣顯示出來,不過有可能會沒定位到,可以先看圖再修正 曝光參數或輪廓邊界參數
else:
  plt.figure(figsize=(8,6))
  plt.imshow(img)
  for gg in range(len(x_center)):
  plt.scatter(x_center[gg],y_center[gg],marker= '*',c='r',s= 20)    

plt.show()

結果圖:





之前嘗試:
  • 想說findcontour找到的輪廓大多不是正確的,覺得分區塊做篩選又太不智能
所以嘗試了histogram解法,以及直接把照片的pixel轉成list 然後遍歷去找值為1的位置然後統計數量 最高的即為需求點。 不過兩者共通的毛病都是 運算量大導致運算速度過慢 最後放棄,仍然以findcontour為主,只是後來篩選方式就如我上面的原始碼依樣,設立圓周邊界需求,然後兩兩比較。
下面是之前嘗試的解法,雖然不實用但還是做些紀錄:

img = mpimg.imread('circleCenter2.png') # float32
pp= skimage.img_as_float(img) # 轉 float64 ,(720, 1280, 4) ; signal range:0~1
# pp2= skimage.img_as_ubyte(pp) # 轉u8-bit int ; signal range: 0~255
# print pp2.dtype

gamma= 100
mag_signal =50
itest= (pp)
img2 = (itest)**gamma
img2[0:100,:,:]=0
img2[600:720,:,:]=0
l = img2[:,:,0] # [x,y,channel] channel:0,1,2
#plt.imshow(l,'gray')

plt.figure()
aspectRatio = 6
gs = gridspec.GridSpec(aspectRatio,aspectRatio)

ax1 = plt.subplot(gs[0,:-1])
ax2 = plt.subplot(gs[1:,:-1])
ax3 = plt.subplot(gs[1:,-1])
plt.subplots_adjust(wspace=0.02, hspace=0.02)


tp=[]
xl=np.ravel(l)
for i in range (len(np.ravel(l))):
  if xl[i]>0.5:
  if i<1280:
  i=i
  else:
  i=(i%1280)
  tp= tp+[i]

ax1.hist(tp, bins= 40, ec='green', fc='none', histtype='bar')
ax2.imshow(l,'gray')
#ax3.hist(y, bins =360, ec='green', fc='none', histtype='step', orientation='horizontal')

結果圖:





img = mpimg.imread('circleCenter2.png') # float32
pp= skimage.img_as_float(img) # 轉 float64 ,(720, 1280, 4) ; signal range:0~1
# pp2= skimage.img_as_ubyte(pp) # 轉u8-bit int ; signal range: 0~255
# print pp2.dtype

gamma= 100
mag_signal =50
itest= (pp)
img2 = (itest)**gamma
img2[0:100,:,:]=0
img2[600:720,:,:]=0
l = img2[:,:,0]*mag_signal # [x,y,channel] channel:0,1,2
#plt.imshow(l,'gray')

plt.figure()
aspectRatio = 6
gs = gridspec.GridSpec(aspectRatio,aspectRatio)

ax1 = plt.subplot(gs[0,:-1])
ax2 = plt.subplot(gs[1:,:-1])
ax3 = plt.subplot(gs[1:,-1])
plt.subplots_adjust(wspace=0.02, hspace=0.02)


binSize = 2
x1= np.arange(1280)
x=[]
for _ in range(720):
  x= (np.append(x,x1))
y= np.ravel(l)

y1= np.arange(720)
yy=[]
for _ in range(1280):
  yy= (np.append(yy,y1))
xx= np.ravel(l.T)


ax1.plot(x,y,lw=0.01,alpha=0.5,c='k')
ax2.imshow(l,'gray')
ax3.plot(xx,yy,lw=0.01,alpha=0.5,c='k')





這封郵件來自 Evernote。Evernote 是您專屬的工作空間,免費下載 Evernote

Services

What can I do


Branding

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Web Design

Quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Donec sit amet venenatis ligula. Aenean sed augue scelerisque.

Graphic Design

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident.

Development

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident.

Photography

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. Donec sit amet venenatis ligula. Aenean sed augue scelerisque, dapibus risus sit amet.

User Experience

Quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Donec sit amet venenatis ligula. Aenean sed augue scelerisque, dapibus risus sit amet.

Contact

Get in touch with me


Adress/Street

12 Street West Victoria 1234 Australia

Phone number

+(12) 3456 789

Website

www.johnsmith.com