I try to convert from pcl::PointCloud<pcl::PointXYZ> to pcl::PCLPointCloud2
But the conversion returns an empty point cloud.
This is my code:
pcl::PCLPointCloud2 cloud_inliers_pcl2;
pcl::toPCLPointCloud2(cloud_inliers, cloud_inliers_pcl2);
I can print out the cloud "cloud_inliers" which is in the
pcl::PointCloud<pcl::PointXYZ>
But the pcl::PCLPointCloud2 returns empty fields
This is a bit late but others searching the same topic may find this useful.
To convert between PCLPointCloud2 and PointT types you can use:
//Convert from PCLPointCloud2 to PointT
pcl::fromPCLPointCloud2(*pc2_cloud_ptr, *xyzrgb_cloud_ptr);
and
///Convert from PointT to PCLPointCloud2
pcl::toPCLPointCloud2(*xyzrgb_cloud_ptr, *pc2_cloud_ptr);
where my pointers to the point cloud are defined as:
pcl::PCLPointCloud2::Ptr pc2_cloud_ptr (new pcl::PCLPointCloud2);
and
pcl::PointCloudpcl::PointXYZRGB::Ptr xyzrgb_cloud_ptr (new pcl::PointCloudpcl::PointXYZRGB);
remember to include:
#include <pcl/conversions.h>
Note however that if you're using the Point Cloud Library (PCL) instead of the Robotics Operating System (ROS) library you don't need to convert but rather just use PointT types (e.g. pcl::PointCloudpcl::PointXYZRGB::Ptr). Some examples in PCL tutorials use PCLPointCloud2 types but I find that PointT types work just as well without needing to convert between the types. I guess that the tutorials are for older versions of the PCL. the downsampling tutorial is a good example: https://pcl.readthedocs.io/projects/tutorials/en/latest/voxel_grid.html
I used a PointT type instead of the PCLPointCloud2 type used in the tutorial and it works fine in PCL 1.11.
Note: I've recently started learning to use the Point Cloud Library for my master dissertation. Happy to learn more about converting between data structures in PCL. The documentation seems insufficient and needs trial and error to understand the data structures.
Related
Background:
I was given a pile of yokagawa "mxd" files without documentation or
description, and told "convert it".
I have looked for documentation and found none. The OEM doesn't seem to "do" reproducibility in the sense of a "code book". (link)
I have looked for online code for converters and found none.
National Instruments has a connector, but only if I use latest/greatest
LabVIEW (link). I don't have that version.
The only compatible suffix is from ArcGIS, but why would DAQ use a format like that.
Questions:
Is there a straightforward way to convert "mxd" to "csv"?
How do I find the relationship using the binary data? Eyeballing HEX seems slow/inefficient.
Is there any relationship between DAQ mxd and ArcGIS mxd?
Yokogawa supplies a progam called MX100 Standard Software: https://y-link.yokogawa.com/YL008/?Download_id=DL00002238&Language_id=EN, this program can read the *.mxd files and also export them to ascii or excel. See the well hidden manual: http://web-material3.yokogawa.com/IMMX180-01E_040.pdf, page 105 has chapter 3.7: converting data formats.
I' trying to match one image from VideoGrabber and another image that is on disk.
I'm following this tutorial.
The problem is that it uses the function imread, which takes a string (path of the file), incompatible with VideGrabber type.
How can I convert a VideoGrabber from openframeworks data type to opencv mat type?
Is this what you want?
ofVideoGrabber vidGrabber;
...
cv::Mat frame(vidGrabber.getHeight(), vidGrabber.getWidth(), CV_8UC3, vidGrabber.getPixels());
I am not sure what format uses to pack pixels, OpenCV uses BGR interleaved channels, you may have to swap pixels around.
Ok, it seems to be a specific question about openframworks. You can use the wonderful addon ofxCv fro Kyle, it is specifically for an alternative use of opencv library inside openframeworks.
in ofxCv you can find methods such as toCv for converting openframeworks types to opencv, and toOf, for the inverse process. Have a look, it is well documented, with a lot of examples, and well designed.
Not exactly sure what difficulty you have with string versus array char[]. Array of chars can be converted to string like this:
char myarray[ ] = "my_file_name";
string str(myarray);
Reading sources of Array2D module, I've stumbled upon this interesting construct in implementation of many core functions, for example:
[<CompiledName("Get")>]
let get (array: 'T[,]) (n:int) (m:int) = (# "ldelem.multi 2 !0" type ('T) array n m : 'T #)
I can only assume that this is the syntax to inline CIL and is used here obviously to gain performance benefits. However, when I've tried to use this syntax in my program, I get an error:
warning FS0042: This construct is deprecated: it is only for use in the F# library
What exactly is this? Is there any detailed documentation?
I think that this has 2 purposes:
These functions compile down to exactly 1 CIL instruction which has to be encoded somewhere, so encoding at the source seems best.
It allows for some extra trickery with defining polymorphic Add functions in a high performance way which is hard with the F# type system.
You can actually use this but you have to specify the --compiling-fslib (undocumented) and --standalone flags in your code.
I've found some details in usenet archives: http://osdir.com/ml/lang.fsharp.general/2008-01/msg00009.html
Embedded IL in F# codes. Is this feature officially supported
Not really. The 99.9% purpose of this feature is for operations defined
in FSharp.Core.dll (called fslib.dll in 1.9.2.9 and before).
Historically it has been useful to allow end-users to embed IL in order
to access .NET IL functionality not accessible by F# library or
language constructs using their own embedded IL. The need for this is
becoming much more rare, indeed almost non-existent, now that the F#
library has matured a bit more. We expect this to continue to be the
case. It's even possible that we will make this a library-only feature
in the "product" version of F#, though we have not yet made a final
decision in this regard.
This was a message from Don Syme, dated January of 2008.
is there a way to use calculations made in matrix language (matrix-end matrix) as macro variables later in calculations?
Let say I calculate chi^2 and pvalue in matrix language and then I want to use them as my new macro variables for, let say, printing information about if the statistics is significant or not.
Of course I can use OMS to solve my problem but I want to find out if there is a possible way to get variables from matrix language to syntax later on.
You might want to look into Python programmability instead of macro. It is much more powerful and flexible. You can read about it in the books and articles section of the SPSS Community website (www.ibm.com/developerworks/spssdevcentral). The site also provides the materials for getting started with programmability.
MATRIX can write datasets, which Python can read and manipulate - and it can even generate macro values from them.
HTH,
Jon Peck
I need to perform some basic OLS regression using F#. To do this I need some Linear Algebra functions, but I'm confused as to what's out there. I can't find any way to invert a matrix. There is some documentation for a library called Microsoft.FSharp.Math.LinearAlgebra, but I don't know if that exists anymore.
If you add the FSharp Powerpack to your project (in .NET references), you can use various functionality of the matrix library
edit: you also need to add the experimental library Fsharp.Powerpack.MathProviders, then you can call as follows
open Microsoft.FSharp.Math
let m = Matrix.create 10 10 1.2
let m2 = Experimental.LinearAlgebra.Inverse m
FlyingFrog do a Numerics library which contains Matrix inversion amongst many other functions.
Not sure which is preferable, that or the (apparently deprecated) 'experimental' code from the PowerPack. I guess you could always keep the source code for the managed bit of the PowerPack version in a safe place, still available here:
C:\Program Files\FSharp-1.9.6.2\source\fsharp\FSharp.PowerPack\math\lapack\linear_algebra_managed.fs.
I don't know; in the 1.9.6 version of F# I don't see anything offhand, the docs are here
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
and there is Matrix stuff in the Microsoft.FSharp.Math namespace in the FSharp.Powerpack.dll, but I don't see 'invert' offhand, and I don't know about the 'LinearAlgebra' stuff (deprecated? web search suggests it disappeared a few releases back).
Have you checked out this. It might help.