Created
August 20, 2016 16:13
-
-
Save berak/d36ea1a215aa2a33ddb1ca64d6aed863 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "opencv2/opencv.hpp" | |
| #include <iostream> | |
| using namespace cv; | |
| using namespace std; | |
| Mat im_hsv; | |
| void pick_color(int e, int x, int y, int s, void *) | |
| { | |
| if (e==1) | |
| { | |
| cerr << im_hsv.at<Vec3b>(y,x) << endl; | |
| } | |
| } | |
| int main( int argc, char** argv ) | |
| { | |
| namedWindow("blue"); | |
| setMouseCallback("blue", pick_color); | |
| String c_in = "."; // check a whole folder. | |
| if (argc>1) c_in = argv[1]; | |
| vector<String> fn; | |
| glob(c_in, fn, true); | |
| for(size_t i=0; i<fn.size(); i++) | |
| { | |
| Mat im_bgr = imread(fn[i]); | |
| if (im_bgr.empty()) continue; | |
| cvtColor(im_bgr, im_hsv, COLOR_BGR2HSV); | |
| imshow("blue", im_bgr); | |
| waitKey(); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment