當前位置: 首頁>>代碼示例>>Python>>正文


Python FileIO.read_shots_from_csv方法代碼示例

本文整理匯總了Python中FileIO.read_shots_from_csv方法的典型用法代碼示例。如果您正苦於以下問題:Python FileIO.read_shots_from_csv方法的具體用法?Python FileIO.read_shots_from_csv怎麽用?Python FileIO.read_shots_from_csv使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FileIO的用法示例。


在下文中一共展示了FileIO.read_shots_from_csv方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: html_stuff

# 需要導入模塊: import FileIO [as 別名]
# 或者: from FileIO import read_shots_from_csv [as 別名]
def html_stuff(stitched_shots, all_shots, outstitched_shots, ground_truth_file, filename1, filename2, output):
    data_prefix = 0
    data_vars1 = 'var jumpoffs = ['
    data_vars2 = 'var all_scenes = ['
    data_vars3 = 'var jo = ['
    data_suffix = 0

    #read ground truth for shot boundaries
    ground_truth_data = FileIO.read_shots_from_csv(ground_truth_file)

    #get start- and end-frames
    last_element = stitched_shots[len(stitched_shots)-1]
    for i in stitched_shots:
        a,b = ground_truth_data[i[0]]
        if i is not last_element:
            data_vars1 += str(a) + ', '
        else:
            data_vars1 += str(a) + '];\n'

    last_element = all_shots[len(all_shots)-1]
    for shot in all_shots:
        a,b = shot
        if shot is not last_element:
            data_vars2 += str(a) + ', '
        else:
            data_vars2 += str(a) + '];\n'

    #get start- and end-frames
    last_element = outstitched_shots[len(outstitched_shots)-1]
    for i in outstitched_shots:
        a,b = ground_truth_data[i]
        if i is not last_element:
            data_vars3 += str(a) + ', '
        else:
            data_vars3 += str(a) + '];\n'

    #read prefix and suffix (html and javascript code)
    with open(filename1, 'r') as f1:
        data_prefix = f1.read()
    f1.close()
    with open(filename2, 'r') as f2:
        data_suffix = f2.read()
    f2.close()

    string = data_prefix + data_vars1 + data_vars2 + data_vars3 + data_suffix

    with open(output, 'w') as f:
        f.write(string)
    f.close()
開發者ID:zexe,項目名稱:video_ret_proj1,代碼行數:51,代碼來源:HTML.py


注:本文中的FileIO.read_shots_from_csv方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。