C++ 资产评估失败
之后,我在我的类中添加了函数readcode,我得到了错误 “C++调试断言失败,表达式:: 当我关闭程序时,我应该更改什么 这是代码: timecodeReader.cppC++ 资产评估失败,c++,opencv,C++,Opencv,之后,我在我的类中添加了函数readcode,我得到了错误 “C++调试断言失败,表达式:: 当我关闭程序时,我应该更改什么 这是代码: 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++) {
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;
}
void timecodereder::readcode(Mat&im、int&istart、int&jstart、int d)
{
int k,c,iakk;
//串//
代码=”;
对于(k=0;k245)
代码=代码+“1”;
其他的
代码=代码+“0”;
}
标准::cout 1。修正你的缩进。2.提供更有用的上下文信息。(提示:仅复制/粘贴头文件并不能完全剪切头文件。)此断言失败可能是由双重delete
或类似与内存相关的无效操作引起的。您应该检查您的代码是否存在此类错误。只有在标题文件中声明“字符串代码”时,才会出现此错误。如果代码在函数read 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_)