去除黑边

This commit is contained in:
FEIJINTI 2023-03-15 15:27:39 +08:00
parent cafcd835cb
commit 5788e9dafd

View File

@ -33,8 +33,10 @@ FEATURE_INDEX = [0, 1, 2]
delete_columns = 10 # 已弃用
num_bins = 10
class WoodClass(object):
def __init__(self, load_from=None, w=2048, h=12450, n=5000, p1=0.3, pur=0.99999, left_correct=False, single_pick_mode=False,
def __init__(self, load_from=None, w=2048, h=12450, n=5000, p1=0.3, pur=0.99999, left_correct=False,
single_pick_mode=False,
debug_mode=False):
"""
初始化.
@ -372,7 +374,6 @@ class WoodClass(object):
pass
return x_data, y_data
def realtime_correction(self, img):
"""
实时校正
@ -398,6 +399,7 @@ class WoodClass(object):
:return: 校正后的图片 shape = (n_rows, n_cols - cut_col_num, n_channels)
"""
if self.left_correct:
img = img[:, 20:, :]
# 按照correct_col_num列数量取出最左侧校正板区域成像结果
correct_img = img[:, :correct_col_num, :]
# 校正区域进行均值化
@ -412,6 +414,7 @@ class WoodClass(object):
if __name__ == '__main__':
from config import Config
settings = Config()
# 初始化wood
wood = WoodClass(w=4096, h=1200, n=12500, p1=0.4, debug_mode=False)
@ -430,4 +433,3 @@ if __name__ == '__main__':
end_time = time.time()
print("time consume:" + str((end_time - start_time) / 100))
print("wood_color:" + str(wood_color))