Machine vision company Cognex Corporation (CGNX -0.08%) has had a difficult year, but somehow the stock is up nearly 17% at the time of writing. What's going on, and has the rally in the share price got ahead of itself in the last few months? Let's take a closer look.

Cognex going into 2020

The company started the year off after a difficult 2019, caused by a slowdown in spending from key end markets like consumer electronics and automotive -- end markets responsible for around half of Cognex's sales.

For reference, the company's machine vision systems help manufacturers monitor, control, and guide automated processes like automotive production and consumer electronics manufacturing. The weakness in consumer electronics in 2019 was largely due to a slowdown in capital spending on smartphones, and capital spending in automotive was negatively impacted by falling global automotive sales. As such, Cognex's revenue declined in 2019.

Warehouse automation in action.

Strong demand for machine vision in the logistics industry is helping support Cognex as automotive demand remains weak. Image source: Getty Images.

However, going into 2020 the hope was that Cognex's automotive demand would start to improve in line with a bottoming in auto production, and consumer electronics would get a boost from 5G-related devices. Meanwhile, the company's fast-growing logistics sales (largely e-commerce warehouses) would continue to support the company alongside growth in other, smaller, industrial verticals such as life sciences, pharmaceuticals, food and beverage.

Unfortunately, the COVID-19 pandemic had other ideas, and Wall Street analysts were forced to scale back expectations for revenue growth in 2020 -- consumer electronics and automotive growth expectations were both reduced. As such, sales in 2020 are now expected to improve slightly from 2019, but still be significantly below the $806 million in 2018.

Cognex revenue.

Data source: Cognex presentations.

Where Cognex is now

The good news from the company's recent second-quarter earnings report was that management called out an improvement in its consumer electronics- and logistics-based revenue. Both end markets are expected to grow strongly in the third quarter. Meanwhile, according to CEO Rob Willett on the earnings call, some of its "other markets" "are performing reasonably well and showing some growth."

However, according to Willett, the problem area in 2020 "is the automotive market, which was our largest market last year, and it looks weak." Frankly, it's hardly surprising given that other industrials such as 3M and MSC Industrial reported acute weakness in automotive as well.

Willett noted that automotive revenue fell 40% year-over-year in the second quarter, and "it continues to look weak worldwide, including spending even on electric vehicles, not really showing the strength we might have expected." Willett believes Cognex's automotive markets won't get back to "the kind of solid 10% growth that we've become used to over the past few years" until the middle of 2021.

Growth prospects

Cognex is a growth stock, and, trading at nearly 60 times forward earnings expectations, it's definitely priced as one. However, the key question is what kind of growth can investors expect in the future? Is it enough to justify the valuation?

Focusing on Cognex's key end markets (logistics, consumer electronics, and automotive), there's reason to be positive. E-commerce warehousing spending remains very strong, with Honeywell's Intelligrated (warehouse automation) reporting a whopping 300% increase in orders in the second quarter. That bodes well for future orders of Cognex's machine vision solutions.

Automotive production is expected to significantly improve in 2021, and that's likely to spur the kind of investment in new car models and technologies that drives Cognex's sales.

Finally, the most controversial area is likely to be the consumer electronics industry, which appears to be tied to capital spending in the smartphone industry in recent years -- not surprising, considering that its largest customer is Apple. The consumer electronics giant was responsible for 20%, 15% and less than 10% of revenue in 2017, 2018 and 2019, respectively. There's certainly potential for wider-scale adoption of machine vision in the broader consumer electronics industry, but recent history suggests it tends to be a volatile end market for Cognex.

Is Cognex a good value?

Putting it all together, it's clear that Cognex remains an exciting growth stock, but trading at 82 times current earnings and nearly 60 times forward earnings it's hard to argue that the market isn't being generous in its growth assumptions for the company.

To justify such a valuation, investors are going to need to see some more consistent performance from the consumer electronics end market in the future, and in the current environment that's not a given. As such, Cognex's stock looks fully valued right now.