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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
790
画像類似度計算
planeta
0
2.1k
Other Decks in Programming
See All in Programming
Agents on Rails - Rails at Scale 2026
irinanazarova
0
310
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
160
速習iPhone Duo対応
yuukiw00w
2
920
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.3k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
460
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
580
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
450
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
270
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
Practical Orchestrator
shlominoach
192
12k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
750
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
500
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
Color Theory Basics | Prateek | Gurzu
gurzu
1
480
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Odyssey Design
rkendrick25
PRO
2
850
Building a Scalable Design System with Sketch
lauravandoore
464
34k
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)