ビデオ (.avi 形式) に既に存在する画像 (.jpg 形式) とビデオを比較しようとしています。Visual C++ でこのタスクを実行しようとしています。2 つの静止画像を比較すると正しい結果が得られますが、画像をビデオと比較すると、その画像はビデオで検出されません。上記のタスクを達成するために、次のコードを使用しています。
// project1.1.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/legacy/legacy.hpp"
#include <stdio.h>
#include <iostream>
IplImage*  image[2] = { 0, 0 }, *image0 = 0, *image1 = 0;
CvSize size;
int  w0, h0,i;
int  threshold1, threshold2;
int  l,level = 4;
int sthreshold1, sthreshold2;
int  l_comp;
int block_size = 1000;
float  parameter;
double threshold;
double rezult, min_rezult;
int filter = CV_GAUSSIAN_5x5;
CvConnectedComp *cur_comp, min_comp;
CvSeq *comp;
CvMemStorage *storage;
CvPoint pt1, pt2;
static void ON_SEGMENT(int a)
{
  (void)a;
  cvPyrSegmentation(image0, image1, storage, &comp,
                    level, threshold1+1, threshold2+1);
  cvShowImage("Segmentation", image1);
}
using namespace std;
int main( int argc, char** argv ) 
{
    char* filename;
    CvCapture *capture = cvCaptureFromAVI("fractogene.avi");
    if(!capture)
    {   
      printf("!!! cvCaptureFromAVI failed (file not found?)\n");
      while(1);
      return -1; 
    }   
    int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
    cvNamedWindow("display_video", CV_WINDOW_AUTOSIZE);
    IplImage* frame = NULL;
    IplImage* frame1 = NULL;
    char key = 0;
    filename = argc == 2 ? argv[1] : (char*)"loadedimage.bmp";
    if( (image[0] = cvLoadImage( filename, 1)) == 0 )
    {
        printf("Cannot load fileimage - %s\n", filename);
        return -1;
    }
    frame1=image[0];
    cvNamedWindow("Source", 0);
    cvShowImage("Source", frame1);
    while (key != 'q')
    {
        frame = cvQueryFrame(capture);
        if (frame==frame1)
            printf("frames matched\n");
        else
            printf("frames not matched\n");
        if (!frame)
        {   
            printf("!!! cvQueryFrame failed: no frame\n");
            break;
        }
        cvShowImage("display_video", frame);
        key = cvWaitKey(1000 / fps);
    }
    cvReleaseCapture(&capture);
    cvWaitKey(0);
    return 0;
} 
私のプロジェクトはまもなく締め切られます。可能であれば助けてください。返信を楽しみにしています。