I have:
typedef void (*RespExtractor) (const cv::Mat & image, cv::Mat & resp);
virtual void predict_image(const cv::Mat & src,
cv::Mat & img_detect,cv::Size patch_size,
RespExtractor );
void create_hough_features(const cv::Mat & image, cv::Mat & resp, FeatureParams & params = FeatureParams() );
How would i define the RespExtractor to accept a function with default parameters, such i can call:
predict_image(im_in,im_out,create_hough_features);
I tried following, with no succes:
typedef void (*RespExtractor) (const cv::Mat & image, cv::Mat & resp,FeatureParams params, FeatureParams());
Function pointers themselves can't have default values. You'll either have to wrap the call via the function pointer in a function that does have default parameters (this could even be a small class that wraps the function pointer and has an operator()
with default paremeters), or have different function pointers for the different overloads of your functions.
Default parameters aren't part of the function signature, so you can't do this directly.
However, you could define a wrapper function for create_hough_features
, or just a second overload that only takes two arguments:
void create_hough_features(const cv::Mat & image, cv::Mat & resp, FeatureParams & params) {
// blah
}
void create_hough_features(const cv::Mat & image, cv::Mat & resp) {
create_hough_features(image, resp, DefaultParams());
}