Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Pythonによる工業用カメラ画像取得事例
Search
OHNO
August 08, 2020
Programming
1.5k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Pythonによる工業用カメラ画像取得事例
OHNO
August 08, 2020
More Decks by OHNO
See All by OHNO
自社データを生成AIに活用
planeta
0
120
生成系AIで自データを扱うには
planeta
0
240
外観検査の難しさ
planeta
0
570
儲かるPython
planeta
0
260
画像処理ライブラリOpenCVの使い方0910
planeta
0
1.5k
画像処理ライブラリOpenCVの使い方
planeta
0
1.1k
SONYのNNC
planeta
0
650
機械学習による動作認識
planeta
0
800
画像類似度計算
planeta
0
2.1k
Other Decks in Programming
See All in Programming
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
130
すこし踏み込む CancellationToken
htkym
2
1.7k
Agents on Rails - Rails at Scale 2026
irinanazarova
0
520
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
140
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
320
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
1
230
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
360
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
750
SREの越境 / SRE Collaboration
y0hgi
2
300
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
470
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Practical Orchestrator
shlominoach
192
12k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Designing for humans not robots
tammielis
254
26k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
550
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
BBQ
matthewcrist
90
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
WCS-LA-2024
lcolladotor
0
870
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Being A Developer After 40
akosma
92
590k
Transcript
Pythonによる工業用カメラ 画像取得事例 TensorFlow User Group Niigata #3 大野 宏
画像分類をするためには ・製造業で画像分類や傷を検査するためには、多くの高 解像度の画像が必要 ・PythonではUSBカメラの画像の取得は容易であるが、高 解像度の工業用カメラは・・・ ・メーカが提供するライブラリは、C、C#、C++ ・画像取り込みはC、画像分類はPython → 同じ言語で画像取り込みから分類まで出来るとよい 露光時間、フレームレート等を制御可能
Basler 社のカメラ https://www.baslerweb.com/jp/products/software/basler-pylon- camera-software-suite/pylon-open-source-projects/
Pythonライブラリ https://github.com/basler/pypylon
PythonによるUSBカメラ画像取得 ・画像処理ライブラリOpenCVを使ったプログラム import cv2 capture = cv2.VideoCapture(1) while(True): ret, frame
= capture.read() cv2.imshow('title',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break
Pythonプログラム1/3 from pypylon import pylon from pypylon import genicam import
sys import cv2 import numpy as np width = 2044 height = 1536 img1 = np.zeros((height, width, 1), np.uint8) countOfImagesToGrab = 10 exitCode = 0 try: camera =pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice()) camera.Open() print("Using device ", camera.GetDeviceInfo().GetModelName()) new_width = camera.Width.GetValue() - camera.Width.GetInc()
Pythonプログラム2/3 if new_width >= camera.Width.GetMin(): camera.Width.SetValue(new_width) camera.MaxNumBuffer = 5 while
True: camera.StartGrabbingMax(1) while camera.IsGrabbing(): grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException) if grabResult.GrabSucceeded(): img = grabResult.Array cv2.imshow("img",img) key=cv2.waitKey(1) else: print("Error: ", grabResult.ErrorCode, grabResult.ErrorDescription) if key=='q’: break grabResult.Release()
Pythonプログラム3/3 camera.Close() except genicam.GenericException as e: # Error handling. print("An
exception occurred.") print(e.GetDescription()) exitCode = 1 sys.exit(exitCode)