45
45
// 3rd parties inclue
46
46
#ifdef VISP_HAVE_NLOHMANN_JSON
47
47
#include < nlohmann/json.hpp>
48
- using json = nlohmann::json;
49
48
#endif
50
49
51
50
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_17)
@@ -496,6 +495,8 @@ class VISP_EXPORT vpCircleHoughTransform
496
495
*/
497
496
inline static vpCircleHoughTransformParameters createFromJSON (const std::string &jsonFile)
498
497
{
498
+ using json = nlohmann::json;
499
+
499
500
std::ifstream file (jsonFile);
500
501
if (!file.good ()) {
501
502
std::stringstream ss;
@@ -528,6 +529,7 @@ class VISP_EXPORT vpCircleHoughTransform
528
529
*/
529
530
inline void saveConfigurationInJSON (const std::string &jsonPath) const
530
531
{
532
+ using json = nlohmann::json;
531
533
std::ofstream file (jsonPath);
532
534
const json j = *this ;
533
535
file << j.dump (4 );
@@ -541,7 +543,7 @@ class VISP_EXPORT vpCircleHoughTransform
541
543
* \param[in] j : The JSON object, resulting from the parsing of a JSON file.
542
544
* \param[out] params : The circle Hough transform parameters that will be initialized from the JSON data.
543
545
*/
544
- friend inline void from_json (const json &j, vpCircleHoughTransformParameters ¶ms)
546
+ friend inline void from_json (const nlohmann:: json &j, vpCircleHoughTransformParameters ¶ms)
545
547
{
546
548
std::string filteringAndGradientName = vpImageFilter::vpCannyFilteringAndGradientTypeToString (params.m_filteringAndGradientType );
547
549
filteringAndGradientName = j.value (" filteringAndGradientType" , filteringAndGradientName);
@@ -619,11 +621,11 @@ class VISP_EXPORT vpCircleHoughTransform
619
621
* \param[out] j : A JSON parser object.
620
622
* \param[in] params : The circle Hough transform parameters that will be serialized in the json object.
621
623
*/
622
- friend inline void to_json (json &j, const vpCircleHoughTransformParameters ¶ms)
624
+ friend inline void to_json (nlohmann:: json &j, const vpCircleHoughTransformParameters ¶ms)
623
625
{
624
626
std::pair<unsigned int , unsigned int > radiusLimits = { params.m_minRadius , params.m_maxRadius };
625
627
626
- j = json {
628
+ j = nlohmann:: json {
627
629
{" filteringAndGradientType" , vpImageFilter::vpCannyFilteringAndGradientTypeToString (params.m_filteringAndGradientType )},
628
630
{" gaussianKernelSize" , params.m_gaussianKernelSize },
629
631
{" gaussianStdev" , params.m_gaussianStdev },
@@ -760,7 +762,7 @@ class VISP_EXPORT vpCircleHoughTransform
760
762
* \param[in] j The JSON object, resulting from the parsing of a JSON file.
761
763
* \param[out] detector The detector, that will be initialized from the JSON data.
762
764
*/
763
- friend inline void from_json (const json &j, vpCircleHoughTransform &detector)
765
+ friend inline void from_json (const nlohmann:: json &j, vpCircleHoughTransform &detector)
764
766
{
765
767
detector.m_algoParams = j;
766
768
}
@@ -771,7 +773,7 @@ class VISP_EXPORT vpCircleHoughTransform
771
773
* \param[out] j A JSON parser object.
772
774
* \param[in] detector The vpCircleHoughTransform that must be parsed into JSON format.
773
775
*/
774
- friend inline void to_json (json &j, const vpCircleHoughTransform &detector)
776
+ friend inline void to_json (nlohmann:: json &j, const vpCircleHoughTransform &detector)
775
777
{
776
778
j = detector.m_algoParams ;
777
779
}
0 commit comments