Exhibit 23 CONSENT OF INDEPENDENT ACCOUNTANTS We consent to the incorporation by reference in this Registration Statement of Cognex Corporation on Form S-8 of our reports dated January 23, 1998, on our audits of the consolidated financial statements and financial statement schedule of Cognex Corporation as of December 31, 1997 and 1996, and for each of the three years in the period ended December 31, 1997, which reports are included in the Annual Report on Form 10-K of Cognex Corporation for the year ended December 31, 1997. /s/ PricewaterhouseCoopers, LLP PricewaterhouseCoopers, LLP Boston, Massachusetts August 6, 1998