Hi I am unable to call a function in one class from another class:In this line of the code it is showing error
std::nth_element(edge_points.begin(), edge_points.end() - edge_points.size() * c.edge_points_percent, edge_points.end(),Camera::compare_edge_points);
Camera:: compare_edge_points - showing error.

Can anyone help me here please?

Header file:

#ifndef main_h
#define main_h
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <stdint.h>
            #include <stdlib.h>
            #include <cmath>
            #include <float.h>
            #include <deque>
            #include <algorithm>
            #include <sys/time.h>
            #include "optionparser.h"
            #include <math.h>
            #include <stdio.h>
            #include <stdlib.h>
            #include "main.h"

            class Camera {
            public:
             struct uint8_image_t {
                    uint32_t w;
                    uint32_t h;
                    uint8_t *data;
                };

                typedef struct uint8_image_t uint8_image_t;

                struct int8_image_t {
                    uint32_t w;
                    uint32_t h;
                    int8_t *data;
                };
                typedef struct int8_image_t int8_image_t;

                struct uint16_image_t {
                    uint32_t w;
                    uint32_t h;
                    uint16_t *data;
                };
                typedef struct uint16_image_t uint16_image_t;

                struct int16_image_t {
                    uint32_t w;
                    uint32_t h;
                    int16_t *data;
                };
                typedef struct int16_image_t int16_image_t;
               struct meniscus_finder_context {
                    uint8_t bright_ring_threshold;
                    double threshold_fraction;
                    uint32_t cent_x;
                    uint32_t cent_y;
                    double_t cam_tilt;
                    double_t edge_points_percent;
                    double_t circle_x;
                    double_t circle_y;
                    double_t circle_r;
                    uint8_image_t *input_image;
                    uint8_image_t *mask_image;
                    uint8_image_t *output_image;

                     uint8_image_t *dilation_kernel;
                    uint8_image_t *threshold_mask_image;
                    uint8_image_t *temp_image;
                    uint16_image_t *temp16_uimage;
                    int8_image_t *kernel33v_image;
                    int8_image_t *kernel33h_image;
                    int16_image_t *grad_x_image;
                    int16_image_t *grad_y_image;
                    int16_image_t *outward_x_image;
                    int16_image_t *outward_y_image;
                    int16_image_t *dot_product_image;
                };

                struct edge_point_t {
                    uint32_t i;
                    uint32_t j;
                    double_t v;
                };
                typedef struct edge_point_t edge_point_t;

               bool compare_edge_points(edge_point_t *a,edge_point_t *b);
               std::deque<edge_point_t *> find_edge_points(meniscus_finder_context &c);

            };

            #endif /* main_h */

            Camera.cpp

            #include <stdio.h>
            #include <iostream>
            #include <fstream>
            #include <sstream>
            #include <stdint.h>
            #include <stdlib.h>
            #include <cmath>
            #include <float.h>
            #include <deque>
            #include <algorithm>
            #include <sys/time.h>
            #include "optionparser.h"
            #include <math.h>
            #include <stdio.h>
            #include <stdlib.h>
            #include "cholesky.cpp"
            #include "main.h"

            bool Camera :: compare_edge_points(edge_point_t *a,edge_point_t *b) {
                return (a->v < b->v);
            }

            std::deque<Camera::edge_point_t *> find_edge_points(Camera::meniscus_finder_context &c) {
                std::deque<Camera::edge_point_t *> edge_points;
                uint32_t w = c.grad_x_image->w;
                for(uint32_t i = 0; i < c.threshold_mask_image->h; ++i) {
                    for(uint32_t j = 0; j < c.threshold_mask_image->w; ++j) {
                        if((c.threshold_mask_image->data[i * w + j] != 0) && (c.dot_product_image->data[i * w + j] > 0)) {
                            Camera::edge_point_t *ep = new Camera::edge_point_t;
                            ep->i = i;
                            ep->j = j;
                            ep->v = c.dot_product_image->data[i * w + j];
                            edge_points.push_back(ep);
                        }
                    }
                }
                std::nth_element(edge_points.begin(), edge_points.end() - edge_points.size() * c.edge_points_percent, edge_points.end(),compare_edge_points);
                edge_points.erase(edge_points.begin(), edge_points.end() - edge_points.size() * c.edge_points_percent - 1);

                return edge_points;
            }

Where in your code is the problem ... what lines ? What are the error messages?

If you have a static method in class A
you can call like this:

A.yourAstaticMethod(anyArgsGohere...);

Otherwise you need to firstly create an object of class A
A a; // call default ctor...
a.yourAmethod(anyArgsGoHere...);

It looks to me that your problem is here:

std::deque<Camera::edge_point_t *> find_edge_points(Camera::meniscus_finder_context &c)

You didn't declare this as belonging to Camera. Try this:

std::deque<Camera::edge_point_t *> Camera::find_edge_points(Camera::meniscus_finder_context &c)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.