@@ -38,7 +38,7 @@ def test_reader(self):
38
38
# Pass VideoReaderInitParams to the decoder and initialization params to the source (cv::VideoCapture)
39
39
params = cv .cudacodec .VideoReaderInitParams ()
40
40
params .rawMode = True
41
- params .enableHistogramOutput = True
41
+ params .enableHistogram = False
42
42
ms_gs = 1234
43
43
post_processed_sz = (gpu_mat .size ()[0 ]* 2 , gpu_mat .size ()[1 ]* 2 )
44
44
params .targetSz = post_processed_sz
@@ -48,14 +48,12 @@ def test_reader(self):
48
48
ret , raw_mode = reader .getVideoReaderProps (cv .cudacodec .VideoReaderProps_PROP_RAW_MODE )
49
49
self .assertTrue (ret and raw_mode )
50
50
51
- # Retrieve image histogram
51
+ # Retrieve image histogram. Not all GPUs support histogram. Just check the method is called correctly
52
52
ret , gpu_mat , hist = reader .nextFrameWithHist ()
53
- self .assertTrue (ret and not gpu_mat .empty () and hist . size () == ( 256 , 1 ) )
53
+ self .assertTrue (ret and not gpu_mat .empty ())
54
54
ret , gpu_mat_ , hist_ = reader .nextFrameWithHist (gpu_mat , hist )
55
- self .assertTrue (ret and not gpu_mat .empty () and hist .size () == (256 ,1 ))
56
- self .assertTrue (gpu_mat_ .cudaPtr () == gpu_mat .cudaPtr () and hist_ .cudaPtr () == hist .cudaPtr ())
57
- hist_host = cv .cudacodec .MapHist (hist )
58
- self .assertTrue (hist_host .shape == (1 ,256 ) and isinstance (hist_host , np .ndarray ))
55
+ self .assertTrue (ret and not gpu_mat .empty ())
56
+ self .assertTrue (gpu_mat_ .cudaPtr () == gpu_mat .cudaPtr ())
59
57
60
58
# Check post processing applied
61
59
self .assertTrue (gpu_mat .size () == post_processed_sz )
@@ -93,6 +91,12 @@ def test_reader(self):
93
91
else :
94
92
self .skipTest (e .err )
95
93
94
+ def test_map_histogram (self ):
95
+ hist = cv .cuda_GpuMat ((1 ,256 ), cv .CV_8UC1 )
96
+ hist .setTo (1 )
97
+ hist_host = cv .cudacodec .MapHist (hist )
98
+ self .assertTrue (hist_host .shape == (256 , 1 ) and isinstance (hist_host , np .ndarray ))
99
+
96
100
def test_writer (self ):
97
101
# Test the functionality but not the results of the VideoWriter
98
102
@@ -122,4 +126,4 @@ def test_writer(self):
122
126
os .remove (fname )
123
127
124
128
if __name__ == '__main__' :
125
- NewOpenCVTests .bootstrap ()
129
+ NewOpenCVTests .bootstrap ()
0 commit comments