pyvista.compare_images#
- compare_images(im1, im2, threshold=1, use_vtk: bool = True)[ソース]#
同じサイズの2つの異なるイメージを比較します.
- パラメータ:
- im1
str|numpy.ndarray| vtkRenderWindow | vtkImageData Render window, numpy array representing the output of a render window, or vtkImageData.
- im2
str|numpy.ndarray| vtkRenderWindow | vtkImageData Render window, numpy array representing the output of a render window, or vtkImageData.
- threshold
int, default: 1 ピクセル差の閾値許容値.これは0より大きくなければなりません.そうでなければ,同じ画像であっても常にエラーを返します.
- use_vtkbool, default:
True When disabled, computes the mean pixel error over the entire image using numpy. The difference between pixel is calculated for each RGB channel, summed, and then divided by the number of pixels. This is faster than using vtkImageDifference but potentially less accurate.
- im1
- 戻り値:
floatuse_vtk=Trueを使用している場合のイメージ間の合計エラー,およびuse_vtk=Falseを使用している場合の平均ピクセルエラーです.
例
2つのアクティブなプロッタを比較します.
>>> import pyvista as pv >>> pl1 = pv.Plotter() >>> _ = pl1.add_mesh(pv.Sphere(), smooth_shading=True) >>> pl2 = pv.Plotter() >>> _ = pl2.add_mesh(pv.Sphere(), smooth_shading=False) >>> error = pv.compare_images(pl1, pl2)
ファイルのイメージを比較します.
>>> import pyvista as pv >>> img1 = pv.read('img1.png') >>> img2 = pv.read('img2.png') >>> pv.compare_images(img1, img2)