<PAGE>
                                                                     EXHIBIT 5.1



                                 August 1, 2002



IRIDEX Corporation
1212 Terra Bella Avenue
Mountain View, CA  94043

        RE:  REGISTRATION STATEMENT ON FORM S-8

Ladies and Gentlemen:

        We have examined the Registration Statement on Form S-8 to be filed by
you with the Securities and Exchange Commission on or about August 1, 2002 (the
"Registration Statement") in connection with the registration under the
Securities Act of 1933, as amended (the "Act") of 300,000 additional shares of
Common Stock available for issuance under your 1998 Stock Plan and 30,000
additional shares of Common Stock available for issuance under your 1995
Employee Stock Purchase Plan. Such shares of Common Stock are referred to herein
as the "Shares," and such plans are referred to herein as the "Plans." As your
counsel in connection with this transaction, we have examined the proceedings
taken and are familiar with the proceedings proposed to be taken by you in
connection with the issuance and sale of the Shares pursuant to the Plans.

        It is our opinion that, upon the completion of the proceedings to be
taken prior to issuance of the Shares pursuant to the Prospectus constituting
part of and incorporated by reference into the Registration Statement on Form
S-8 and upon completion of the proceedings to be taken in order to permit such
transactions to be carried out in accordance with the securities laws of the
various states where required, the Shares, when issued and sold in the manner
referred to in the Plans and the agreements which accompany the Plans, will be
legally and validly issued, fully paid and nonassessable.

        We consent to the use of this opinion as an exhibit to the Registration
Statement, and consent to the use of our name wherever appearing in the
Registration Statement, including the Prospectus constituting a part thereof,
and any amendments thereto.

                                        Very truly yours,

                                        WILSON SONSINI GOODRICH & ROSATI
                                        Professional Corporation

                                        /s/ WILSON SONSINI GOODRICH & ROSATI
                                            PROFESSIONAL CORPORATION



