Do you want to laser branch? I want to let you. I will teach you how to branch a laser that anyone can do.
Target audience You can buy a laser, but you find it difficult to process with just one laser
It's easy to write. Please forgive me for the lack of rigor.
You are trying to branch the laser. The laser is light. Light is a wave. Since it is a wave, it has amplitude and phase. The optical lens has a Fourier transform effect. In short, think that the light that has passed through the lens will be in a Fourier transformed state. (If you are interested, this is easy to understand: https://hoshistar81.jp/pdf/111111doc.pdf).
You know the amplitude of the original laser. Also, it has already been decided what kind of amplitude the laser should have after passing through the lens.
Now you shoot the laser in some phase and hope it's in the desired shape once it's passed through the lens. However, I do not know what phase the laser should be in to achieve the desired shape (amplitude) after passing through the lens. There is a ** iterative Fourier transform method ** as a way to know this ** "what phase should be" **.
The information you have now
--Laser amplitude before passing through the lens --Laser amplitude after passing through the lens (shape of your choice) --The fact that passing through a lens is equivalent to the Fourier transform
is.
Now, let a be before passing through the lens and b be after passing through the lens. Then, it can be said that b seen from a is after the Fourier transform, and a seen from b is after the inverse Fourier transform.
Set the amplitude in region a to the original laser amplitude. The phase is set with some random value (only at the beginning). Fourier transform it (lens transmission from a to b). Set the amplitude in the b region to the desired amplitude. The phase is set with the passed value as it is. Inverse Fourier transform (lens transmission from b to a). Set the amplitude in region a to the original laser amplitude. The phase is set with the passed value as it is.
Do this all the time. Then, the phase is optimized according to the amplitude before and after the Fourier transform. This is the Fourier iterative method. As the name suggests, it's a simple method that simply repeats the Fourier transform and the inverse transform.
If you implement this in Python, it will look like the following code.
import cv2
import numpy as np
import matplotlib.pyplot as plt
def check_uniformity(u_int, target):
u_int = u_int / np.max(u_int)
maxi = np.max(u_int[target==1])
mini = np.min(u_int[target==1])
uniformity = 1 - (maxi-mini)/(maxi+mini)
print("Uniformity:", uniformity)
return uniformity
def normalization(origin):
maxi = np.max(origin)
mini = np.min(origin)
norm = ((origin - mini) / (maxi - mini))
return norm
def hologram(phase):
phase = np.where(phase<0, phase+2*np.pi, phase)
p_max = np.max(phase)
p_min = np.min(phase)
holo = ((phase - p_min)/(p_max- p_min)) * 255
holo = holo.astype("uint8")
return holo
def reconstruct(norm_int):
rec = norm_int * 255
rec = rec.astype("uint8")
return rec
def main():
target = cv2.imread("img/target.bmp",0)
cv2.imshow("target",target)
cv2.waitKey(0)
height, width = target.shape[:2]
target = target / 255
laser = 1
phase = np.random.rand(height, width)
u = np.empty_like(target, dtype="complex")
iteration = 20
uniformity = []
for num in range(iteration):
u.real = laser * np.cos(phase)
u.imag = laser * np.sin(phase)
#-------lens---------
u = np.fft.fft2(u)
u = np.fft.fftshift(u)
#-------lens---------
u_abs = np.abs(u)
u_int = u_abs ** 2
norm_int = normalization(u_int)
uniformity.append(check_uniformity(u_int,target))
phase = np.angle(u)
u.real = target * np.cos(phase)
u.imag = target * np.sin(phase)
#-----lens---------
u = np.fft.ifftshift(u)
u = np.fft.ifft2(u)
#-------lens---------
phase = np.angle(u)
holo_name = "holo"
rec_name = "rec"
holo = hologram(phase)
cv2.imwrite("img/{}.bmp".format(holo_name), holo)
cv2.imshow("Hologram", holo)
cv2.waitKey(0)
rec = reconstruct(norm_int)
cv2.imwrite("img/{}.bmp".format(rec_name), rec)
cv2.imshow("Reconstruction", rec)
cv2.waitKey(0)
plt.figure(figsize=(8,5))
plt.plot(np.arange(1,iteration+1),uniformity)
plt.xlabel("Iteration")
plt.ylabel("Uniformity")
plt.ylim(0,1)
if __name__ == "__main__":
main()
Here, suppose that the laser before the lens transmission has a uniform intensity, and that the laser after the lens transmission should branch to 10 × 10 points as shown in the image ( Original image link ).
The following phase image can be obtained by executing the program under the above conditions.
This is called ** CGH (Computer Hologram) **. (Please note that the name hologram is used for other purposes in the field of light. It is very confusing.)
This CGH is displayed on a device called ** SLM ** that can control the phase of light as shown in the image, and when the laser is applied to it and passed through the lens, the laser branches into the shape that I wanted. There will be. Troublesome processing can be completed in an instant!
By the way, rec on the program is the result of reconstruction on the simulation when this CGH is used. Uniformity represents the intensity uniformity of each branched point of this reconstruction result. I wanted all the lasers branched into 10x10 to have the same intensity this time, but if you look at the Uniformity and the reconstruction results, you can see that this is not the case (Uniformity after a certain number of repetitions). Will be saturated). In fact, using the created CGH does not make it as uniform as the reconstructed image.
Although not introduced this time, various methods such as ** weighting algorithm ** have been devised to improve this uniformity. If you are interested, please check it out as well.
You who had to draw a number of lines with a laser or had to make a lot of holes, which was a hassle! By all means, use the CGH obtained by this Fourier iterative method to branch the laser!
By the way, I don't have any equipment, but those who want to try this method! Is the laser 30 million? Is SLM 300,000 yen? It should have been sold for about, so please buy it and give it a try! That concludes my article!
If you read this article and thought it was "interesting" or "learned", please leave a comment on Twitter, facebook, or Hatena Bookmark! In addition to the blog articles, the official DeNA Twitter account @DeNAxTech also publishes presentation materials at various study sessions. Please follow us!
Recommended Posts