0
# Create an ImageJ gateway with the newest available version of ImageJ.
import imagej
import pathlib
import numpy
ij = imagej.init()
# Load an image.
img_path = pathlib.Path('C:/Users/Bernardo/TCC/thyroid/1_1.jpg')
image = ij.io().open(str(img_path))
ij.py.show(image, cmap='gray')

阅读此图像后,我想使用 pyimagej 绘制直方图。

4

1 回答 1

0

好吧,你可以只使用 matplotlib:

# Create an ImageJ gateway with the newest available version of ImageJ.
import imagej
import pathlib
import numpy
ij = imagej.init()
# Load an image.
img_path = pathlib.Path('C:/Users/Bernardo/TCC/thyroid/1_1.jpg')
image = ij.io().open(str(img_path))
ij.py.show(image, cmap='gray')

import matplotlib.pyplot as plt
plt.hist(image.flatten())
于 2021-05-02T22:55:49.693 回答