小编Raf*_*azZ的帖子

hf-tikz和狮身人面像不能一起玩

我试图在狮身人面像中为矩阵添加一些颜色。我以前使用过hf-tikz。但是,当我将其添加到Sphinx时,它会错误地呈现它。

我想要得到的结果是

在此处输入图片说明

我得到的结果是

在此处输入图片说明

这是我的代码。

main.rst

.. math::

    \left(\begin{array}{cc}
        \tikzmarkin[style red]{a}a\tikzmarkend{a}
      & \tikzmarkin[style green]{b}b\tikzmarkend{b} \\
        \tikzmarkin[style blue]{c}c\tikzmarkend{c}
      & \tikzmarkin[style orange]{d}d\tikzmarkend{d} \\
    \end{array}\right)
    \star
    \left(\begin{array}{cc}
        \tikzmarkin[style red]{w}w\tikzmarkend{w}
      & \tikzmarkin[style green]{x}x\tikzmarkend{x} \\
        \tikzmarkin[style blue]{y}y\tikzmarkend{y}
      & \tikzmarkin[style orange]{z}z\tikzmarkend{z} \\
    \end{array}\right)
    =
    \left(\begin{array}{cc}
        \tikzmarkin[hor=style red]{aw}{a\star w}\tikzmarkend{aw}
      & \tikzmarkin[hor=style green]{bx}b\star x\tikzmarkend{bx} \\
        \tikzmarkin[hor=style blue]{cy}c\star y\tikzmarkend{cy}
      & \tikzmarkin[hor=style orange]{dz}d\star z\tikzmarkend{dz} \\
    \end{array}\right)

Run Code Online (Sandbox Code Playgroud)

conf.py

extensions = [
  'sphinx.ext.imgmath',
]

# Math configurations (https://tex.stackexchange.com/a/69770/51173)
imgmath_image_format = 'svg'
imgmath_use_preview = True
imgmath_latex_preamble = r'''
  \usepackage{xcolor}
  \usepackage[customcolors]{hf-tikz}
  \colorlet{myred}{red!50!purple!30} …
Run Code Online (Sandbox Code Playgroud)

latex tikz python-sphinx

7
推荐指数
1
解决办法
121
查看次数

OpenCV取消投影2D指向深度为Z的3D

问题陈述

假设我知道每个点的距离,我尝试将2D点重新投影到其原始3D坐标。遵循OpenCV文档,我设法使其与零失真一起工作。但是,当存在变形时,结果将不正确。

目前的方法

因此,其想法是扭转以下情况:

投影变形

分为以下内容:

在此处输入图片说明

通过:

  1. 摆脱任何扭曲使用 cv::undistortPoints
  2. 通过逆转上面的第二个方程,使用内在函数返回归一化的相机坐标
  3. 乘以z反向标准化。

问题

  1. 为什么我需要减去f_xf_y返回归一化的相机坐标(在测试时凭经验找到)?在下面的代码中,在第2步中,如果我不减去-即使未失真的结果也关闭了,这是我的错误-我弄乱了索引。
  2. 如果包含变形,结果将是错误的-我在做什么错?

样例代码(C ++)

#include <iostream>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <vector>

std::vector<cv::Point2d> Project(const std::vector<cv::Point3d>& points,
                                 const cv::Mat& intrinsic,
                                 const cv::Mat& distortion) {
  std::vector<cv::Point2d> result;
  if (!points.empty()) {
    cv::projectPoints(points, cv::Mat(3, 1, CV_64F, cvScalar(0.)),
                      cv::Mat(3, 1, CV_64F, cvScalar(0.)), intrinsic,
                      distortion, result);
  }
  return result;
}

std::vector<cv::Point3d> Unproject(const std::vector<cv::Point2d>& points,
                                   const std::vector<double>& Z,
                                   const cv::Mat& intrinsic,
                                   const cv::Mat& distortion) { …
Run Code Online (Sandbox Code Playgroud)

c++ python opencv projection 3d-reconstruction

5
推荐指数
1
解决办法
2553
查看次数

OpenCV (Python) 视频子图

我试图在同一个图中显示两个 OpenCV 视频源作为子图,但找不到如何做到这一点。当我尝试使用时plt.imshow(...), plt.show(),窗口甚至不会出现。当我尝试使用 时cv2.imshow(...),它显示两个独立的数字。我真正想要的是子图:(。有什么帮助吗?

这是我到目前为止的代码:

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

cap = cv2.VideoCapture(0)
ret, frame = cap.read()

while(True):
    ret, frame = cap.read()
    channels = cv2.split(frame)
    frame_merge = cv2.merge(channels)

    #~ subplot(211), plt.imshow(frame)
    #~ subplot(212), plt.imshow(frame_merged)
    cv2.imshow('frame',frame)
    cv2.imshow('frame merged', frame_merge)
    k = cv2.waitKey(30) & 0xff
    if k == 27:
        break

cap.release()
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)

更新:理想情况下,输出应该类似于:

OpenCV 视频的子图

python opencv matplotlib subplot

4
推荐指数
1
解决办法
3651
查看次数

.gitconfig [alias]无法识别字符串

我正在尝试为我的GIT创建一个看起来像这样的别名:

[alias]
    send = !git add . && git commit -m "AUTOCOMMIT: $(date)" && git push
Run Code Online (Sandbox Code Playgroud)

此别名适用于不需要任何消息的微小修改.问题是每当我运行git send它时返回以下内容:

$ git send
error: pathspec 'Fri' did not match any file(s) known to git.
error: pathspec 'Aug' did not match any file(s) known to git.
error: pathspec '22' did not match any file(s) known to git.
error: pathspec '11:31:18' did not match any file(s) known to git.
error: pathspec 'PDT' did not match any file(s) known to git.
error: pathspec …
Run Code Online (Sandbox Code Playgroud)

git alias git-config

3
推荐指数
1
解决办法
274
查看次数

需要引用和解除引用指向根的二叉树指针.为什么?

我的问题是为什么我需要取消引用并引用以下代码的指针才能工作?不参考/反对取消吗?我真的很感激,如果有人能解释它,就像我五岁:)

码:

template <typename T> 
class binNode {
private:
    T key;
public:
    binNode * left;
    binNode * right;
    binNode * parent;
    binNode() {
        this->left = NULL;
        this->right = NULL;
        this->parent = NULL;
    }
    // arg constructor:
    binNode (T key) {
        this->key = key;
        this->left = NULL;
        this->right = NULL;
        this->parent = NULL;
    }

    T getKey() {
        return this->key;
    }
    void setKey(T key) {
        this->key = key;
    }
};

template<typename T> class Tree {
private:
    binNode <T> *root;
public:
    Tree() { …
Run Code Online (Sandbox Code Playgroud)

c++ binary-tree pointers reference dereference

1
推荐指数
1
解决办法
543
查看次数