Aşağıdaki for döngüsü ile çok az indeksleme problemim var. Sadece görüntüyü roi ile tarıyorum ama bütün görüntüyü tarayamıyorum. Son satırlarda ve sütunlarda kalan taranmamış bölgeler var. Herhangi bir öneri? Basit soru için özür dilerim.Roi C++ ile sürgülü pencere
int getNextIndex(int currentIndex, int frameSize, int roi, int step)
{
int temp = min(currentIndex + step, frameSize - roi - 1);
return currentIndex != temp ? temp : frameSize;
}
0: fonksiyon
getNextIndex
böyle olduğu Yerine bu
for (int rowindex = 0; rowindex <= frameWidth - roiw; rowindex += StepRow)
ait
// Sliding Window for scaning the image
for (int rowIndex = 0; rowIndex <= lBPIIImage2.rows - roih; rowIndex = getNextIndex(rowIndex, lBPIIImage2.rows, roih, steprow))
{
for (int colindex = 0; colindex <=lBPIIImage2.cols - roiw; colindex = getNextIndex(colindex, lBPIIImage2.cols, roiw, stepcol))
{
searchRect = cvRect(colindex, rowIndex, roiw, roih);
frameSearchRect = lBPIIImage2(searchRect);
LoopDummy = frameSearchRect.clone();
rectangle(frame, searchRect, CV_RGB(255, 0, 0), 1, 8, 0);
//normalize(LoopDummy, LoopDummy, 0, 255, NORM_MINMAX, CV_8UC1);
//imshow("Track", LoopDummy);
//waitKey(30);
images.push_back(LoopDummy);
Coordinate.push_back(make_pair(rowIndex, colindex));
}
}
Neden ikisi de “roiw” ve “StepRow” var, aralarındaki fark nedir? – Dialecticus
Üst üste binen pencerelerle kayıyorum, bu yüzden adım adım var. Bu roiw/.5 –
Tamam, bu yüzden son 'cvRect' bir satırda da 'roiw' genişliğini, ama 'rowIndex% StepRow' olmak için! = 0 ister misiniz, yoksa 'rowIndex% StepRow' ister misiniz? 0 olmak için, ancak 'cvRect' genişliği roiw'den daha az mı olacak? – Dialecticus