Skip to content

Commit f377e7c

Browse files
Merge pull request #184 from CWRUbotix/photosphere-interface
Photosphere interface
2 parents 35b5926 + 1dab08d commit f377e7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+83819
-250
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ eeprom.bin
3737
*.DS_Store
3838

3939
# Mavproxy Files
40-
*.parm
40+
*.parm
41+
42+
# Images
43+
src/photosphere/display/projection.jpg

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ repos:
1010
pass_filenames: false
1111
# Run the formatter.
1212
- id: ruff-format
13+
exclude: src/surface/photosphere/photosphere/projection_matrix/.*
1314
- repo: https://github.com/pre-commit/mirrors-clang-format
1415
rev: v20.1.5
1516
hooks:
File renamed without changes.

src/photosphere/cam_test.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import cv2
2+
3+
4+
def set_dims(vid: cv2.VideoCapture, width: int, height: int) -> None:
5+
vid.set(cv2.CAP_PROP_FRAME_WIDTH, width)
6+
vid.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
7+
8+
9+
# Size: Discrete 800x600
10+
# Interval: Discrete 0.033s (30.000 fps)
11+
# Size: Discrete 3840x2160
12+
# Interval: Discrete 0.033s (30.000 fps)
13+
# Size: Discrete 3840x2880
14+
# Interval: Discrete 0.067s (15.000 fps)
15+
# Size: Discrete 416x312
16+
# Interval: Discrete 0.033s (30.000 fps)
17+
# Size: Discrete 640x480
18+
# Interval: Discrete 0.033s (30.000 fps)
19+
# Size: Discrete 1280x720
20+
# Interval: Discrete 0.033s (30.000 fps)
21+
# Size: Discrete 1920x1080
22+
# Interval: Discrete 0.033s (30.000 fps)
23+
# Size: Discrete 3840x3032
24+
# Interval: Discrete 0.067s (15.000 fps)
25+
26+
27+
vid = cv2.VideoCapture('/dev/video0')
28+
# vid.set(cv2.CAP_PROP_FRAME_WIDTH, 3840)
29+
# vid.set(cv2.CAP_PROP_FRAME_HEIGHT, 3032)
30+
# print(vid.get(cv2.CAP_PROP_FOURCC))
31+
# vid.set(cv2.CAP_PROP_FOURCC, '')
32+
mjpg = cv2.VideoWriter.fourcc('M', 'J', 'P', 'G')
33+
yuyv = cv2.VideoWriter.fourcc('Y', 'U', 'Y', 'V')
34+
print('MJPG ==', mjpg)
35+
print('YUYV ==', yuyv)
36+
print('cam ==', vid.get(cv2.CAP_PROP_FOURCC))
37+
vid.set(cv2.CAP_PROP_FOURCC, mjpg)
38+
print('cam ==', vid.get(cv2.CAP_PROP_FOURCC))
39+
set_dims(vid, 3840, 3032)
40+
# vid.set(cv2.CAP_PROP_MODE, 0)
41+
42+
while vid.isOpened():
43+
img, frame = vid.read()
44+
frame = cv2.resize(frame, (960, 758), interpolation=cv2.INTER_LINEAR)
45+
46+
cv2.imshow('TRANSMITTING VIDEO', frame)
47+
key = cv2.waitKey(1) & 0xFF
1.2 KB
Binary file not shown.

src/photosphere/display/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<html>
2+
<head>
3+
<title>CWRUbotix Photosphere</title>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
6+
<link rel="stylesheet" href="/index.min.css" />
7+
8+
<style>
9+
img {
10+
height: 0.9em;
11+
}
12+
13+
h1 {
14+
font-size: 4em;
15+
text-align: center;
16+
/* color: #4178C1; */
17+
}
18+
div {
19+
margin:auto;
20+
}
21+
</style>
22+
</head>
23+
<body>
24+
<h1><img src="logo.png"/>CWRUbotix Photosphere</h1>
25+
<div id="viewer" style="width: 500px; height: 500px;"></div>
26+
27+
<script type="importmap">
28+
{
29+
"imports": {
30+
"three": "/three.module.js",
31+
"@photo-sphere-viewer/core": "/index.module.js"
32+
}
33+
}
34+
</script>
35+
36+
<script type="module">
37+
import { Viewer } from '@photo-sphere-viewer/core';
38+
39+
const viewer = new Viewer({
40+
container: document.querySelector('#viewer'),
41+
panorama: 'projection.jpg',
42+
});
43+
</script>
44+
</body>
45+
</html>

src/photosphere/display/index.min.css

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)