MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / calculate_sharpness

Function calculate_sharpness

data/unit_test/tests.py:146–155  ·  view source on GitHub ↗
(image_path)

Source from the content-addressed store, hash-verified

144 return numeric_columns
145
146def calculate_sharpness(image_path):
147 # 打开图像并转换为灰度图
148 image = Image.open(image_path).convert('L')
149 image_array = np.array(image)
150
151 # 使用拉普拉斯算子计算图像的清晰度
152 laplacian = cv2.Laplacian(image_array, cv2.CV_64F)
153 sharpness = laplacian.var()
154
155 return sharpness
156
157def test_task_2(trajectory):
158 df=pd.read_csv('./output/2.csv')

Callers 2

test_task_98Function · 0.85
test_task_99Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected