We present the results of the first extensive mid-infrared ( IR ) imaging survey of the \rho Ophiuchi embedded cluster , performed with the ISOCAM camera on board the ISO satellite . The main \rho Ophiuchi molecular cloud L1688 , as well as the two secondary clouds L1689N and L1689S , have been completely surveyed for point sources at 6.7 \mu m and 14.3 \mu m. A total of 425 sources are detected in \sim 0.7 deg ^ { 2 } , including 16 Class I , 123 Class II , and 77 Class III young stellar objects ( YSOs ) . Essentially all of the mid-IR sources coincide with near-IR sources , but a large proportion of them are recognized for the first time as YSOs . Our dual-wavelength survey allows us to identify essentially all the YSOs with IR excess in the embedded cluster down to F _ { \nu } \sim 10–15 mJy . It more than doubles the known population of Class II YSOs and represents the most complete census to date of newly formed stars in the \rho Ophiuchi central region . There are , however , reasons to believe that several tens of Class III YSOs remain to be identified below L _ { \star } \sim 0.2 \mbox { L$ { } _ { \odot } $ } . The mid-IR luminosities of most ( \sim 65 % ) Class II objects are consistent with emission from purely passive circumstellar disks . The stellar luminosity function of the complete sample of Class II YSOs is derived with a good accuracy down to L _ { \star } \sim 0.03 \mbox { L$ { } _ { \odot } $ } . It is basically flat ( in logarithmic units ) below L _ { \star } \sim 2 \mbox { L$ { } _ { \odot } $ } , exhibits a possible local maximum at L _ { \star } \sim 1.5 \mbox { L$ { } _ { \odot } $ } , and sharply falls off at higher luminosities . A modeling of the luminosity function , using available pre-main sequence tracks and plausible star formation histories , allows us to derive the mass distribution of the Class II YSOs which arguably reflects the initial mass function ( IMF ) of the embedded cluster . After correction for the presence of unresolved binary systems , we estimate that the IMF in \rho Ophiuchi is well described by a two-component power law with a low-mass index of -0.35 \pm 0.25 , a high-mass index of -1.7 ( to be compared with the Salpeter value of -1.35 ) , and a break occurring at \mbox { $M _ { \mathrm { flat } } $ } = 0.55 \pm 0.25 \mbox { M$ { } _ { \odot } $ } . This IMF is flat with no evidence for a low-mass cutoff down to at least \sim 0.06 \mbox { M$ { } _ { \odot } $ } .