错误:' class cv :: String'没有名为' data'

时间:2017-05-30 08:11:35

标签: c++ qt opencv

我坚持在xml文件中写作,我的cpp代码看起来像

void Player::saveConfig()
{
  char file_xml[200];
  sprintf(file_xml,"./config/%s.VehicleCounting.xml",filename.data()); //here is the error
  CvFileStorage* fs = cvOpenFileStorage(file_xml, 0, CV_STORAGE_WRITE);

  cvWriteInt(fs, "showOutput", showOutput);
  cvWriteInt(fs, "showAB", showAB);
  cvWriteInt(fs,"module",FAV1::module);
  cvWriteInt(fs, "fav1_use_roi", FAV1::use_roi);
  cvWriteInt(fs, "fav1_roi_defined", FAV1::roi_defined);
  cvWriteInt(fs, "fav1_roi_x0", FAV1::roi_x0);
  cvWriteInt(fs, "fav1_roi_y0", FAV1::roi_y0);
  cvWriteInt(fs, "fav1_roi_x1", FAV1::roi_x1);
  cvWriteInt(fs, "fav1_roi_y1", FAV1::roi_y1);
 cvReleaseFileStorage(&fs);
} 

我的头文件的类声明在下面给出

class Player : public QThread
{    Q_OBJECT
 private:
    bool stop;
    QMutex mutex;
    QWaitCondition condition;
    Mat frame;
    int frameRate;
    VideoCapture *capture;
    Mat RGBframe;
    QImage img;
    BlobTracking* blobTracking;
    IBGS *bgs;

     bool firstTime;
     bool showOutput;
     int key;
     cv::Mat img_input;
     cvb::CvTracks tracks;
     std::map<cvb::CvID, std::vector<CvPoint2D64f> > points;
     LaneOrientation LaneOrientation;
     std::map<cvb::CvID, VehiclePosition> positions;
     long countAB;
     long countBA;
     int img_w;
     int img_h;
     int showAB;


     VehiclePosition getVehiclePosition(const CvPoint2D64f centroid);
      void saveConfig();
      void loadConfig();

 signals:
 //Signal to output frame to be displayed
      void processedImage(const QImage &image);

 protected:
     void run();
     void msleep(int ms);
 public:
    //Constructor
    Player(QObject *parent = 0);
    //Destructor
    ~Player();
    //Load a video from memory
    bool loadVideo(string filename);
    //Play the video
    void Play();
    //Stop the video
    void Stop();
    //check if the player has been stopped
    bool isStopped() const;
    //set video properties
    void setCurrentFrame( int frameNumber);
    //Get video properties
    double getFrameRate();
    double getCurrentFrame();
    double getNumberOfFrames();

     void setInput(const cv::Mat &i);
     void setTracks(const cvb::CvTracks &t);
     void process();
     String filename;
};

请帮我调试错误..我正在使用opencv3和qt.I&#39;我将不胜感激。谢谢你们。

1 个答案:

答案 0 :(得分:0)

void process();
String filename;

应该是

void process();
string filename;