回答編集履歴
3
d
test
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
cv2.Stitcher_create() をお使いください (OpenCV 4)
|
2
2
|
|
3
3
|
|
4
|
+
|
5
|
+
```bash
|
6
|
+
|
7
|
+
pip install --upgrade opencv-contrib-python
|
8
|
+
|
9
|
+
```
|
4
10
|
|
5
11
|
|
6
12
|
|
@@ -12,17 +18,23 @@
|
|
12
18
|
|
13
19
|
# 画像を読み込む。
|
14
20
|
|
15
|
-
img1 = cv2.imread('
|
21
|
+
img1 = cv2.imread('a.png')
|
16
22
|
|
17
|
-
img2 = cv2.imread('
|
23
|
+
img2 = cv2.imread('b.png')
|
18
24
|
|
19
25
|
|
20
26
|
|
21
|
-
# パノラマ合成
|
27
|
+
# パノラマ合成する。
|
22
28
|
|
23
29
|
stitcher = cv2.Stitcher_create(True)
|
24
30
|
|
31
|
+
status, stitched = stitcher.stitch([img1, img2])
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
# 保存する。
|
36
|
+
|
25
|
-
cv2.imwrite('output.png', stitche
|
37
|
+
cv2.imwrite('output.png', stitched)
|
26
38
|
|
27
39
|
```
|
28
40
|
|
2
d
test
CHANGED
@@ -15,10 +15,6 @@
|
|
15
15
|
img1 = cv2.imread('sample1.png')
|
16
16
|
|
17
17
|
img2 = cv2.imread('sample2.png')
|
18
|
-
|
19
|
-
imshow(img1)
|
20
|
-
|
21
|
-
imshow(img2)
|
22
18
|
|
23
19
|
|
24
20
|
|
1
d
test
CHANGED
@@ -7,16 +7,6 @@
|
|
7
7
|
```python
|
8
8
|
|
9
9
|
import cv2
|
10
|
-
|
11
|
-
from IPython.display import Image, display
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def imshow(img):
|
16
|
-
|
17
|
-
ret, img = cv2.imencode('.png', img)
|
18
|
-
|
19
|
-
display(Image(img))
|
20
10
|
|
21
11
|
|
22
12
|
|
@@ -36,9 +26,7 @@
|
|
36
26
|
|
37
27
|
stitcher = cv2.Stitcher_create(True)
|
38
28
|
|
39
|
-
|
29
|
+
cv2.imwrite('output.png', stitcher)
|
40
|
-
|
41
|
-
imshow(stitched)
|
42
30
|
|
43
31
|
```
|
44
32
|
|