Question: I need to load an image into my program. I want to allow the user to browse for any image s/he wishes and open. I need a function which asks the user to browse and select the desired file and can generate a string containing the complete path of that particular file.

Answer: 
You don't say on which platform you are working.

If you are working on Windows, the fastest way is to use the OPENFILENAME structure with the GetOpenFileName function as shown in this example: <http://msdn.microsoft.com/en-us/library/ms646829(v=vs.85).aspx#open_file>. You can then use cvLoadImage with the lpstrFile member of the structure.

On linux, I would recommend using Qt and the QFileDialog. Note that you can also use Qt on Windows.
Use fltk, namely: <http://seriss.com/people/erco/fltk/#Fl_File_Browser>