The Optics Company

By Tsai, Wen-Kai - August 22, 2019

I was hired as an software engineer in this optical industry. There were three main things I've contributed to this company:

  1.  built an integral application that was then massively used in their product line for quality control, including resolution, distortion and uniformity calibration.
  2.  came up with my own theories with the support of mathematics for calibrations.
  3.  collected a bunch of data from some sort of meters and made auxiliary functions to help mechanical team to analyze them 
And here's what I've learned in those two years: 
  • a thorough understanding in OOP and designed patterns
  • advanced C# coding skill 
  • image processing methods
  • building a comprehensive application

My job was to assure the quality of image using image processing coupled with motors and cameras to calibrate them.

The quality of the image

As an optical company, the quality of the image is a crucial variable to our product. However, the lens of the projector will inevitably distort the light beam to certain degree even though the optics team had tried their best to eliminate this effect through different composition of the lens. To correct the distortion, there is a need for software team to measure the degree of distorted images and calibrate them to an acceptable range.

The role I was playing

The calibration contains 3 parts: resolution, distortion and the uniformity. The time I got into this company, they already had some solutions to deal with these problems. However, as the demands become strict to our product, the assessing methods were screaming for an update.


1. Resolution: improved the reliability of testing result
I first introduced a digital method to gave out a value to quantify the resolution; before this they used to adjust the resolution with their bare eyes. I also took advantage of some signal processing approach to substitute the old way of calculation and thus improved the reliability of this value.  This approach let me get promoted within less than one year.

2. Distortion: calibrated the error to less than one pixel

This one was even trickier since I have to work together with mechanical team to establish this brand-new system. The whole process took us almost a year to reach an acceptable outcome -- a less-then-one-pixel error. For me, the difficulties came from those defocus pixels whose shape were bizarre and brightness were so dim in comparison to there background noise. I first came up with some ideas to filter out those noise to recognize pixels, but either the processing time were unacceptably long or the algorithm was not general enough to fit some tougher situations. I even considered using machine learning to do so, but fortunately, after doing some research, I found out there was a simple way to solve this problem by adopting morphology, and it worked extremely well.

After conquering the obstacle in recognizing pixels, I made an auto-calibration system which process was simple to monitored and the result were being visualized.
A visualized distortion data page that I made in my application.
 I could then analyze these data to quantify the level of distortion and the correction of each points.


To create an automatic system...
During the development, I proposed two mathematical models and their formulae to solve certain problem: one was an optimization approach titled "find the most-fit rectangle given four arbitrary points with respect to a center inside the region of those points.", and the other was called "evenly segment an irregular quadrilateral by transforming it into a unit square".  The former allowed me to calibrate the image better, while the latter helped me to measure the uniformity of the projected that I will explain below.

3. Uniformity: improved the reliability of calibration

Uniformity measurement required to use a power meter to traverse the whole image. After finding the boundary, which was represented as an irregular quadrilateral, I would then have to evenly segment it. The mathematical tool gave me a more precise coordinate for measurement.

Being promoted 

After all of these were done, I was promoted less within less then one year. I spent some time on reconstructing my program to make it more expendable and were able to merge all the functions into it as I had promised to my supervisor when promoted. I successfully made a comprehensive application that is now massively used in their product line.

All the three points above involved vision-motion technique to materialize. Although the motors, cameras and meters were different for different measurement, I figured out a structure that merge all the functions within a single comprehensive application, and it was easy to add a new device, say a new type of the camera, without changing anything.
The concept behind this was the interface, and the structure had a name called "the strategy design pattern". As long as the device class shared the same interface and inherited from the same abstract class, to add different devices to my application was not a big deal.

a glimpse of my integral application


Good relationship with my coworkers

In my opinion, a good relationship with coworker is just as important as one's creativity and productivity. I prefer to working at a welcoming and cooperative working environment.

Sometimes we threw a party after work
I went to Japan with my colleagues on every golden week (a one-week off policy for employees to have a change to go relax once a year.)

(left) a Mario kart ride on the hustle and hustle Tokyo road;
(right) scuba diving in Okinawa

They even held a farewell party for me when I left the company. We went to karaoke to sing whole night.

On the last day of  my work, my coworkers thew a farewell party for me. 
It was a pleasure to have my supervisor joined us as well. We had a great time.
Why did I decide to leave the company?

Actually, I had already decided to study abroad before I entered this company. I just had not made up my mind pertaining to what master should I choose. I was once stuck in a dilemma of making a choice between Mechanical Engineering and Computer Science. Mechanical engineering, on the one hand, gave me a deep insight and different interpretation in mathematics and physics, which I would love to continue studying; on the other hand, coding made things alive -- we could interact with things, and they gave us response. Luckily, the dilemma was solved after the two reasons below:

1. One major obstacle that I had conquered 

The decision had not been made until I encountered a puzzle in image processing. A simple version of it was to find the intersection of two lines projected by the projector using image processing. It was not as easy as it might sound like. I could not simply use the Hough Transform to find two lines because, as I mentioned earlier, the projector might be defocus and pixels would be blurred.  Hough Transform would not be accurate enough.

(left) clear and focused pixels; (right) defocus but acceptable pixels
I came up with an idea to look at numerous vertical and horizontal lines, extracted the data within 0.5 standard deviation, got the peak position and applied linear regression to find the line. In other words, I was able to transform these lines into a bunch of points, and the problem became "find the two lines in those points and then find the intersection out of those lines." And this method worked! The statistic worked out so satisfying that the measured length of the projected image and the theoretical one matched perfectly.

However...
It was simple if the picture contains only two lines. An advanced problem came out with a program required me to extract four lines came from two projectors and find two intersections respectively. The result came out like this:

(left) original image projected by two projectors; (right) processed image with 2 corresponding intersections
2 vertical lines could be overlapped, and so did the 2 horizontal lines. 
The sticking point behind this problem was grouping. I spent nearly a week to figured out a workable solution.

After solving these puzzles, I realize I was lack of the mathematical tools to analyze data: it cost me nearly a week just to find the four lines out of a bunch of points. And actually, except for the software development, what I was dealing with most of the time was a bunch of data.

2. The machine learning competition held by MatLab

One day my friend asked me to join their group to participated in this competition. They were lack of someone who can code. I agreed.

Although we did not win a prize due to the limitation of the hardware (the GoogleNet took us at least 2 days to get a result, not to mention other advanced pretrained networks and their required memory usage), I still got an insight of machine learning. That was a time I feel the almighty of machine learning and craved to learn more.

After made up my mind, I left the company and enrolled in USC to study advanced in MS in Analytics.




  • Share:

You Might Also Like

0 comments