'STUDY > Python' 카테고리의 다른 글

[Python] Reserved Words  (0) 2016.08.16
[Python] create name in Python  (0) 2016.08.16



#include <opencv2/opencv.hpp>

using namespace cv;


#include <iostream>

using namespace std;


#define STR_WINDOW "Window"


void mouseEvent(int evt, int x, int y, int flags, void *param){

Mat *img = (Mat *)param;

if ( evt == CV_EVENT_LBUTTONDOWN ){

printf("(%04d, %04d) : %03d, %03d, %03d\n", x, y,

(int)(*img).at<Vec3b>(y,x)[0],

(int)(*img).at<Vec3b>(y,x)[1],

(int)(*img).at<Vec3b>(y,x)[2]);

}

}


int main(){

Mat image = imread( your image path );

if ( image.empty() ){

cout << "Error loading the image" <<endl;

return -1;

}


namedWindow(STR_WINDOW, 1);

setMouseCallback(STR_WINDOW, mouseEvent, &image);

imshow(STR_WINDOW, image);


waitKey(0);

return 0;

}


<< result >>

    • and
    • as
    • assert
    • break
    • class
    • continue
    • def
    • del
    • elif
    • else
    • except
    • exec
    • finally
    • for
    • from
    • global
    • if
    • import
    • in
    • is
    • lambda
    • Not
    • or
    • pass
    • print
    • raise
    • return
    • try
    • while
    • with
    • yield


'STUDY > Python' 카테고리의 다른 글

파이썬 디버깅(Debugging python)  (0) 2016.09.28
[Python] create name in Python  (0) 2016.08.16

+ Recent posts