Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts: ROI cases are not being covered by ArrayTest #26244

Open
mshabunin opened this issue Oct 3, 2024 · 0 comments
Open

ts: ROI cases are not being covered by ArrayTest #26244

mshabunin opened this issue Oct 3, 2024 · 0 comments
Labels
Milestone

Comments

@mshabunin
Copy link
Contributor

ArrayTest class have two storages for arrays: vector<vector<void*>> test_array for old functions and vector<vector<Mat>> test_mat for new functions. The first one is being filled with data and the second one is copied from the first:

test_mat.resize(test_array.size());
for( i = 0; i < max_arr; i++ )
{
size_t sizei = test_array[i].size();
test_mat[i].resize(sizei);
for( j = 0; j < sizei; j++ )
{
CvArr* arr = test_array[i][j];
test_mat[i][j] = cv::cvarrToMat(arr);
if( !test_mat[i][j].empty() )
fill_array( test_case_idx, (int)i, (int)j, test_mat[i][j] );
}
}

However, the function cvarrToMat being used to convert old array to Mat clears the ROI indicator and creates plain object instead (data == datastart, dataend unset or at the end). Example for IplImage:

if(!img->roi)
{
CV_Assert(img->dataOrder == IPL_DATA_ORDER_PIXEL);
m.flags = Mat::MAGIC_VAL + CV_MAKETYPE(imgdepth, img->nChannels);
m.rows = img->height;
m.cols = img->width;
m.datastart = m.data = (uchar*)img->imageData;
esz = CV_ELEM_SIZE(m.flags);
}
else
{
CV_Assert(img->dataOrder == IPL_DATA_ORDER_PIXEL || img->roi->coi != 0);
bool selectedPlane = img->roi->coi && img->dataOrder == IPL_DATA_ORDER_PLANE;
m.flags = Mat::MAGIC_VAL + CV_MAKETYPE(imgdepth, selectedPlane ? 1 : img->nChannels);
m.rows = img->roi->height;
m.cols = img->roi->width;
esz = CV_ELEM_SIZE(m.flags);
m.datastart = m.data = (uchar*)img->imageData +
(selectedPlane ? (img->roi->coi - 1)*m.step*img->height : 0) +
img->roi->yOffset*m.step[0] + img->roi->xOffset*esz;
}

Thus all ArrayTest-based tests using test_mat and new functions will effectively miss ROI case. For example Core_MulSpectrums.accuracy. Here neither of src1, src2 or dst will be ROI Mat in any case:

cv::mulSpectrums( *src1, *src2, dst, flags, (flags & CV_DXT_MUL_CONJ) != 0 );

@mshabunin mshabunin added the test label Oct 3, 2024
@asmorkalov asmorkalov added this to the 5.0-release milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants