Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voxels upscale #23

Merged
merged 8 commits into from
Feb 8, 2024
Merged

Voxels upscale #23

merged 8 commits into from
Feb 8, 2024

Conversation

SirTruber
Copy link

No description provided.

test/test_main.cpp Outdated Show resolved Hide resolved
src/voxel_up.cpp Outdated Show resolved Hide resolved
@dkurt dkurt mentioned this pull request Feb 7, 2024
6 tasks
@dkurt
Copy link
Owner

dkurt commented Feb 7, 2024

Use this with the latest commit:

import matplotlib.pyplot as plt
import numpy as np
import cv2 as cv

slices = []
for i in range(1, 144):
    slices.append(cv.imread(f"/home/dkurtaev/upscale/new_image{i:04}.png", cv.IMREAD_UNCHANGED))
    slices[-1] = cv.rotate(slices[-1], cv.ROTATE_90_CLOCKWISE)
    slices[-1][...,3] = slices[-1][...,3] > 100

img = np.stack(slices, axis=2)

x, y, z = np.indices((img.shape[0] + 1, img.shape[1] + 1, img.shape[2] + 1))
is_visible = img[...,3]

img = img.astype(np.float32) / 255
colors = img[..., [2, 1, 0]]

ax = plt.figure().add_subplot(projection='3d')
ax.voxels(x, y, z, is_visible,
          facecolors=colors,
          edgecolors=np.clip(2*colors - 0.5, 0, 1),  # brighter
          linewidth=0.5)
ax.set(xlabel='x', ylabel='y', zlabel='z')
ax.set_aspect('equal')

plt.savefig("img.png")

@dkurt
Copy link
Owner

dkurt commented Feb 7, 2024

Hide all Halide related parts to #ifdef as in other algorithms.

@dkurt dkurt merged commit a6d731b into dkurt:main Feb 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants