Open
Description
Hi - a repro below of an issue that causes an "attempt to read or write protected memory" access violation. It has all the hallmarks of a "one-off" bug, crashing when iRow is 200 and iCol is 363. The test image is a 364 pixels wide JPG, available here and the data row claims it is Mat with 364 entries.
using OpenCvSharp;
namespace CvSharpTest
{
internal class Program
{
static int Main(string[] args)
{
string inputFilePath = @"D:\MikeP\Images\ATest\ColoursGrid_364x556.jpg";
Mat pixels = Cv2.ImRead(inputFilePath, ImreadModes.Color);
if (pixels == null)
{
Console.WriteLine($"!!! Couldn't open {inputFilePath}");
return 1;
}
int nRows = pixels.Rows;
int nCols = pixels.Cols;
for (int iRow = 0; iRow < nRows; iRow++)
{
var dataRow = pixels.Row(iRow);
for (int iCol = 0; iCol < nCols; iCol++)
{
OpenCvSharp.Vec3b vec3B = dataRow.At<OpenCvSharp.Vec3b>(iCol);
byte r = vec3B.Item2;
byte g = vec3B.Item1;
byte b = vec3B.Item0;
}
dataRow.Dispose();
}
pixels.Dispose();
return 0;
}
}
}
Metadata
Metadata
Assignees
Labels
No labels