之后我在我班上添加了函数readcode我得到了错误 “C ++调试断言失败,表达式:_BLOCK_TYPE_IS_VALID(pHead - nblockUse)” 当我关闭程序时,我应该更改什么?
这是代码:
timecodeReader.cpp
void TimecodeReader::readcode(Mat& im,int& istart,int & jstart,int d)
{
int k,c,iakk;
//String //
code="";
for(k=0;k<33;k++)
{
iakk=istart+k*d;
c=checkBlock(im,iakk,jstart);
if(c>245)
code=code+"1";
else
code=code+"0";
}
std::cout << code << std::endl;
//return code;
}
标题文件:
#include <cv.h>
#include <highgui.h>
#include <String>
#include <math.h>
using namespace cv;
using namespace std;
class TimecodeReader
{
public:
TimecodeReader(int newVertPosition = Bottom);
Mat getDrawing();
Mat getBinary();
bool getTimecodePosition(Mat newCapture, double dispIgnore);
int getTimecode(Mat newCapture);
void setContourLimit(int low, int high);
Mat binaryImage;
Mat binaryImageCpy;
Mat drawingImage;
private:
void setCapture(Mat newCapture);
bool calcArea();
void calcTresholds();
void calcMeans();
bool decodeMeans();
bool checkContours();
//int getDecimal();
Mat calcHistogram(Mat roiCapture);
double calcHistogramMean(Mat newHistogram);
void drawHistogram(Mat newHistogram);
Mat capture;
RNG rng;
Rect roi;
string binary[2];
double decodeDefaultTresholds[2];
int decodeAberration;
double decodeTresholds[2][2][2];
int contourLowLimit;
int contourHighLimit;
const static int TimecodeCount = 41;
int vertPosition;
vector<vector<Point>> contours;
vector<vector<Point>> contoursSimple;
vector<vector<Point>> contourAreas;
vector<double> means;
vector<Vec4i> hierarchy;
int checkBlock(Mat& img, int& i, int& j);
int thres(Mat& img,int h,int w);
bool decision(Mat& im,int h,int w,int j);
int getdistance(Mat& im,int& i, int& j,int width, int height);
int getdoubledistance(Mat& im,int& i, int& j,int width, int height);
int getrad (Mat& im,int& i, int& j,int width, int height);
int getrad1 (Mat& im,int& i, int& j,int width, int height);
bool searchleft(Mat& im,int& i, int& j,int width, int height);
int* checkcoderight (Mat& im,Mat& im1,int& i, int& j,int width, int height);
bool checkcodeleft (Mat& im,Mat& im1,int& i, int& j,int width, int height,int d);
bool checkcodeleft1 (Mat& im,Mat& im1,int& i, int& j,int width, int height,int d);
void readcode(Mat& im,int& istart,int & jstart,int d);
string code;
};
#endif // !defined(EA_FCDF0E51_9C9E_4b28_8C4A_8703EFEE38FC__INCLUDED_)
感谢您的帮助。