Open ArsenLuca opened 6 years ago
@ArsenLuca , What is the error info?
@frotms In Linux Eclipse C++ IDE, it shows: malloc(): memory corruption(fast): 0x0000000002145150 *** In Visual Studio IDE, it shows error in delete function or sometimes malloc function.
@frotms you can have a try using the image above
In windows VS, it shows
@frotms Also, in each run, different errors happen. In one run, it happens that:
for (unsigned int lineID = 0; lineID < numOfFinalLine; lineID++){ lineIDInScaled = scaledLines[lineID].lineIDInScaled; direction = edLineVec[ZERO]->lineDirection[lineIDInScaled]; singleLine.scaledCount = ZERO; singleLine.direction = direction; singleLine.lineLength = scaledLines[lineID].lineLength; singleLine.salience = edLineVec[ZERO]->lineSalience[lineIDInScaled]; singleLine.numOfPixels = edLineVec[ZERO]->lines.sId[lineIDInScaled + 1] - edLineVec[ZERO]->lines.sId[lineIDInScaled];
edLineVec[ZERO]->lines.sId has a size of 40, while lineIDInScaled is 39. So edLineVec[ZERO]->lines.sId[lineIDInScaled + 1] is out of range.
I'll try later @ArsenLuca
@frotms I first resize the image to 640640 and debug the codes. It comes that in the following line: `lines.sId.resize(5 edges.numOfEdges);` edges.numOfEdges is 8. so edLineVec[ZERO]->lines.sId has the size of 40.
while in:
for (unsigned int lineID = 0; lineID < numOfFinalLine; lineID++){ lineIDInScaled = scaledLines[lineID].lineIDInScaled; direction = edLineVec_[ZERO]->lineDirection_[lineIDInScaled]; singleLine.scaledCount = ZERO; singleLine.direction = direction; singleLine.lineLength = scaledLines[lineID].lineLength; singleLine.salience = edLineVec_[ZERO]->lineSalience_[lineIDInScaled]; singleLine.numOfPixels = edLineVec_[ZERO]->lines_.sId[lineIDInScaled + 1] - edLineVec_[ZERO]->lines_.sId[lineIDInScaled];
numOfFinalLine is 93,
So when the loop comes at lineID == 39, lineIDInScaled is also 39, So edLineVec[ZERO]->lines.sId[lineIDInScaled + 1] is out of range.
I think lineIDInScaled+1 should be less than 5 edges.numOfEdges and I don't know exactly why when using this image, 5 edges.numOfEdges can be equal to lineIDInScaled+1
@frotms It seems that the problem is due to 5 edges.numOfEdges is not enough for numOfFinalLine. So why do you set the constant multiplier to be 5? And how to control 5 edges.numOfEdges is larger than numOfFinalLine?
When I use the following image as input, the algorithm meets with a memory error in function int EDLineDetector::EDline(image_int8u_p image, LineChains &lines, bool smoothed) It seems to be a memory out of range error. @frotms Could you please have a try and resolve the problem?