| 181 | } |
| 182 | |
| 183 | int main( int argc, char** argv ) |
| 184 | { |
| 185 | // Get default device and setup context |
| 186 | compute::device gpu = compute::system::default_device(); |
| 187 | compute::context context(gpu); |
| 188 | compute::command_queue queue(context, gpu); |
| 189 | |
| 190 | cv::Mat src; |
| 191 | |
| 192 | // setup the command line arguments |
| 193 | po::options_description desc; |
| 194 | desc.add_options() |
| 195 | ("help", "show available options") |
| 196 | ("image", po::value<std::string>(), "path to image file"); |
| 197 | |
| 198 | // Parse the command lines |
| 199 | po::variables_map vm; |
| 200 | po::store(po::parse_command_line(argc, argv, desc), vm); |
| 201 | po::notify(vm); |
| 202 | |
| 203 | //check the command line arguments |
| 204 | if(vm.count("help")) |
| 205 | { |
| 206 | std::cout << desc << std::endl; |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | //check for image paths |
| 211 | if(vm.count("image")) |
| 212 | { |
| 213 | // Read image with OpenCV |
| 214 | src = cv::imread(vm["image"].as<std::string>(), |
| 215 | CV_LOAD_IMAGE_COLOR); |
| 216 | if(!src.data){ |
| 217 | std::cerr << "Failed to load image" << std::endl; |
| 218 | return -1; |
| 219 | } |
| 220 | calculateHistogramUsingCL(src, queue); |
| 221 | cv::imshow("Image", src); |
| 222 | cv::waitKey(0); |
| 223 | } |
| 224 | else |
| 225 | { |
| 226 | std::cout << desc << std::endl; |
| 227 | return 0; |
| 228 | } |
| 229 | return 0; |
| 230 | } |
nothing calls this directly
no test coverage detected