Vote count: 0
I am an image processing programmer and I’m using opencv C++. As a part of a program that I wrote, I have three nested for. The first one is for different images, the second one is for rows of images and the third one is for columns of images. There is not any dependency between three for and they can excecute parallel (I mean, all pixels of all images can be processed in parallel). I’m not familiar with parallel programming, GPU programming, thread, tbb, parallel for loop and … . I found the different links over the internet that suggested such things. I want to know what is the fastest solution for my problem? My OS is windows and I’m using visual studio 2015.
My code is in the following:
for (int i = 0; i < numOfProjector; i++)
{
Mat tmp(prjResRow[i], prjResCol[i], CV_8UC3, Scalar(0, 0, 0));
prjImgColored[i] = tmp;
for (int ii = 0; ii < prjResRow[i]; ii++)
{
double* ptrPrjCamIAnd0 = prjCamCor[i][0].ptr<double>(ii);
double* ptrPrjCamIAnd1 = prjCamCor[i][1].ptr<double>(ii);
Vec3b* ptrPrjImgColoredI = prjImgColored[i].ptr<Vec3b>(ii);
for (int jj = 0; jj < prjResCol[i]; jj++)
{
if ((ptrPrjCamIAnd0[jj] != NAN_VALUE) && (ptrPrjCamIAnd1[jj] != NAN_VALUE))
{
ptrPrjImgColoredI[jj] = secondImgColored.at<Vec3b>(ptrPrjCamIAnd1[jj], ptrPrjCamIAnd0[jj]);
}
}
}
imwrite(mainAdr + "\\img" + to_string(i) + ".bmp", prjImgColored[i]);
}
asked 19 secs ago
What is the fastest way for executing three nested for loop?
Aucun commentaire:
Enregistrer un commentaire