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