Open36

雑なメモ

sawarasawara

以下でbuild成功

M1 MBA
Unity Editor 2021.3.24f1 silicon
NRSDK 1.7.0

※Unity Editor 2022はまだビルドできてない

sawarasawara

なお、Main CameraのClear FlagsをSolid Colorにするのを忘れずに。

sawarasawara

unity Animationのpreview、Timelineのpreviewと排他なので操作できないように見えた場合は注意

sawarasawara

URPサンプルでRecorder使ったらエディタが落ちた

M1 MBA
Unity Editor 2022.3.4f1 silicon
Recorder 4.0.1
sawarasawara

freemocap、M1 MACだとPyQtのインストールでこける

Downloading PyQt6-6.6.0-cp37-abi3-macosx_10_14_universal2.whl (11.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━ 6.3/11.8 MB 11.6 MB/s eta 0:00:01
ERROR: Exception:
sawarasawara

https://github.com/cvg/VP-Estimation-with-Prior-Gravity/blob/main/notebooks/demo_vp_estimation_prior_gravity.ipynb

VP-Estimation-with-Prior-Gravityのnotebook -> Pythonスクリプト


import os
import numpy as np
import cv2
import sys
import random

from vp_estimation_with_prior_gravity.features.line_detector import LineDetector
sys.path.append(os.path.join(os.path.dirname(os.path.abspath("")), "build/vp_estimation_with_prior_gravity"))
from vp_estimation_with_prior_gravity.solvers import run_hybrid_uncalibrated
from vp_estimation_with_prior_gravity.evaluation import project_vp_to_image, get_labels_from_vp
from vp_estimation_with_prior_gravity.visualization import plot_images, plot_vp, plot_lines, save_plot

img_path = "{your_path}"
out_path = "{your_path}"

SOLVER_FLAGS = [True, True, True, True, True]
th_pixels = 3  # RANSAC inlier threshold
ls_refinement = 2  # 3 uses the gravity in the LS refinement, 2 does not. Here we use a prior on the gravity, so use 2
nms = 1  # change to 3 to add a Ceres optimization after the non minimal solver (slower)
magsac_scoring = True
img = cv2.imread(img_path, 0)

vertical = np.array([0., 1, 0.])
    
# Intrinsics matrix obtained from the Yor Urban dataset
K = np.array([[674.91797516, 0., 306.55130528],
              [0., 674.91797516, 250.45424496],
              [0., 0., 1.]])

              
line_type = 'lsd'  # 'lsd' or 'deeplsd'  # 依存してないんかい!
line_detector = LineDetector(line_detector=line_type)
lines = line_detector.detect_lines(img)[:, :, [1, 0]]

principle_point = np.array([img.shape[1] / 2.0, img.shape[0] / 2.0])
f, vp = run_hybrid_uncalibrated(
    lines - principle_point[None, None, :],
    vertical, th_pixels=th_pixels, ls_refinement=ls_refinement,
    nms=nms, magsac_scoring=magsac_scoring, sprt=True, solver_flags=SOLVER_FLAGS)
vp[:, 1] *= -1

# Get the line-VP assignment
vp_labels = get_labels_from_vp(lines[:, :, [1, 0]], project_vp_to_image(vp, K), threshold=th_pixels)[0]

# Plot the results
plot_images([img, img])
plot_lines([lines, np.empty((0, 2, 2))])
plot_vp([np.empty((0, 2, 2)), lines], [[], vp_labels])
save_plot(out_path)

sawarasawara

databricks pythonイメージのpythonパス、

/databricks/python3/bin/python3

sawarasawara

ceres-solver on m1mac

brew install ceres-solver
brew install cmake

cmake

cmake_minimum_required(VERSION 3.6)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
project(Main)
add_executable(Main hello.cpp)

# https://qiita.com/mitsuruk9999/items/b8a4094f558a9c36e208
# sudo ln -s /opt/homebrew/include/eigen3/Eigen /opt/homebrew/include/Eigen
set(BREW_DIR "/opt/homebrew")
target_include_directories(${PROJECT_NAME} PRIVATE ${BREW_DIR}/include)
target_link_directories(${PROJECT_NAME} PRIVATE ${BREW_DIR}/lib)

exampleのソース
https://ceres-solver.googlesource.com/ceres-solver/+/master/examples