Ask Your Question

rookie's profile - activity

2016-02-28 23:43:58 -0500 received badge  Critic (source)
2016-02-28 11:00:57 -0500 commented question Selecting and drawing points on image

Thanks, I just saw you answer. I think I've done something similar. Now, I suspect my resize function is causing some trouble. When I don't use resize and use an image with smaller resolution, it seems to work fine :s or that the error minimizes so it becomes hard for me to distinguish.

2016-02-28 03:16:27 -0500 commented question Selecting and drawing points on image

I have edited the code to make things more clear. I somehow deleted the imageFlag line while editing. I use the flag to transfer selection to the next image where i select the corresponding point. There is a similar mouse event which select a point and draws the circle and sets the imageFlag to 1.

2016-02-28 00:58:19 -0500 asked a question Selecting and drawing points on image

I am manually selecting points on an image and drawing a circle at those points. However, the circles are not drawn at the point I click on the image, but above it. I'm not sure what's going wrong.

int radius = 4;
int thickness = 2;
int lineType = 7;
int shift = 0;

void mouseEventOne(int event, int x, int y, int, void* param){

    if(event == EVENT_LBUTTONDOWN) {
        Point2f* pt =  (Point2f*)param;
        pt->x =x;
        pt->y =y;
        if (imageFlag == 1 && one.size() < NUM_POINTS) {
            if (pt->x != 0 && pt->y != 0) {
                one.push_back(Point2f(pt->x, pt->y));
                       Point2f(pt->x, pt->y),
                       Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255)),
                imageFlag = 2;


int main(int argc, char** argv) {

    char* imagePathOne = argv[1];
    char* imagePathTwo = argv[2];

    imageOne = imread(imagePathOne, 1);
    imageTwo = imread(imagePathTwo, 1);

    if(argc != 3 || ! ||!{
        printf("No image data.\n");
        return -1;
    resize(imageOne, imageOne, imageOne.size()/3, 0, 0, INTER_CUBIC);
    resize(imageTwo, imageTwo, imageTwo.size()/3, 0, 0, INTER_CUBIC);
    Point ptOne, ptTwo;
    namedWindow("ImageOne", 0);
    namedWindow("ImageTwo", 0);

    setMouseCallback("ImageOne", mouseEventOne, (void *) &ptOne);
    setMouseCallback("ImageTwo", mouseEventTwo, (void *) &ptTwo);
2016-02-24 03:54:31 -0500 received badge  Scholar (source)
2016-02-24 03:54:30 -0500 received badge  Scholar (source)
2016-02-24 03:54:30 -0500 received badge  Supporter (source)
2016-02-24 03:54:28 -0500 commented answer Error: fundamental matrix size overgrowing to 3x9

Oh yes, it does say so. My bad - should've gone through the documentation. Thanks!

2016-02-24 02:56:59 -0500 received badge  Editor (source)
2016-02-24 02:55:59 -0500 asked a question Error: fundamental matrix size overgrowing to 3x9

I am trying to find the fundamental matrix by manually identifying 7 corresponding points in two images and using the findFundamentalMatrix function. However on printing the matrix, it turns out to be 3x9. Seems to be a bug in my code but I cant figure it out.

void mouseEventOne(int event, int x, int y, int, void* param){
 //select points in first image. store in one.

void mouseEventTwo(int event, int x, int y, int, void* param) {
//select points in second image. store in two.
  set flag after 7 points

int main(int argc, char** argv) {

setMouseCallback("ImageOne", mouseEventOne, (void *) &ptOne);
setMouseCallback("ImageTwo", mouseEventTwo, (void *) &ptTwo);

for(;;) {

    if(one.size() == 7 && two.size() == 7 && flag){
        F = findFundamentalMat(one, two, CV_FM_7POINT);
        flag = false;

    imshow("ImageOne", imageOne);
    imshow("ImageTwo", imageTwo);

    char s = (char)waitKey(30);
        case 'q':
            return 0;

Example of F that I get:

[-1.551177784481965e-05, 2.023178297273342e-05, 0.0005375762557272776;
 -1.135972383318399e-05, 3.375254552474079e-05, -0.003613682804598734;
 0.008327856564262326, -0.01695104159607208, 1;
 4.431840798641267e-07, -1.055708293644028e-06, -2.507080893426536e-05;
 4.638855327440553e-06, 4.121047291061634e-06, -0.003793250696015148;
 -0.001440166620559569, -0.000516116119040233, 1;
 -2.981211382612034e-06, 3.513201920256684e-06, 9.568949524556974e-05;
 1.205098346864506e-06, 1.048082229878526e-05, -0.003754710242238103;
 0.0006563331661128546, -0.004043525616809762, 1]
2016-02-23 13:18:25 -0500 received badge  Enthusiast
2016-02-18 11:40:33 -0500 asked a question Build fails with CMake on OSX El Capitan

I upgraded my OpenCV from 2.4.9 to 3.1.0 . I was able to succesfully install it on my machine. But when I try to run a simple sample code, I get this weird error I have no clue to tackle. I have built OpenCV fro source using these CMake configs:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/Applications/opencv-3.1.0/build -D PYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/bin -D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers -D PYTHON2_PACKAGES_PATH=/usr/local/lib/python2.7/site-packages -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON - D OPENCV_EXTRA_MODULES_PATH=/Applications/opencv-3.1.0/opencv_contrib-master/modules ..

The error I get on running a sample program is the following:

cmake . -- OpenCV ARCH: -- OpenCV RUNTIME: -- OpenCV STATIC: ON CMake Warning at /Applications/opencv-3.1.0/cmake/OpenCVConfig.cmake:166 (message): Found OpenCV Windows Pack but it has no binaries compatible with your configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV library. Call Stack (most recent call first):
CMakeLists.txt:10 (find_package)

CMake Error at CMakeLists.txt:10 (find_package): Found package configuration file:


but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be

-- Configuring incomplete, errors occurred!

I have no clue why it says windows binary, when i built it from source for OSX. I somehow suspect that the cmake config file it should be looking at is supposed to the one in the build folder, but I dont know how to fix that. I have tried a clean build multiple times and also tried moving down to 3.0.0 , but in vain. Any help in fixing this is highly appreciated!

2014-11-20 20:14:20 -0500 asked a question Feature detection for optic flow on carpet/patterns/rough surfaces

Hello All,

I am running the optic flow algorithm(LK) using feature points from good features to track(Shi tomasi). However this method for feature detection doesnt seem to work very well when there are repetitve patterns(tiles), rough surfaces(such as roads), carpets. Flow from LK goes haywire in such cases. Can feature detection/flow calculation be improved in some way in atleast rough surfaces using some other method or by using some pre-processing before finding features/flow? As I need to calculate flow in real time, I cannot really afford dense methods, as it might hamper performance. Could you please suggest some ways to go about tackling this problem?