Skip to content

Commit

Permalink
Replace "np.newaxis" with "None".
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jul 23, 2022
1 parent fd68f6e commit 74ff042
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions colour_demosaicing/bayer/demosaicing/malvar2004.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ def demosaicing_CFA_Bayer_Malvar2004(
del GR_GB, Rg_RB_Bg_BR, Rg_BR_Bg_RB, Rb_BB_Br_RR

# Red rows.
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * ones(R.shape)
R_r = np.transpose(np.any(R_m == 1, axis=1)[None]) * ones(R.shape)
# Red columns.
R_c = np.any(R_m == 1, axis=0)[np.newaxis] * ones(R.shape)
R_c = np.any(R_m == 1, axis=0)[None] * ones(R.shape)
# Blue rows.
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * ones(B.shape)
B_r = np.transpose(np.any(B_m == 1, axis=1)[None]) * ones(B.shape)
# Blue columns
B_c = np.any(B_m == 1, axis=0)[np.newaxis] * ones(B.shape)
B_c = np.any(B_m == 1, axis=0)[None] * ones(B.shape)

del R_m, B_m

Expand Down
12 changes: 6 additions & 6 deletions colour_demosaicing/bayer/demosaicing/menon2007.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ def demosaicing_CFA_Bayer_Menon2007(
del d_H, d_V, G_H, G_V

# Red rows.
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * ones(R.shape)
R_r = np.transpose(np.any(R_m == 1, axis=1)[None]) * ones(R.shape)
# Blue rows.
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * ones(B.shape)
B_r = np.transpose(np.any(B_m == 1, axis=1)[None]) * ones(B.shape)

k_b = as_float_array([0.5, 0, 0.5])

Expand Down Expand Up @@ -310,13 +310,13 @@ def refining_step_Menon2007(

# Updating of the red and blue components in the green locations.
# Red rows.
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * ones(R.shape)
R_r = np.transpose(np.any(R_m == 1, axis=1)[None]) * ones(R.shape)
# Red columns.
R_c = np.any(R_m == 1, axis=0)[np.newaxis] * ones(R.shape)
R_c = np.any(R_m == 1, axis=0)[None] * ones(R.shape)
# Blue rows.
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * ones(B.shape)
B_r = np.transpose(np.any(B_m == 1, axis=1)[None]) * ones(B.shape)
# Blue columns.
B_c = np.any(B_m == 1, axis=0)[np.newaxis] * ones(B.shape)
B_c = np.any(B_m == 1, axis=0)[None] * ones(B.shape)

R_G = R - G
B_G = B - G
Expand Down

0 comments on commit 74ff042

Please sign in to comment.