我有一个立体摄像系统和正确使用这两种校准它,cv::calibrateCamera
并cv::stereoCalibrate
.我reprojection error
似乎还可以:
我通过cv::stereoRectify
使用cv::initUndistortRectifyMap
和调用和转换我的图像来检查我的校准cv::remap
.结果如下所示(我注意到有些奇怪的是,当显示校正后的图像时,通常会在一个或有时甚至两个图像上以原始图像的变形副本的形式存在伪影):
我还使用cv::findContours
阈值化的HSV图像正确估计了我的标记在像素坐标中的位置.
不幸的是,当我现在尝试cv::triangulatePoints
我的结果与估计的坐标相比非常差,特别是在x方向:
P1 = { 58 (±1), 150 (±1), -90xx (±2xxx) } (bottom)
P2 = { 115 (±1), -20 (±1), -90xx (±2xxx) } (right)
P3 = { 1155 (±6), 575 (±3), 60xxx (±20xxx) } (top-left)
Run Code Online (Sandbox Code Playgroud)
这些是相机坐标中mm的结果.两个相机的位置距离棋盘大约550毫米,方形尺寸为13毫米.显然,我的结果甚至没有达到我的预期(负和巨大的z坐标).
所以我的问题是:
stereo_calib.cpp
非常仔细地跟踪了样本,我似乎至少在视觉上获得了良好的结果(参见重投影错误).为什么我的三角测量结果如此糟糕?这是我的代码:
std::vector<std::vector<cv::Point2f> > imagePoints[2];
std::vector<std::vector<cv::Point3f> > objectPoints;
imagePoints[0].resize(s->nrFrames);
imagePoints[1].resize(s->nrFrames);
objectPoints.resize( s->nrFrames );
// [Obtain image …
Run Code Online (Sandbox Code Playgroud) 我有一个运行Ubuntu Precise的Dell Precision Rack,配备两个Tesla C2075和一个显示设备Quadro 600.我最近在我的桌面计算机上完成了一些测试,现在尝试将东西移植到工作站.
由于CUDA不存在,我根据本指南安装了它,并根据这个建议调整了SDK Makefile .
我现在面临的是,没有一个样本(我测试了10个不同的样本)正在运行.这些是我得到的错误:
[deviceQuery] starting...
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 10
-> invalid device ordinal
[deviceQuery] test results...
FAILED
> exiting in 3 seconds: 3...2...1...done!
Run Code Online (Sandbox Code Playgroud)
[MonteCarloMultiGPU] starting...
CUDA error at MonteCarloMultiGPU.cpp:235 code=23510 (cudaErrorInvalidDevice) "cudaGetDeviceCount(&GPU_N)"MonteCarloMultiGPU
==================
Parallelization method = threaded
Problem scaling = weak
Number of GPUs = 0
Total number of options = 0
Number of paths = 262144
main(): generating …
Run Code Online (Sandbox Code Playgroud) 我想在我的Enum
值中存储其他信息,因此想出了属性.因为我想要一个属性来携带1..n strings
我试图让属性构造函数接受一个变量参数.像这样:
[AttributeUsage(AttributeTargets.Enum, AllowMultiple = false, Inherited = false)]
public class FileTypeAttribute : Attribute
{
public readonly string[] Extensions;
FileTypeAttribute(params string[] extensions)
{
this.Extensions = extensions;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我现在尝试使用我的属性时,我的编译器会抱怨并留下以下错误消息,我真的不明白:
public enum EFileType
{
[FileTypeAttribute("txt")]
TEXTFILE,
[FileTypeAttribute("jpg", "png")]
PICTURE
}
Run Code Online (Sandbox Code Playgroud)
给我:
'FileTypeAttribute' does not contain a constructor that takes '1' arguments
和
'FileTypeAttribute' does not contain a constructor that takes '2' arguments
谁能告诉我为什么会这样?
据我所知,实际上没有可能让枚举更加"java'ish".但如果我错过任何替代方案,我会很高兴听到它.
我试图使用encog库作为强化学习问题的函数逼近器.更确切地说,我正在尝试启动并运行多层感知器(BasicNetwork).由于我的代理将基于我选择的任何RL算法以某种方式探索世界,因此我无法预先构建任何BasicNeuralDataSet,如XOR示例所示.可能,我必须使用pause()和resume()函数,但由于我找不到任何文档或示例,我在如何使用这些功能方面有些迷失(如果它们甚至可以在我的版本中工作.我不太确定在第二个链接中阅读了问题的答案后).
我正在使用Java和encog-core-2.5.3 jar.我目前的方法如下:
BasicNetwork network = new BasicNetwork();
network.addLayer(new BasicLayer(null, true,2));
network.addLayer(new BasicLayer(new ActivationTANH(), true,4));
network.addLayer(new BasicLayer(new ActivationTANH(), true,1));
network.getStructure().finalizeStructure();
network.reset();
TrainingContinuation cont = null;
double error = 0;
do {
int rnd = random.nextInt(trainInputs.length);
NeuralDataSet trainingSet = new BasicNeuralDataSet(
new double[][] { trainInputs[rnd] },
new double[][] { trainOutputs[rnd] });
Backpropagation train = new Backpropagation(network, trainingSet);
// train the neural network
if (cont != null) {
train.resume(cont);
}
train.iteration();
cont = train.pause();
error = train.getError();
} …
Run Code Online (Sandbox Code Playgroud) 我们假设我有一个Base
班级和一个Derived
班级:
class Base {};
class Derived : public Base {};
Run Code Online (Sandbox Code Playgroud)
我fun
现在可以明确地指定一个指向Derived
内容的指针,myBase
如下所示:
void fun( Base** myBase ) {
Derived* myDerived = new Derived();
*myBase = myDerived;
}
int _tmain(int argc, _TCHAR* argv[])
{
Base *myBase = NULL;
fun( &myBase );
return 0;
}
Run Code Online (Sandbox Code Playgroud)
现在,问题是我想要分配一个数组Base*
(我不能使用typedef来掩盖三星,因为签名fun
是自动生成的):
void fun( Base*** myBase ) {
Derived** myDerived = new Derived*();
*myBase = myDerived;
}
Run Code Online (Sandbox Code Playgroud)
为什么我从C2440: '=' : cannot convert from 'Derived …
在处理 numpy 数组中的元组时,我发现了一个奇怪的行为。我想得到一个布尔值表,告诉我数组中的哪些元组a
也存在于数组中b
。通常情况下,我会用任何的in
,in1d
。它们都不起作用而tuple(a[1]) == b[1,1]
yield True
。
我填写我的a
和b
喜欢这样的:
a = numpy.array([(0,0)(1,1)(2,2)], dtype=tuple)
b = numpy.zeros((3,3), dtype=tuple)
for i in range(0,3):
for j in range(0,3):
b[i,j] = (i,j)
Run Code Online (Sandbox Code Playgroud)
谁能告诉我解决我的问题的方法,请告诉我为什么这不能按预期工作?
(顺便说一句,在这里使用 python2.7 和 numpy1.6.2。)
撇开我使用getter/setter的事实,更有经验的C++程序员不会使用它们我遇到以下代码的问题:
#include "Player.h"
class Entity
{
public:
Entity::Entity(Player& _owner)
: owner(_owner) { }
Player &get_owner() { return this->owner; }
void set_owner(Player &_owner) { this->owner = _owner; }
private:
Player &owner;
};
Run Code Online (Sandbox Code Playgroud)
这给了我一个C2582,说set_owner函数中的'operator ='不适用于Player.我的Player类看起来像这样:
class Layer;
class Cell;
class Player
{
public:
Player();
void credit_to_balance(const long &_amount);
..more getter/setter..
private:
long balance;
Layer ¤t_layer;
Cell ¤t_cell;
};
Run Code Online (Sandbox Code Playgroud)
到现在为止我认为我的默认构造函数/析构函数和=运算符会!如果我自己没有完成它(并且它们在整个程序中使用),则由编译器构造.显然这次不是这种情况,因为其他类也会抱怨从Player中删除手动插入的默认c'tor.我甚至尝试编写一个完全相同的小示例程序(即使使用前向声明和成员也是引用)并且它有效.
在我看来它肯定应该,因为它只会复制一些引用和内在类型.这就是为什么我还没有尝试编写自己的=运算符,因为我认为编译器没有困难为我做这个.对我而言,每次我向班级介绍新成员时都会考虑更新它.
我对这个问题的想法非常多.我希望你们能告诉我我缺少的东西:)提前谢谢!
有没有办法让
TypeDescriptor.GetConverter.ConvertFromString
转换为DateTime
使用自定义格式,例如" 2011-04-21 13-03-56
"?
如果没有,是否有任何DateTime格式可以应用于文件夹名称(/,\,:等,如你所知不允许)?
非常感谢帮助.在此先感谢Random-I-Am
编辑:
由于我的要求似乎仍未被正确理解,我再次试图详细阐述我的问题.我的用户正在创建具有特定名称的文件夹 例如"1000_Link_Topic1_2011-01-25 14-12-10".他们可以根据自己的喜好自由组合信息,并在需要时省略信息.他们甚至不必关心区分大小写.所以我可以面对另一个名为"1000_link_Topic2"的文件夹.
我所拥有的是一个单独的类,每个可能的信息片段都有一个属性.在这种情况下,我会(因为我必须找到一种方法来检查每个属性默认值,无论我使用可空类型的属性类型):
Short? short_val;
EContentType? enum_val;
String string_val;
DateTime? datetime_val;
Run Code Online (Sandbox Code Playgroud)
我的代码显然将文件夹名称拆分为"_",然后告诉每个片段它属于哪种属性类型.一旦我知道我试图转换为Type的相应类型,让我们说t,使用TypeDescriptor.GetConverter(t).ConvertFromString(info_frag[i])
.我希望你现在明白为什么我不能使用另一种转换方法.
该代码适用于上述所有类型.我的问题是找到一个可以在文件夹名称上使用的自定义DateTime格式.我所知道的所有格式都使用冒号来分隔小时和分钟.
我要的是转换的方式从一个自定义DateTime格式来使用的DateTime对象TypeDescriptor.GetConverter.ConvertFromString
.如果那是不可能的,我要么找到一个标准的DateTime格式,可以将其指定为文件夹名称而无需进一步转换,或以某种方式按我的自定义格式扩展内置DateTime格式.如果它将成为后者我不关心能够使用秒或分钟.工作时间可以完成.
再次感谢您和您一样耐心,并帮助我解决这个问题.随意提出任意多个问题.我希望你能帮助我让这个工作.
随机I-上午