質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
OpenCV

OpenCV(オープンソースコンピュータービジョン)は、1999年にインテルが開発・公開したオープンソースのコンピュータビジョン向けのクロスプラットフォームライブラリです。

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

Q&A

1回答

208閲覧

githubのプログラムを使用したい

ruuburubijutuka

総合スコア16

OpenCV

OpenCV(オープンソースコンピュータービジョン)は、1999年にインテルが開発・公開したオープンソースのコンピュータビジョン向けのクロスプラットフォームライブラリです。

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

0グッド

0クリップ

投稿2019/02/08 03:05

リンク

上記のURLにあるプログラムをgit cloneして使用しようとしています.

python views.pyの項までは,実行できました.
http://localhost:5000にアクセス後の画面で上の画像のように領域があるはずなのですが,エラーの下の画像では出てきません.何が問題なのでしょうか.ご回答よろしくお願いします.
イメージ
エラー

python

1# -*- coding: utf-8 -*- 2 3from flask import * 4import os, sys 5import json 6import re 7import sys 8 9app = Flask(__name__) 10app.secret_key = '佐久間さん可愛い' 11 12#画像の準備 13image_ptrn = re.compile('.*[.](jpg|jpeg|png|bmp|gif)$') 14image_dir = os.path.join( 'static', 'img' ) 15images = [] 16images = [ image for image in os.listdir( image_dir ) if re.match( image_ptrn, image ) ] 17if not len( images ): 18 sys.exit( 'Error: Could not find images') 19 20logf = open('log.dat', 'w') 21 22pos = 0 23 24@app.route('/') 25def index(): 26 27 global pos 28 29 #正例と負例用のファイル 30 global positive 31 global negative 32 33 positive = open('info.dat', 'a') 34 negative = open('bg.txt', 'a') 35 36 #最初の画像 37 imgsrc = os.path.join( image_dir, images[pos] ) 38 imgnum = len(images) 39 count = pos 40 counter = ''.join( [ str(pos+1).zfill( len(str(imgnum)) ), ' of ', str(imgnum) ] ) 41 42 return render_template( 'index.html', imgsrc=imgsrc, imgnum=imgnum, count=count, counter=counter ) 43 44@app.route('/_next') 45def _next(): 46 47 global pos 48 49 #その画像をスキップするか 50 skip = request.args.get('skip') 51 52 if skip == u'0': 53 54 #囲まれた範囲の座標 55 coords = request.args.get('coords') 56 coords = json.loads(coords) 57 58 #処理中の画像のパス 59 image_path = os.path.join( image_dir, images[pos] ) 60 61 #正例か負例か 62 if len(coords) == 0: 63 negative.write( ''.join( [ image_path, '\n' ] ) ) 64 logf.write( ''.join( [ image_path, '\n' ] ) ) 65 logf.flush() 66 67 else: 68 s = '' 69 for coord in coords: 70 s = ' '.join( [ s, ' '.join( [ str(int(e)) for e in coord ] ) ] ) 71 72 positive.write('%s %d%s\n' % (image_path, len(coords), s)) 73 logf.write( "%s %d%s\n" % (image_path, len(coords), s) ) 74 logf.flush() 75 76 #まだ画像があるか 77 if pos+1 >= len(images): 78 imgsrc = "" 79 finished = True 80 pos = pos + 1 81 logf.close() 82 negative.close() 83 positive.close() 84 else: 85 finished = False 86 imgsrc = os.path.join( image_dir, images[pos+1] ) 87 pos = pos + 1 88 89 return jsonify( imgsrc=imgsrc, finished=finished, count=pos ) 90 91if __name__ == '__main__': 92 app.debug = True 93 app.run() 94

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

まずはその作者に問い合わせるべきものでは

投稿2019/02/08 03:18

y_waiwai

総合スコア87719

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問