This is a normal c++ question. not related to Qt but there's not one c++ forum out there that solved this problem...On running my function I encounter this
" commit_and_inc: VirtualAlloc failed"
This happens when I run these lines.
quadrant_4D[1][1][1][1]=getPixelCount(widths[1], heights[1], widths[2],
heights[2], outputImage1);
quadrant_4D[1][1][1][2]=getPixelCount(widths[2], heights[1], widths[3],
heights[2], outputImage1);
quadrant_4D[1][1][1][1]=getPixelCount(widths[1], heights[1], widths[2],
heights[2], outputImage1);
quadrant_4D[1][1][1][2]=getPixelCount(widths[2], heights[1], widths[3],
heights[2], outputImage1);
To copy to clipboard, switch view to plain text mode
When I run only the first line,
quadrant_4D[1][1][1][1]=getPixelCount(widths[1], heights[1], widths[2],
heights[2], outputImage1)
quadrant_4D[1][1][1][1]=getPixelCount(widths[1], heights[1], widths[2],
heights[2], outputImage1)
To copy to clipboard, switch view to plain text mode
. the VirtualAlloc problem does not occur
here is the deginition of getPixelCount
int getPixelCount(int x1, int y1, int x2, int y2, RGBImage image) {
int count = 0;
int x, y = 0;
for (x = x1; x < x2; x++) {
for (y = y1; y < y2; y++) {
if (image(x, y) == COLOR_RGB(0,0,0)) {
count++;
}
}
}
return count;
}
int getPixelCount(int x1, int y1, int x2, int y2, RGBImage image) {
int count = 0;
int x, y = 0;
for (x = x1; x < x2; x++) {
for (y = y1; y < y2; y++) {
if (image(x, y) == COLOR_RGB(0,0,0)) {
count++;
}
}
}
return count;
}
To copy to clipboard, switch view to plain text mode
Bookmarks