Efficient RANSAC example with exact_constructions_kernel?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Efficient RANSAC example with exact_constructions_kernel?

Jing Zhao
Hi guys,

I'm new to CGAL and I'm trying to use the efficient ransac algorithm to
detect shapes in point cloud.
I'm using the demo code at
https://doc.cgal.org/latest/Point_set_shape_detection_3/index.html#Point_set_shape_detection_3Usage_minimal.

Now for certain reason I need to use the
Exact_predicate_exact_constructions_kernel.

I just changed the header file and the corresponding typedef at the
beginning of the program.  However the compiling process failed with the
following error message:

/usr/local/include/CGAL/Shape_detection_3/Efficient_RANSAC.h:495:34: error:
ambiguous overload for ‘operator*’ (operand types are
‘CGAL::Shape_detection_3::Efficient_RANSAC<CGAL::Shape_detection_3::Shape_detection_traits&lt;CGAL::Epeck,
std::vector&lt;std::pair&lt;CGAL::Point_3&lt;CGAL::Epeck>,
CGAL::Vector_3<CGAL::Epeck> > >,
CGAL::First_of_pair_property_map<std::pair&lt;CGAL::Point_3&lt;CGAL::Epeck>,
CGAL::Vector_3<CGAL::Epeck> > >,
CGAL::Second_of_pair_property_map<std::pair&lt;CGAL::Point_3&lt;CGAL::Epeck>,
CGAL::Vector_3<CGAL::Epeck> > > > >::FT {aka
CGAL::Lazy_exact_nt<CGAL::Gmpq>}’ and ‘std::size_t {aka long unsigned int}’)
           (std::size_t)((FT)0.01 * m_num_available_points) :
                        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

The error message is too long to post all of them here. It is easy to
reproduce though.

I really don't get it. Aren't the kernels expected to replace one another?

Thanks in advance!

Best,
Jing



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Efficient RANSAC example with exact_constructions_kernel?

Simon Giraudot-2
Hello,

Le 30/01/2019 à 10:32, zhaojing a écrit :
> I really don't get it. Aren't the kernels expected to replace one another?
>
Not necessarily: in particular, the EPEC kernel is not always available
as some operations can't be done exactly. We have some flexibility with
that (for example authorizing functions like square root which can't be
done exactly) but it means momentarily breaking the exactness and it is
not always done.

The bug that you have seems simpler than that (just a conversion issue),
but as RANSAC is intrinsically an inexact algorithm (it performs
randomized approximations for which there is no gain in using exact
constructions), it probably seemed unlikely (when it was written) that
someone would use EPEC on it and it was not tested with it.

The fact that RANSAC can't use EPEC should be however documented and
it's not. This should at least be fixed.

Best,

--
Simon Giraudot, PhD
R&D Engineer
GeometryFactory - http://geometryfactory.com/


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Efficient RANSAC example with exact_constructions_kernel?

Sebastien Loriot (GeometryFactory)
Note that converting points can be done easily using
CGAL::Cartesian_converter.
See
https://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Cartesian__converter.html

Note that you might even be able to do it on the fly using
Cartesian_converter_property_map (not sure however if for this algorithm
it is not better to copy them and use the copy to avoid too many
conversions).

https://doc.cgal.org/latest/Property_map/structCGAL_1_1Cartesian__converter__property__map.html

Sebastien.

On 01/30/2019 10:43 AM, Simon Giraudot wrote:

> Hello,
>
> Le 30/01/2019 à 10:32, zhaojing a écrit :
>> I really don't get it. Aren't the kernels expected to replace one
>> another?
>>
> Not necessarily: in particular, the EPEC kernel is not always available
> as some operations can't be done exactly. We have some flexibility with
> that (for example authorizing functions like square root which can't be
> done exactly) but it means momentarily breaking the exactness and it is
> not always done.
>
> The bug that you have seems simpler than that (just a conversion issue),
> but as RANSAC is intrinsically an inexact algorithm (it performs
> randomized approximations for which there is no gain in using exact
> constructions), it probably seemed unlikely (when it was written) that
> someone would use EPEC on it and it was not tested with it.
>
> The fact that RANSAC can't use EPEC should be however documented and
> it's not. This should at least be fixed.
>
> Best,
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Efficient RANSAC example with exact_constructions_kernel?

Jing Zhao
In reply to this post by Simon Giraudot-2
Hi Simon!

I really appreciate your quick response!

Actually I want to send the plane detection result by RANSAC to the *point
set structuring* process described in
https://doc.cgal.org/latest/Point_set_processing_3/Point_set_processing_3_2structuring_example_8cpp-example.html#a8.

The structuring process will project the planar points detected by RANSAC
onto the plane. Actually it is the projection result I need to be exact.
However it seems that structuring process need to use the same kernel as
RANSAC?

I'm really not sure how to do this. I'm wondering that if it is possible
that you could give me some hint or some documentation to look into?

Really thank you!

Best,
Jing





--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Efficient RANSAC example with exact_constructions_kernel?

Jing Zhao
In reply to this post by Sebastien Loriot (GeometryFactory)
Thanks Sebastien!

I'll look into that!

Best,
Jing



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss