Ask Your Question

Revision history [back]

You don't load your image in the loop, therefor, when you change the value with your trackbar, it doesn't load a new image. I suggest to load both image, into two different Mat. Compute all the descriptors for the both images. After that, you use the trackbar has a boolean to point to the right image.

//Create Matching class
CMareMatchingClass MColorMatch;
CMareMatchingClass MBnWMatch;
//Input PatchImg
MColorMatch.ExtractPatchSurf(PatchImgColor);
MBnWMatch.ExtractPatchSurf(PatchImgBnW);
...
    if( colorInt == 1 )
        res = MMColorMatch.GetObjectRectAndBestH(BackGroundImg, &rect4pt);
    else
        res = MMBnWMatch.GetObjectRectAndBestH(BackGroundImg, &rect4pt);
    if( res 1= 0 )
    ...

You don't load your image in the loop, therefor, when you change the value with your trackbar, it doesn't load a new image. I suggest to load both image, into two different Mat. Compute all the descriptors for the both images. After that, you use the trackbar has a boolean to point to the right image.

//Create Matching class
CMareMatchingClass MColorMatch;
CMareMatchingClass MBnWMatch;
//Input PatchImg
MColorMatch.ExtractPatchSurf(PatchImgColor);
MBnWMatch.ExtractPatchSurf(PatchImgBnW);
...
    if( colorInt == 1 )
        res = MMColorMatch.GetObjectRectAndBestH(BackGroundImg, &rect4pt);
    else
        res = MMBnWMatch.GetObjectRectAndBestH(BackGroundImg, &rect4pt);
    if( res 1= == 0 )
    ...

[EDIT] You have to:

  1. Load the both images
  2. Compute the descriptors for the both images
  3. compare (with GetObjectRectAndBestH I assume) the current image with:
    • the color descriptor if the trackbar is on color (colorInt == 1)
    • the black and white image if the trackbar is on black and white (colorInt == 0)