EXHIBIT 5

                                                          May 22, 1996
Cognex Corporation
One Vision Drive
Natick, MA 01760

Gentlemen:

         We are general counsel to Cognex Corporation, a Massachusetts 
corporation (the "Company"), and as such counsel we are familiar with the 
corporate proceedings taken in connection with the amendments to the Company's 
1993 Stock Option Plan which were approved by the stockholders on Apri 23, 
1996.  We are also familiar with the registration statement to which a copy of 
this opinion will be attached as an exhibit.

         As such counsel, we have examined the corporate records of the 
Company, including the Articles of Organization, By-laws, stock records, 
minutes of meetings of its Board of Directors and stockholders and such other 
documents as we have deemed necessary as a basis for the opinions herein 
expressed.

         Based upon the foregoing, and having regard for such legal 
considerations as we deem relevant, we are of the opinion that:

         1.       The Company is duly organized and validly existing under 
                  the laws of the Commonwealth of Massachusetts.

         2.       The Company has authorized the issuance of 120,000,000 shares 
                  of common stock, $.002 par value per share and 400,000 shares
                  of Preferred Stock, $.01 par value.

         3.       The outstanding common stock of the Company has been duly 
                  authorized and constitutes validly issued, fully paid and 
                  non-assessable shares of common stock, $.002 par value per 
                  share.

         4.       The shares of common stock issuable pursuant to the Plan, 
                  when issued in accordance with the terms thereof, will be 
                  validly issued, fully paid and non-


Cognex Corporation
May 23, 1996
Page 2
                  assessable shares of capital stock of the Company to which no 
                  personal liability will attach.

         We hereby consent to the filing of this opinion as an exhibit to the 
Registration Statement on Form S-8 and to the reference to us under the caption 
"Interests of Named Experts and Counsel" in the Registration Statement.

                                          Very truly yours,

                                         /s/ Hutchins, Wheeler & Dittmar
                                        Hutchins, Wheeler & Dittmar
                                         A Professional Corporation