New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 色変更関数の変数名などをわかりやすいようにした #60
Conversation
i-make/mode/base.py
Outdated
|
||
@classmethod | ||
def get_choice_images_paths(cls): | ||
"""Get the paths to the images for the choices.""" | ||
icon_file = cls.ICON_PATH.replace(cls.CHOICE_IMAGES_DIR_PATH, "").replace("/", "") | ||
return [ | ||
os.path.join(cls.CHOICE_IMAGES_DIR_PATH, file) | ||
for file in os.listdir(cls.CHOICE_IMAGES_DIR_PATH) | ||
if file.endswith(".png") and not file == icon_file | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
もとの場所のままでお願いします
i-make/mode/base.py
Outdated
@@ -142,23 +142,30 @@ def set_skin_color(self, hue: float, sat: float, val: float) -> None: | |||
def _convert_image_color( | |||
self, image: np.ndarray, hue: float, sat: float, val: float, include_alpha_ch: bool | |||
) -> np.ndarray: | |||
"""アルファチャンネル付きのRGB=(0,0,255)の画像の色を、指定したHSV数値の色に変更する. | |||
"""アルファチャンネル付きのHSV=(240,255,255)の画像の色を、指定したHSV数値の色に変更する. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
元のコメントのままで良いんじゃないかな?
i-make/mode/base.py
Outdated
hue (_type_): HSVのHueの数値 | ||
sat (_type_): HSVのSaturationの数値 | ||
val (_type_): HSVのValueの数値 | ||
image (_type_): H:240 S:255 V:255で塗りつぶしたアルファチャンネルを含むメイク素材、1024x1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
i-make/mode/base.py
Outdated
hue (_type_): HSVのHueの数値(0~255) | ||
sat (_type_): HSVのSaturationの数値(0~255) | ||
val (_type_): HSVのValueの数値(0~255) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0~255で制限するならvalidationつけてもいいかも
範囲外でもおかしくならないならばそのままでも大丈夫
(たしかこの前口頭レビューしたところ)
i-make/mode/base.py
Outdated
DETECT_HUE_VAL = 120 | ||
DETECT_SAT_VAL = 255 | ||
NOT_DETECT_VAL_VAL = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VAL_VAL
になっちゃうから、最後のVALは不要です
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RGB=(0,0,255) ⇔ HSV=(120, 255, ?) っていう認識でいいかな?
それならば、
B255_HUE = 120
B255_SAT = 255
NO_CAHNGE_VAL = 0
みたいな感じ??
認識違ったらごめん
i-make/mode/base.py
Outdated
image_hsv[:, :, 0] = np.where(image_hsv[:, :, 0] == 120, hue / 2, image_hsv[:, :, 0]) | ||
image_hsv[:, :, 1] = np.where(image_hsv[:, :, 1] == 255, sat, image_hsv[:, :, 1]) | ||
image_hsv[:, :, 2] = np.where(image_hsv[:, :, 2] != 0, (val * (image_hsv[:, :, 2] / 255)), image_hsv[:, :, 2]) | ||
if not ((0.0 <= hue <= 255) & (0.0 <= sat <= 255) & (0.0 <= val <= 255)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あんどは記号ではなくローマ字じゃないとダメな気がする
i-make/mode/base.py
Outdated
image_hsv[:, :, 1] = np.where(image_hsv[:, :, 1] == 255, sat, image_hsv[:, :, 1]) | ||
image_hsv[:, :, 2] = np.where(image_hsv[:, :, 2] != 0, (val * (image_hsv[:, :, 2] / 255)), image_hsv[:, :, 2]) | ||
if not ((0.0 <= hue <= 255) & (0.0 <= sat <= 255) & (0.0 <= val <= 255)): | ||
raise ValueError("Defferent range of values") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
つづりが違う気がします
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1個ずつ判定した方が、どの値が範囲外かわかるからいい気がする
@GoRuGoo |
最初のdocstring、ももさんがSとVが255であることを知らずにまちがえて素材作って、エラー出てますって動かしたときに連絡きたのでRGBよりHSVの方が良いと思うの自分だけですかね? |
B255ってh120のs255ではない? |
一応そうなんですけど、B255で伝えて間違ったものが帰ってきたので… |
プログラム的には、B255を変換しているので、そのままで行きましょう |
Overview
わかりやすいようにしたつもりです
Issue number
Close #
How to check the revision
Points for Review
Remarks