回答編集履歴
3
d
answer
CHANGED
@@ -65,4 +65,18 @@
|
|
65
65
|
|
66
66
|
cv2.imshow('image', img)
|
67
67
|
cv2.waitKey()
|
68
|
+
```
|
69
|
+
|
70
|
+
## Jupyter Notebook で表示する場合
|
71
|
+
|
72
|
+
```python
|
73
|
+
import cv2
|
74
|
+
from IPython.display import Image, display
|
75
|
+
|
76
|
+
def imshow(img):
|
77
|
+
img = cv2.imencode('.png', img)[1]
|
78
|
+
display(Image(img))
|
79
|
+
|
80
|
+
img = cv2.imread('test.jpg')
|
81
|
+
imshow(img)
|
68
82
|
```
|
2
d
answer
CHANGED
@@ -61,7 +61,7 @@
|
|
61
61
|
```python
|
62
62
|
import cv2
|
63
63
|
|
64
|
-
img = cv2.imread(r'C:\Users\
|
64
|
+
img = cv2.imread(r'C:\Users\myname\Desktop\test.jpg')
|
65
65
|
|
66
66
|
cv2.imshow('image', img)
|
67
67
|
cv2.waitKey()
|
1
d
answer
CHANGED
@@ -54,4 +54,15 @@
|
|
54
54
|
img = cv2.imread(path)
|
55
55
|
if img is None:
|
56
56
|
print('Failed to load image.')
|
57
|
+
```
|
58
|
+
|
59
|
+
## 追記 (動作確認したコード)
|
60
|
+
|
61
|
+
```python
|
62
|
+
import cv2
|
63
|
+
|
64
|
+
img = cv2.imread(r'C:\Users\papillon\Desktop\test.jpg')
|
65
|
+
|
66
|
+
cv2.imshow('image', img)
|
67
|
+
cv2.waitKey()
|
57
68
|
```
|