In 2006, Hal Wilson, a Raleigh entrepreneur, was in his office troubleshooting a problem when suddenly he had an idea.

Wilson, who launched his company, Cyber Imaging Solutions, in 1996, had already gained renown for developing a system allowing beauty salon customers to compare hairstyles “virtually,” by uploading headshots to computer screens and dropping and dragging digital coiffures on top. Now he wanted to devise a system of shopping for eyeglass frames at home using a similar method.

Unlike haircuts, however, this endeavor posed a challenge: customizing each pair of glasses to match the unique dimensions of a person’s face. Some opticians were using sonar-based devices to digitally measure the distance between a customer’s pupils the key calibration for glasses fitting. But the equipment required face-to-face appointments, and its precision was dubious.

An accountant by trade, Wilson was discussing these limitations over the phone with his coder, Jim Welch, a Duke-educated engineer. “I said, why don’t I go to the Internet and print out a millimeter ruler?” Wilson recounted earlier this week. “All I’d have to do is stick it on my forehead.”

Wilson remembers printing a paper ruler and taping it to a cardboard box. He drew two dots below it to represent pupils, snapped a photo and uploaded it. He had a pixel-by-pixel scale by which to measure pupillary distance, and he didn’t need expensive equipment to get it.

Meanwhile, 800 miles away in Chicago, a young salesman named Brad Kirschner was working for his family in the safety-goggles business. He would later learn of Wilson’s invention, and the two would form a partnership.

It would end badly.

Last month Wilson, 51, sued Kirschner, 36, for patent infringement and fraud, accusing him of scheming to fleece him of his source code. After years of software development, Wilson says, his $4.5 million royalty-based investment with Kirschner had vanished.

Kirschner contends that he didn’t steal Wilson’s idea, but simply created a program that happens to be similar.

To use an architectural analogy, it’s as if Kirschner used Wilson’s blueprint to build an identical building, then added a few different pipes and heaters.

“Our only asset is our intellectual property, and we’ll go to the end of the Earth to protect it,” Wilson said.

A college dropout, Kirschner spent his early career schlepping to manufacturing plants with a suitcase full of safety goggles and paperwork, accompanied by an optician to take measurements, according to Wilson’s complaint. (Kirschner didn’t respond to several messages requesting comment.)

Kirschner and Wilson met at a 2008 trade show. Kirschner was intrigued by Wilson’s new “CyberEyes Virtual Try-On” software; Wilson, who was still relying on expensive sonar devices to measure pupillary distances, wanted to enter the safety eyewear market.

Kirschner launched his own company, Eyelation, in 2009. He and Wilson signed a contract stating that Cyber would own all technology, intellectual property and spinoff ideas related to the software. Cyber would make money based on royalty and sublicensing payments.

Wilson’s team farmed much of the work out to programmers in Pakistan, requesting more time and seed money from Kirschner, who voiced concerns. “These delays could have potentially hurt us badly,” he wrote in an email.

Nevertheless, the two men agreed on a kiosk system whereby manufacturing-plant employees could shop for frames using the drop-and-drag method. Each kiosk would dispense a rectangular strip of paper with two focal points on either side, mimicking a ruler. Employees would paste it on their forehead and upload a photo to the kiosk’s computer, which would then take a measurement using the focal points as guideposts. Once an order was placed, a pair of glasses would arrive by mail.

In April 2010, Wilson applied for a patent titled “Method and Systems for Measuring Interpupillary Distance,” based on the forehead strip. It included a section for customizing eyeglasses. He mentioned the application to Kirschner, who responded by email, “That’s cool about the patent.”

Patent infringement lawsuits have spiked recently, particularly those related to software. These so-called “patent trolls” reportedly accounted for more than half of the 4,000 civil actions filed in the U.S. last year.

Some experts have called for software patents to be outlawed, since they’re often overly broad and have short lifespans. Others suggest it’s impossible to create software that doesn’t infringe another patent.

Nevertheless, some infringement suits, such as Wilson’s, are credible. The key factor is functionality, says Raleigh patent attorney David Kalish. “It doesn’t matter how you say it. If it does the same thing it falls within the scope of my patent.”

Source code, however, isn’t typically patented but copyrighted, often concurrently with patent applications. “I tell clients, don’t give out your source code,” Kalish says. “It’s proprietary, and you sure as heck don’t want to be passing it around.”

But that’s what Wilson did.

In June 2010, Cyber delivered the software to Eyelation, more than a year past schedule. Kirschner seemed satisfied, writing in an email: “It is amazing how far we have come given all the challenges we have run across.”

A month later, unbeknownst to Wilson, Kirschner filed his own patent application, “Method of Providing Prescription Safety Eyewear,” also based on the forehead strip. Seventeen of 18 screenshots in the application were identical to Cyber’s.

In October 2010, Eyeleation’s kiosks debuted at the National Safety Conference. Kirschner quickly signed his first client, Solo Cup, and by February 2011, Eyelation kiosks were installed at several U.S. and international plants.

Kirschner hired two computer programmers and requested a copy of the software’s source code from Wilson “so that we have the flexibility to make revisions as needed.” Wilson provided it, along with a login and password to Cyber’s database.

In 10 months, Eyelation experienced a 566 percent growth in orders. According to Wilson’s complaint, it had become a million-dollar company.

“We were dancing,” recalled Wilson, who envisioned royalty payouts.

But in October 2011, 10 months after the first kiosk was installed, Wilson received a letter from Kirschner’s lawyer. “Eyelation has developed new software which has been copyrighted and is no longer using the original software that you jointly developed,” it said.

The royalties stopped coming in.

Compounding the situation is a fundamental disagreement, common to patent litigation: Both men claim to have come up with the idea of the forehead strip. (In retrospect, Kirschner says that his name should have been included on Wilson’s interpupillary patent application.)

Last month Wilson received his patent from the U.S. Patent Office; Kirschner’s application is pending.

Since the two parties entered arbitration, Wilson has launched his own safety-wear company, Eyeweb. Kirschner accuses Wilson of stealing his kiosk-based model in an attempt to destroy his company. His lawyers have retained a software expert, Stuart Soffer, who contends that Eyelation’s code, though similar, is not a copy or derivative of Cyber’s.

Wilson says he doesn’t regret giving Kirschner the source code.

“He could get Bill Gates to rewrite the program in any language he wants, but it doesn’t affect us because the contract says we own any derivative. It couldn’t be more clear,” he said.

But two years ago Wilson did have reservations pertaining to a separate set of code.

“We have never licensed our source code so we are a little apprehensive,” he wrote in an email to Kirschner. “We have to live with the consequences for many years and many unknown scenarios so we need to do our homework.”

“I am asking for the code as a courtesy,” Kirschner replied, “not as some scheme to cut you out.”

This article appeared in print with the headline “The truth is in the eye of the patent holder.”