[pdal] Linking with PCL
Andrew Bell
andrew.bell.ia at gmail.com
Fri Dec 15 04:57:14 PST 2017
The StageFactory must be able to locate the plugin. See the second
question in the FAQ: https://www.pdal.io/faq.html
On Fri, Dec 15, 2017 at 4:44 AM, <pidgeon13 at googlemail.com> wrote:
> Hi,
>
>
>
> I am trying to use the voxelgrid filter in some c++ code I am writing (and
> would also like to be able to read and write .pcd files). I believe I have
> linked in PCL correctly, and my solution builds the plugin .dll files.
> However, although there is plenty of information on the PDAL website about
> using PCL in pipelines, I have not managed to find anything to help me use
> the API. I currently have a function I am playing around with to try and
> get the filter to work:
>
>
>
> bool ReadFilterWrite(const std::string& inputfilename, const std::string&
> readerdriver, const std::string& outputfilename)
>
> {
>
> bool bFilterWorks=false;
>
> pdal::StageFactory factory;
>
> pdal::PointTable table;
>
> pdal::Stage *pReader = factory.createStage(readerdriver);
>
> pdal::Options readerOptions;
>
> readerOptions.add("filename", inputfilename);
>
> if (pReader)
>
> {
>
> pReader->setOptions(readerOptions);
>
> }
>
> else
>
> {
>
> return false;
>
> }
>
> pdal::Options writerOptions;
>
> writerOptions.add("filename", outputfilename);
>
> pdal::Stage *pWriter = factory.createStage("writers.
> text");
>
> if (pWriter)
>
> {
>
> pdal::Stage *pFilter =
> factory.createStage("filters.voxelgrid");
>
> if (pFilter)
>
> {
>
> bFilterWorks = true;
>
>
> pFilter->setInput(*pReader);
>
>
> pWriter->setInput(*pFilter);
>
> }
>
> else
>
> {
>
> //Currently commented out
> so that files are only written if the filter works.
>
>
> //pWriter->setInput(*pReader);
>
> return false; //Temporary,
> currently where the function exits.
>
> }
>
> pWriter->setOptions(writerOptions);
>
> pWriter->prepare(table);
>
> pWriter->execute(table);
>
> }
>
> return bFilterWorks;
>
> }
>
>
>
> The function reads the data in from a .las file (for example) fine, but
> then doesn’t create the filter stage. Am I going about this in the right
> way?
>
>
>
> Best regards,
>
>
>
> Stephen
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> _______________________________________________
> pdal mailing list
> pdal at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pdal
>
--
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20171215/87d61a40/attachment.html>
More information about the pdal
mailing list