def judge_reido_scene(image = None): """ 戦闘・非戦闘状態関係なくレイドの場面を判断する. """ if(image == None): image = getCurrentImage() image = get_normalized_image(image) non_key, non_sim = recognize( image, recog.match_rgb, 0.80, scene_reido_dictionary ) non_sim = non_sim * 0.75 / 0.80 battle_key, battle_sim = recog.recognize( input_image = image, match = calc_sim_b, threshold = 0.75, dictionary = dictionary_scene ) if(battle_sim >= non_sim): return battle_key return non_key
def judge_panel_color(num, image = None): if(image == None): image = getCurrentImage() image = get_normalized_image(image) image = crop_box_left_down(panel_rects[num], image) is_red = False is_blue = False is_yellow = False for i, dic in enumerate(panel_dictionaries): key = recog.recognize( image, recog.match_rgb, 0.0, dic ) if(key == "red"): is_red = True elif(key == "yellow"): is_yellow = True elif(key == "blue"): is_blue = True color_size = 0 if(is_red): color_size += 1 if(is_yellow): color_size += 1 if(is_blue): color_size += 1 return color_size, (1 if is_red else 0, 1 if is_yellow else 0, 1 if is_blue else 0)
def judge_scene_color(image=None): if (image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize(image, recog.match_rgb, 0.92, scene_color_dictionary) return key
def judge_erratum(image=None): # 正解か不正解かを判定する. if (image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize(image, recog.match_answer_erratum, 0.0, erratum_dictionary) return key
def judge_panels(image = None): if(image == None): image = getCurrentImage() image = get_normalized_image(image) ret = [None] * 4 for i in range(len(ret)): ret[i] = judge_panel_color(i, image) return ret
def judge_ans_num(image = None): if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recognize( image, recog.match_rgb, 0.76, ans_select_dictionary ) return key
def judge_non_battle_scene(image = None): if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recognize( image, recog.match_rgb, 0.82, scene_reido_dictionary ) return key
def judge_scene(image=None): # クエスト時における現在の状態を判別する # ジャンル選択、問題、などがある. if (image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize(input_image=image, match=calc_sim_b, threshold=0.75, dictionary=dictionary_scene) return key
def judge_scene_color(image = None): if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize( image, recog.match_rgb, 0.92, scene_color_dictionary ) return key
def judge_erratum(image = None): # 正解か不正解かを判定する. if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize( image, recog.match_answer_erratum, 0.0, erratum_dictionary ) return key
def judge_is_non_battle_scene(image = None): if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recognize( image, recog.match_rgb, 0.84, is_nonbattle_mode_dictionary ) if(key == None): return False return key == "is_nonbattle"
def judge_scene(image = None): # クエスト時における現在の状態を判別する # ジャンル選択、問題、などがある. if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize( input_image = image, match = calc_sim_b, threshold = 0.75, dictionary = dictionary_scene ) return key
def judge_ansnum(image=None): # 問題の答えを画像から判定する. if (image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize(image, recog.match_rgb, 0.0, ansnum_dictionary) if (key == None): return -1 if (key == "num1"): return 1 if (key == "num2"): return 2 if (key == "num3"): return 3 if (key == "num4"): return 4 return -1
def judge_ansnum(image = None): # 問題の答えを画像から判定する. if(image == None): image = getCurrentImage() image = get_normalized_image(image) key, sim = recog.recognize( image, recog.match_rgb, 0.0, ansnum_dictionary ) if(key == None): return -1 if(key == "num1"): return 1 if(key == "num2"): return 2 if(key == "num3"): return 3 if(key == "num4"): return 4 return -1