我想规范化一个看起来像这个
的python数组array([[ 11.40734340-0.29832373j, 11.43838953-0.2330848j ,
11.51347743+0.05464141j, ..., 11.66593745-0.23486117j,
11.48996430-0.18709683j, 11.47948371-0.28934914j],
[ 11.53463463-0.20148586j, 11.58397234-0.10384628j,
11.59314978+0.18854025j, ..., 11.44680114-0.38295714j,
11.44062107-0.30858363j, 11.49362217-0.32352874j],
[ 11.47423737-0.09162011j, 11.66564959+0.16699415j,
11.57411499+0.27745924j, ..., 11.30369153-0.28317958j,
11.60371236-0.33782883j, 11.51040077-0.28672312j],
...,
[ 11.15258074-0.19047382j, 11.21263244-0.26008457j,
11.23572965-0.27349975j, ..., 11.26901318-0.25710196j,
11.26925144-0.20500497j, 11.12739736-0.22942166j],
[ 11.27209183-0.14971003j, 11.34077096-0.18473887j,
11.28326221-0.40778278j, ..., 11.33564537-0.24436556j,
11.42304835-0.26064881j, 11.37050821-0.21830381j],
[ 11.39713540-0.33105119j, 11.47700146-0.22564029j,
11.42977268-0.20060011j, ..., 11.37402085-0.22322532j,
11.43500243-0.15516771j, 11.45758000-0.20336809j]])
到0到255之间的实际值,以便我可以将其保存为灰度图像。我对OpenCV没有运气:
image = complex_array.real
output = image
cv2.normalize(image, output, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U)
这会产生错误:TypeError: Layout of the output array dst is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)
。这在normalize()
的背景下意味着什么?