tags:

views:

30

answers:

1

I have a web server which receives an image from a client and do some SIFT based image matching at the server (win32) end send the result back to the client.

Receiving image is done using apache and php. SIFT based processing functions are in C++. Now I want to parse the data in php variable $image (the variable which holds the received image) to the main function of C++ program as an argument.

Then I want to take the result back to php code. Result is the matching number of points (integer value)

How can I do this? Thank you

+1  A: 
  • save the image to a file. you may use file_put_contents...
  • use system('cpp_program "/path/to/image"') function to run the program.(or does it take image data as an argument? that would be strange). these functions return the console output of the run program.

that's what i would do:

$tmpFileName = tempnam();
file_put_contents($tmpFileName, $image);
$cppProgramResult = intval(trim(system('cpp_program "'.$tmpFileName.'"')));
kgb