Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
NickGeramanis committed Sep 21, 2024
1 parent e299a1f commit fba87f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions denoising_inpainting_lbp/markov_random_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self,
for i in range(self._N_LABELS):
for j in range(self._N_LABELS):
self._smoothness_cost[i, j] = (
lambda_ * min(max_smoothness_penalty, (i - j) ** 2))
lambda_ * min(max_smoothness_penalty, (i - j) ** 2))

def calculate_energy(self) -> int:
"""Calculate the energy of an image.
Expand All @@ -62,14 +62,14 @@ def calculate_energy(self) -> int:

if row < height - 1:
label_difference = (
(self._graph[row, column].label
- self._graph[row + 1, column].label) ** 2)
(self._graph[row, column].label
- self._graph[row + 1, column].label) ** 2)
smoothness_energy += min(self._max_smoothness_penalty,
label_difference)
if column < width - 1:
label_difference = (
(self._graph[row, column].label
- self._graph[row, column + 1].label) ** 2)
(self._graph[row, column].label
- self._graph[row, column + 1].label) ** 2)
smoothness_energy += min(self._max_smoothness_penalty,
label_difference)

Expand Down

0 comments on commit fba87f0

Please sign in to comment.