Python(パイソン) ,OpenCV2 ,ソースプログラムリスト あり ,プログラム作ってみた ,[画像処理, OpenCV2 使用] を 行う
Python(パイソン) プログラム作ってみた インデックス へ
-----
2024.8.16 presented in [note] ( //note.com/runningWater/ )
2024.8.24 rewritten
----------
これ以降に記述されている内容は、このようなコンピューター・プログラムを制作した、というような事を、ただ、述べているに過ぎない。
以下の記述を読んだ人が、それを単に参考にする、というのであれば、問題は無いと、思われる。
しかし、記述されている内容に沿って、その人が、そこに記されているのと同様の制作や作業を行った際に、その制作、作業、コンピューターの作動の結果、使用されたコンピューター等、様々な方面において、何らかの問題が発生しない、という保証は、全くない。
その制作、作業、コンピューターの作動の結果、その人や、その人が所属している組織、その人が使用した様々な機器、インフラストラクチャー等の、身の上にどのような事が起ころうとも、私は一切、責任を負わない。
このプログラムは、Python(パイソン) 言語を使って、記述されている。
----------
様々なモジュールの記述において、何らかの画像に関する処理をしたい、というような時に、このモジュールの関数を呼び出して処理することができるように、ということで、これを制作した。
OpenCV2 を使用して、画像処理を行うように、した。
画像に対して、ピクセル単位の処理も、行えるように、した。
エラー処理に関しては、下記のコンテツにに記述したものを利用している。
Python(パイソン) ,ソースプログラムリスト あり ,プログラム作ってみた ,[エラー処理] を 行う
ファイル名 [ImageDataTwoDimensionHandling.py]
----------
#===========================================
import cv2
import ErrorProcess
#===========================================
class ImageDataTwoDimensionHandling :
CV_CLASS_NAME = "ImageDataTwoDimensionHandling"
#------------------------------------------------------------
# definition of constructer
def __init__( self
, arg_requester_module
, arg_requester_function
):
methode_name = "constructer"
print( "==================================" )
print( "Enter into , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print( "==================================" )
self.iv_image_data_loaded = "N"
self.iv_image_data_Lab_prepared = "N"
self.iv_list_of_ErrorMessage = [
"******** Error !!! **********"
, " "
, " "
, " "
, " "
, " "
]
print( "==================================" )
print( "Exit from , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print( "==================================" )
return
#------------------------------------------------------------
def load_image_data ( self
, arg_requester_module
, arg_requester_function
, arg_abs_path_of_ImageDataFile
) :
methode_name = "load_image_data"
self.iv_abs_path_of_ImageDataFile = arg_abs_path_of_ImageDataFile
print( "==================================" )
print( "Enter into , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print( "==================================" )
print( "self.iv_abs_path_of_ImageDataFile = "
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
#-------- load image data using OpneCV2 ----------
self.iv_loaded_image_data = \
cv2.imread ( self.iv_abs_path_of_ImageDataFile )
#-----------------------------------
#get size and chanel number ( height, width, channel )
image_height, image_width, image_channel \
= self.iv_loaded_image_data.shape[:3]
self.iv_image_data_loaded_width = image_width
self.iv_image_data_loaded_height = image_height
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print( " self.iv_image_data_loaded_width = "
, self.iv_image_data_loaded_width )
print( " self.iv_image_data_loaded_height = "
, self.iv_image_data_loaded_height )
print( "==================================" )
if ( ( self.iv_image_data_loaded_width < 1 )
or
( self.iv_image_data_loaded_height < 1 )
) :
self.list_of_ErrorMessage [ 1 ] = "from upper , arg_requester_module = " + arg_requester_module
self.self.iv_list_of_ErrorMessage [ 2 ] = "from upper , arg_requester_function = " + arg_requester_function
self.self.iv_list_of_ErrorMessage [ 3 ] = "loaded image data = " + self.iv_abs_path_of_ImageDataFile
self.self.iv_list_of_ErrorMessage [ 4 ] = "width = " + self.iv_image_data_loaded_width
self.self.iv_list_of_ErrorMessage [ 5 ] = "height = " + self.iv_image_data_loaded_height
ErrorProcess.do_error_process (
#arg_requester_module
ImageDataTwoDimensionHandling.CV_CLASS_NAME
#arg_requester_function
, methode_name
#arg_terminate_process_Y_or_N
, "Y"
#arg_self.iv_list_of_ErrorMessage
, self.self.iv_list_of_ErrorMessage
)
return
#----------------------------------------
self.iv_image_data_loaded = "Y"
#----------------------------------------
print( "==================================" )
print( "Exit from , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print( "==================================" )
return
#------------------------------------------------
def write_loaded_image_data_to_directed_path (
self
, arg_requester_module
, arg_requester_function
, arg_path_of_output_file ) :
methode_name = "write_loaded_image_data_to_directed_path"
print( "==================================" )
print( "Enter into , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print ( " arg_path_of_output_file = " + arg_path_of_output_file )
print( "==================================" )
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#------ write image data to directed path ------
cv2.imwrite ( arg_path_of_output_file
, self.iv_loaded_image_data )
#-------------------------------------------
return
#------------------------------------------------
def get_width_of_ImageData ( self ) :
return ( self.iv_image_data_loaded_width )
#------------------------------------------------
def get_height_of_ImageData ( self ) :
return ( self.iv_image_data_loaded_height )
#------------------------------------------------
def get_data_of_one_pixel ( self
, arg_requester_module
, arg_requester_function
# in the commonly used mathematical XY cordinates
, arg_x_on_ImageData_space
, arg_y_on_ImageData_space
) :
methode_name = "get_data_of_one_pixel"
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#------------------------------------------
# conversion
# commonly used mathematical XY cordinates
# --> commonly used Computer Graphics XY cordinates
x_on_ImageData_space_computer_graphics = arg_x_on_ImageData_space
y_on_ImageData_space_computer_graphics = \
self.iv_image_data_loaded_height \
- arg_y_on_ImageData_space - 1
if ( ( x_on_ImageData_space_computer_graphics < 0 )
or
( x_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_width )
or
( y_on_ImageData_space_computer_graphics < 0 )
or
( y_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_height )
) :
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "arg_requester_module = " , arg_requester_module )
print ( "arg_requester_function = " , arg_requester_function )
print ( "Error !!! Over Area")
print ( "arg_x_on_ImageData_space = " , arg_x_on_ImageData_space )
print ( "arg_y_on_ImageData_space = " , arg_y_on_ImageData_space )
print ( "self.iv_image_data_loaded_width = " \
, self.iv_image_data_loaded_width )
print ( "self.iv_image_data_loaded_height = " \
, self.iv_image_data_loaded_height )
print ( "self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
self.iv_list_of_ErrorMessage [ 0 ] = \
"**** Error !!! Area Over ****"
ErrorProcess.do_error_process (
#arg_requester_module
ImageDataTwoDimensionHandling.CV_CLASS_NAME
#arg_requester_function
, methode_name
#arg_terminate_process_Y_or_N
, "Y"
#arg_self.iv_list_of_ErrorMessage
, self.iv_list_of_ErrorMessage
)
#--------------------------
color_value = self.iv_loaded_image_data \
[
y_on_ImageData_space_computer_graphics
, x_on_ImageData_space_computer_graphics
]
return color_value
#------------------------------------------------
def put_data_of_one_pixel ( self
, arg_requester_module
, arg_requester_function
# in the commonly used mathematical XY cordinates
, arg_x_on_ImageData_space
, arg_y_on_ImageData_space
, arg_color_data_Blue
, arg_color_data_Green
, arg_color_data_Red
) :
methode_name = "put_data_of_one_pixel"
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#------------------------------------------
# conversion
# commonly used mathematical XY cordinates
# --> commonly used Computer Graphics XY cordinates
x_on_ImageData_space_computer_graphics \
= arg_x_on_ImageData_space
y_on_ImageData_space_computer_graphics \
= self.iv_image_data_loaded_height \
- arg_y_on_ImageData_space - 1
# blue color element
self.iv_loaded_image_data [
y_on_ImageData_space_computer_graphics
, x_on_ImageData_space_computer_graphics
, 0 ] \
= arg_color_data_Blue
# /green color element
self.iv_loaded_image_data [
y_on_ImageData_space_computer_graphics
, x_on_ImageData_space_computer_graphics
, 1 ] \
= arg_color_data_Green
# red color element
self.iv_loaded_image_data [
y_on_ImageData_space_computer_graphics
, x_on_ImageData_space_computer_graphics
, 2 ] \
= arg_color_data_Red
return
#------------------------------------------------
def get_loaded_image_data (
self
, arg_requester_module
, arg_requester_function
) :
methode_name = "get_loaded_image_data"
print( "==================================" )
print( "Enter into , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print ( " self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
else :
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print ( "width_of_ImageData = " + \
str ( self.iv_image_data_loaded_width ) )
print ( "height_of_ImageData = " + \
str ( self.iv_image_data_loaded_height ) )
print( "==================================" )
print( "Exit from , Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( " arg_requester_module = " + arg_requester_module
+ " , arg_requester_function = " + arg_requester_function )
print ( " self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
return ( self.iv_loaded_image_data )
#------------------------------------------------
def convert_BGR_to_Lab ( self ) :
methode_name = "convert_BGR_to_Lab"
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#-------- load image data using OpneCV2 ----------
self.iv_image_data_using_Lab = \
cv2.imread ( self.iv_abs_path_of_ImageDataFile )
self.iv_image_data_using_Lab = \
cv2.cvtColor (
#loaded image data , BGR format
self.iv_loaded_image_data
#direction BGR --> Lab
, cv2.COLOR_BGR2Lab )
self.iv_image_data_Lab_prepared = "Y"
#------------------------------------------------
def get_data_of_one_pixel_Lab_format (
self
, arg_requester_module
, arg_requester_function
# in the commonly used mathematical XY cordinates
, arg_x_on_ImageData_space
, arg_y_on_ImageData_space
) :
methode_name = "get_data_of_one_pixel_Lab_format"
if ( self.iv_image_data_Lab_prepared == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
# conversion
# commonly used mathematical XY cordinates
# --> commonly used Computer Graphics XY cordinates
x_on_ImageData_space_computer_graphics \
= arg_x_on_ImageData_space
y_on_ImageData_space_computer_graphics \
= self.iv_image_data_loaded_height \
- arg_y_on_ImageData_space - 1
color_value_Lab = self.iv_image_data_using_Lab \
[
y_on_ImageData_space_computer_graphics
, x_on_ImageData_space_computer_graphics
]
return color_value_Lab
#------------------------------------------------
def insert_text_into_ImageData (
self
, arg_requester_module
, arg_requester_function
# in the commonly used mathematical XY cordinates
, arg_x_on_ImageData_space
, arg_y_on_ImageData_space
, arg_text_inserted
, arg_font_color_Blue
, arg_font_color_Green
, arg_font_color_Red
) :
methode_name = "insert_text_into_ImageData"
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#------------------------------------------
# conversion
# commonly used mathematical XY cordinates
# --> commonly used Computer Graphics XY cordinates
x_on_ImageData_space_computer_graphics = arg_x_on_ImageData_space
y_on_ImageData_space_computer_graphics = \
self.iv_image_data_loaded_height \
- arg_y_on_ImageData_space - 1
if ( ( x_on_ImageData_space_computer_graphics < 0 )
or
( x_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_width )
or
( y_on_ImageData_space_computer_graphics < 0 )
or
( y_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_height )
) :
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "arg_requester_module = " , arg_requester_module )
print ( "arg_requester_function = " , arg_requester_function )
print ( "Error !!! Over Area")
print ( "arg_x_on_ImageData_space = " , arg_x_on_ImageData_space )
print ( "arg_y_on_ImageData_space = " , arg_y_on_ImageData_space )
print ( "self.iv_image_data_loaded_width = " \
, self.iv_image_data_loaded_width )
print ( "self.iv_image_data_loaded_height = " \
, self.iv_image_data_loaded_height )
print ( "self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
self.iv_list_of_ErrorMessage [ 0 ] = \
"**** Error !!! Area Over ****"
ErrorProcess.do_error_process (
#arg_requester_module
ImageDataTwoDimensionHandling.CV_CLASS_NAME
#arg_requester_function
, methode_name
#arg_terminate_process_Y_or_N
, "Y"
#arg_self.iv_list_of_ErrorMessage
, self.iv_list_of_ErrorMessage
)
#--------------------------
cv2.putText (
self.iv_loaded_image_data
, arg_text_inserted
, (
x_on_ImageData_space_computer_graphics
, y_on_ImageData_space_computer_graphics
)
, cv2.FONT_HERSHEY_PLAIN #font_style
, 1.5 #font_size
, (
arg_font_color_Blue
, arg_font_color_Green
, arg_font_color_Red
)
, 2 #font_thickness
, cv2.LINE_AA #line_type
)
return
#------------------------------------------------
def insert_rectangle_figure_into_ImageData (
self
, arg_requester_module
, arg_requester_function
# in the commonly used mathematical XY cordinates
, arg_From_x_on_ImageData_space
, arg_From_y_on_ImageData_space
, arg_To_x_on_ImageData_space
, arg_To_y_on_ImageData_space
# -1 = Fill inside
, arg_thickness_of_figure
, arg_fill_inside_Y_or_N
, arg_color_Blue
, arg_color_Green
, arg_color_Red
) :
methode_name = "insert_rectangle_into_ImageData"
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#------------------------------------------
# conversion
# commonly used mathematical XY cordinates
# --> commonly used Computer Graphics XY cordinates
from_x_on_ImageData_space_computer_graphics = \
arg_From_x_on_ImageData_space
from_y_on_ImageData_space_computer_graphics = \
self.iv_image_data_loaded_height \
- arg_From_y_on_ImageData_space - 1
to_x_on_ImageData_space_computer_graphics = \
arg_To_x_on_ImageData_space
to_y_on_ImageData_space_computer_graphics = \
self.iv_image_data_loaded_height \
- arg_To_y_on_ImageData_space - 1
if (
#---------- about from x , y
( from_x_on_ImageData_space_computer_graphics < 0 )
or
( from_x_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_width )
or
( from_y_on_ImageData_space_computer_graphics < 0 )
or
( from_y_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_height )
or
#---------- about to x , y
( to_x_on_ImageData_space_computer_graphics < 0 )
or
( to_x_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_width )
or
( to_y_on_ImageData_space_computer_graphics < 0 )
or
( to_y_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_height )
) :
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "arg_requester_module = " , arg_requester_module )
print ( "arg_requester_function = " , arg_requester_function )
print ( "Error !!! Over Area")
print ( "arg_From_x_on_ImageData_space = " , arg_From_x_on_ImageData_space )
print ( "arg_From_y_on_ImageData_space = " , arg_From_y_on_ImageData_space )
print ( "arg_To_x_on_ImageData_space = " , arg_To_x_on_ImageData_space )
print ( "arg_To_y_on_ImageData_space = " , arg_To_y_on_ImageData_space )
print ( "self.iv_image_data_loaded_width = " \
, self.iv_image_data_loaded_width )
print ( "self.iv_image_data_loaded_height = " \
, self.iv_image_data_loaded_height )
print ( "self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
self.iv_list_of_ErrorMessage [ 0 ] = \
"**** Error !!! Area Over ****"
ErrorProcess.do_error_process (
#arg_requester_module
ImageDataTwoDimensionHandling.CV_CLASS_NAME
#arg_requester_function
, methode_name
#arg_terminate_process_Y_or_N
, "Y"
#arg_self.iv_list_of_ErrorMessage
, self.iv_list_of_ErrorMessage
)
#------------------------------
thickness_of_drawing = arg_thickness_of_figure
if ( arg_fill_inside_Y_or_N == "Y" ) :
thickness_of_drawing = -1
#--------------------------
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "from_x_on_ImageData_space_computer_graphics = " \
, from_x_on_ImageData_space_computer_graphics )
print ( "from_y_on_ImageData_space_computer_graphics = " \
, from_y_on_ImageData_space_computer_graphics )
print ( "to_x_on_ImageData_space_computer_graphics = " \
, to_x_on_ImageData_space_computer_graphics )
print ( "to_y_on_ImageData_space_computer_graphics = " \
, to_y_on_ImageData_space_computer_graphics )
print ( "arg_color_Blue = " , arg_color_Blue )
print ( "arg_color_Green = " , arg_color_Green )
print ( "arg_color_Red = " , arg_color_Red )
print ( "thickness_of_drawing = " , thickness_of_drawing )
print( "==================================" )
cv2.rectangle (
self.iv_loaded_image_data
, (
from_x_on_ImageData_space_computer_graphics
, from_y_on_ImageData_space_computer_graphics
)
, (
to_x_on_ImageData_space_computer_graphics
, to_y_on_ImageData_space_computer_graphics
)
, (
arg_color_Blue
, arg_color_Green
, arg_color_Red
)
, thickness_of_drawing
, cv2.LINE_AA # line type
)
return
#------------------------------------------------
def insert_line_figure_into_ImageData (
self
, arg_requester_module
, arg_requester_function
# in the commonly used mathematical XY cordinates
, arg_From_x_on_ImageData_space
, arg_From_y_on_ImageData_space
, arg_To_x_on_ImageData_space
, arg_To_y_on_ImageData_space
, arg_thickness_of_line_figure
, arg_color_Blue
, arg_color_Green
, arg_color_Red
) :
methode_name = "insert_text_into_ImageData"
if ( self.iv_image_data_loaded == "N" ) :
error_process_image_data_not_loaded (
arg_requester_module
, arg_requester_function
, self.iv_abs_path_of_ImageDataFile
)
#------------------------------------------
# conversion
# commonly used mathematical XY cordinates
# --> commonly used Computer Graphics XY cordinates
from_x_on_ImageData_space_computer_graphics = \
arg_From_x_on_ImageData_space
from_y_on_ImageData_space_computer_graphics = \
self.iv_image_data_loaded_height \
- arg_From_y_on_ImageData_space - 1
to_x_on_ImageData_space_computer_graphics = \
arg_To_x_on_ImageData_space
to_y_on_ImageData_space_computer_graphics = \
self.iv_image_data_loaded_height \
- arg_To_y_on_ImageData_space - 1
if (
#---------- about from x , y
( from_x_on_ImageData_space_computer_graphics < 0 )
or
( from_x_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_width )
or
( from_y_on_ImageData_space_computer_graphics < 0 )
or
( from_y_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_height )
or
#---------- about to x , y
( to_x_on_ImageData_space_computer_graphics < 0 )
or
( to_x_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_width )
or
( to_y_on_ImageData_space_computer_graphics < 0 )
or
( to_y_on_ImageData_space_computer_graphics >= \
self.iv_image_data_loaded_height )
) :
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "arg_requester_module = " , arg_requester_module )
print ( "arg_requester_function = " , arg_requester_function )
print ( "Error !!! Over Area")
print ( "arg_From_x_on_ImageData_space = " , arg_From_x_on_ImageData_space )
print ( "arg_From_y_on_ImageData_space = " , arg_From_y_on_ImageData_space )
print ( "arg_To_x_on_ImageData_space = " , arg_To_x_on_ImageData_space )
print ( "arg_To_y_on_ImageData_space = " , arg_To_y_on_ImageData_space )
print ( "self.iv_image_data_loaded_width = " \
, self.iv_image_data_loaded_width )
print ( "self.iv_image_data_loaded_height = " \
, self.iv_image_data_loaded_height )
print ( "self.iv_abs_path_of_ImageDataFile = " \
+ self.iv_abs_path_of_ImageDataFile )
print( "==================================" )
self.iv_list_of_ErrorMessage [ 0 ] = \
"**** Error !!! Area Over ****"
ErrorProcess.do_error_process (
#arg_requester_module
ImageDataTwoDimensionHandling.CV_CLASS_NAME
#arg_requester_function
, methode_name
#arg_terminate_process_Y_or_N
, "Y"
#arg_self.iv_list_of_ErrorMessage
, self.iv_list_of_ErrorMessage
)
#--------------------------
cv2.line (
self.iv_loaded_image_data
, (
from_x_on_ImageData_space_computer_graphics
, from_y_on_ImageData_space_computer_graphics
)
, (
to_x_on_ImageData_space_computer_graphics
, to_y_on_ImageData_space_computer_graphics
)
, (
arg_color_Blue
, arg_color_Green
, arg_color_Red
)
, arg_thickness_of_line_figure
, cv2.LINE_AA # line type
)
return
#------------------------------------------------
def error_process_image_data_not_loaded (
self
, arg_requester_module
, arg_requester_function
, arg_abs_path_of_ImageDataFile
) :
methode_name = "error_process_image_data_not_loaded"
print( "==================================" )
print( "Class = "
+ ImageDataTwoDimensionHandling.CV_CLASS_NAME
+ " , methode = " + methode_name )
print ( "Error !!! image data not loaded or prepared")
print ( "arg_requester_module = " , arg_requester_module )
print ( "arg_requester_function = " , arg_requester_function )
print ( "arg_abs_path_of_ImageDataFile = " \
, arg_abs_path_of_ImageDataFile )
print( "==================================" )
self.self.iv_list_of_ErrorMessage [ 0 ] = \
"**** Error !!! image data not loaded or prepared ****"
ErrorProcess.do_error_process (
#arg_requester_module
ImageDataTwoDimensionHandling.CV_CLASS_NAME
#arg_requester_function
, methode_name
#arg_terminate_process_Y_or_N
, "Y"
#arg_self.iv_list_of_ErrorMessage
, self.self.iv_list_of_ErrorMessage
)
----------
Python(パイソン) プログラム作ってみた インデックス へ