File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2185,4 +2185,32 @@ TEST(Mat, empty_iterator_16855)
2185
2185
EXPECT_TRUE (m.begin <uchar>() == m.end <uchar>());
2186
2186
}
2187
2187
2188
+
2189
+ TEST (Mat, regression_18473)
2190
+ {
2191
+ std::vector<int > sizes (3 );
2192
+ sizes[0 ] = 20 ;
2193
+ sizes[1 ] = 50 ;
2194
+ sizes[2 ] = 100 ;
2195
+ #if 1 // with the fix
2196
+ std::vector<size_t > steps (2 );
2197
+ steps[0 ] = 50 *100 *2 ;
2198
+ steps[1 ] = 100 *2 ;
2199
+ #else // without the fix
2200
+ std::vector<size_t> steps(3);
2201
+ steps[0] = 50*100*2;
2202
+ steps[1] = 100*2;
2203
+ steps[2] = 2;
2204
+ #endif
2205
+ std::vector<short > data (20 *50 *100 , 0 ); // 1Mb
2206
+ data[data.size () - 1 ] = 5 ;
2207
+
2208
+ // param steps Array of ndims-1 steps
2209
+ Mat m (sizes, CV_16SC1, (void *)data.data (), (const size_t *)steps.data ());
2210
+
2211
+ ASSERT_FALSE (m.empty ());
2212
+ EXPECT_EQ ((int )5 , (int )m.at <short >(19 , 49 , 99 ));
2213
+ }
2214
+
2215
+
2188
2216
}} // namespace
You can’t perform that action at this time.
0 commit comments