给定3D空间中的一组N个点,我试图使用SVD和Eigen找到最佳拟合平面.
我的算法是:
我无法弄清楚如何使用Eigen的SVD模块来找到对应于点坐标矩阵的最小奇异值的最小奇异向量.
到目前为止,我有这个代码(算法的步骤1,2和5):
Eigen::Matrix<float, 3, 1> mean = points.rowwise().mean();
const Eigen::Matrix3Xf points_centered = points.colwise() - mean;
int setting = Eigen::ComputeThinU | Eigen::ComputeThinV;
Eigen::JacobiSVD<Eigen::Matrix3Xf> svd = points_centered.jacobiSvd(setting);
Eigen::Vector3d normal = **???**
double d = normal.dot(mean);
Run Code Online (Sandbox Code Playgroud) 我正在尝试从 iPhoneX TrueDepth 相机保存深度图像。使用AVCamPhotoFilter示例代码,我能够在手机屏幕上实时查看转换为灰度格式的深度。我无法弄清楚如何以原始(16 位或更多)格式保存深度图像序列。
我有depthDatawhich 是AVDepthData. 它的成员之一是depthDataMapwhich 是CVPixelBuffer和 image format type的实例kCVPixelFormatType_DisparityFloat16。有没有办法将其保存到手机中以进行离线操作?
我正在尝试使用本机库来修改字节数组(实际上是uint16数组)的内容。我在Unity(C#)中具有数组,在C ++中具有本机库。
我尝试了几件事,我能做的最好的事情就是成功调用本机代码并能够将布尔值返回给C#。当我在C ++中传递数组并将其变异时,问题就来了。不管我做什么,该数组在C#中都保持不变。
这是我在Unity方面拥有的东西:
// In Update().
using (AndroidJavaClass processingClass = new AndroidJavaClass(
"com.postprocessing.PostprocessingJniHelper"))
{
if (postprocessingClass == null) {
Debug.LogError("Could not find the postprocessing class.");
return;
}
short[] dataShortIn = ...; // My original data.
short[] dataShortOut = new short[dataShortIn.Length];
Buffer.BlockCopy(dataShortIn, 0, dataShortOut, 0, dataShortIn.Length);
bool success = postprocessingClass.CallStatic<bool>(
"postprocess", TextureSize.x, TextureSize.y,
dataShortIn, dataShortOut);
Debug.Log("Processed successfully: " + success);
}
Run Code Online (Sandbox Code Playgroud)
Unity项目在Plugins / Android中具有postprocessing.aar,并已为Android构建平台启用。我在Java中有一个JNI层(已成功调用):
public final class PostprocessingJniHelper {
// Load JNI methods
static {
System.loadLibrary("postprocessing_jni");
}
public static …Run Code Online (Sandbox Code Playgroud)