我有以下分辨率为 1600x1300 的相机矩阵
M1 [3x3] =
[ 1.3964689860209282e+03, 0., 8.3190541322575655e+02,
0., 1.3964689860209282e+03, 5.9990987893769318e+02,
0., 0., 1. ]
Run Code Online (Sandbox Code Playgroud)
D1 [1x14] =
[ 8.0832142609575899e-02, -8.0503813500794497e-02, -1.3722038479715831e-03, -6.9032844088890799e-04, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ]
Run Code Online (Sandbox Code Playgroud)
我需要将分辨率更改为 1280x720,但此分辨率是裁剪后的分辨率(未调整大小)。我知道我必须更新 cx 和 cy。裁剪操作后畸变系数会改变吗?
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
img = cv.imread('t2.jpg', cv.COLOR_BGR2GRAY)
blur = cv.GaussianBlur(img, (5, 5), 0)
ret3, th3 = cv.threshold(blur, 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)
Run Code Online (Sandbox Code Playgroud)
我收到错误:
Traceback (most recent call last):
File "F:/l4 project docs/project/l4proTest1/projectionStepTest.py", line 11, in <module>
ret3,th3 = cv.threshold(blur, 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)
cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-9d_dfo3_\opencv\modules\imgproc\src\thresh.cpp:1557: error: (-2:Unspecified error) in function 'double __cdecl cv::threshold(const class cv::_InputArray &,const class cv::_OutputArray &,double,double,int)'
Run Code Online (Sandbox Code Playgroud)
THRESH_OTSU mode:
'src_type == CV_8UC1 || src_type == …Run Code Online (Sandbox Code Playgroud) 我将这个简单的代码编译为 g++ main.cpp -o main -std=c++03
#include <vector>
int main(){
std::vector<int> array;
std::vector<int> array2 = { 9, 7, 5, 3, 1 };
}
Run Code Online (Sandbox Code Playgroud)
我收到以下编译错误:
main.cpp: 在函数 'int main()':
main.cpp:39:18: 错误:在 C++98 中,'array2' 必须由构造函数初始化,而不是由 '{...}'
std::vector数组 2 = { 9, 7, 5, 3, 1 };
^~~~~~
main.cpp:39:43: 错误:无法将 '{9, 7, 5, 3, 1}' 从 '' 转换为 'std::vector'
std::vector array2 = { 9 , 7, 5, 3, 1 };
似乎即使我正在使用-std=c++03(初始化列表可用的地方)进行编译,但我仍在使用 C++98 标准。为什么会这样?
我知道此代码将使用更新的标准进行编译。