A boundary point between a subject image and a mask region is detected with high accuracy.An endoscope apparatus 1 includes an operation reception unit 97 that receives a user operation for calculating a gain of white balance, a display unit that displays white balance based on a captured image obtained by imaging by the imaging unit 54 according to a user operation A gain calculating unit 962 for calculating a gain of the subject image included in the captured image and a mask area other than the subject image on the basis of the luminance signal of each pixel in the captured image And an edge detection unit 94 for executing mask edge detection processing to be detected.(FIG.【課題】被写体像とマスク領域との境界点を高精度に検出すること。【解決手段】内視鏡装置1は、ホワイトバランスのゲインを算出させるユーザ操作を受け付ける操作受付部97と、ユーザ操作に応じて、撮像部54による撮像で得られる撮像画像に基づいて、ホワイトバランスのゲインを算出するゲイン算出部962と、ユーザ操作に応じて、撮像画像における画素毎の輝度信号に基づいて、当該撮像画像に含まれる被写体像と当該被写体像以外のマスク領域との境界点を検出するマスクエッジ検出処理を実行するエッジ検出部94とを備える。【選択図】図2