detecting number of faces does not work correctly

I am recording video from laptop camera using VideoWriter, VideoCapture and imShow. using faceCascade.detectMultiScale( frameGray2, faces, 1.1, 2, 0, cv::Size(80,80)), I am trying to detect faces in the video. I am printing the number of faces using faces.size(). I am loading the CascadeClassifier using

cv::CascadeClassifier faceCascade;
if (!faceCascade.load( faceCascadeName ))
        std::cerr << "Could not load face classifier" << std::endl;
        return 2;


string faceCascadeName = "/home/sandeep/git-rectify/opencv/data/lbpcascades/lbpcascade_frontalface.xml";

I am doubting on the xml file type used. Please check if it is proper value

The whole code is as follows

int main(int, char**)
    //Preprocess the image
    cv::Mat frame;
    cv::Mat frameGray;
    cv::Mat frameGray2;

    cv::CascadeClassifier faceCascade;

    //This will contain the output of the face detector
    std::vector<cv::Rect> faces;

    const char *colorFrame = "Color frame";
    const char *GrayFrame1 = "Gray Frame1";
    const char *GrayFrame2 = "Gray Frame2";

    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;
    // Default resolution of the frame is obtained.The default resolution is system dependent.
    int frame_width = cap.get(CV_CAP_PROP_FRAME_WIDTH);
    int frame_height = cap.get(CV_CAP_PROP_FRAME_HEIGHT);

    /** Define the codec(CV_FOURCC method, other samples like MJPG are present in
    *** and create VideoWriter object.The output is stored in 'outcpp.avi' file.100 is the frame rate per second.
    VideoWriter video("outcpp.avi",CV_FOURCC('M','J','P','G'),100, Size(frame_width,frame_height));
    string faceCascadeName = "/home/sandeep/git-rectify/opencv/data/lbpcascades/lbpcascade_frontalface.xml";

  //Load the classifiers
    if (!faceCascade.load( faceCascadeName ))
        std::cerr << "Could not load face classifier" << std::endl;
        return 2;
        cap >> frame; // get a new frame from camera

        if (frame.empty())

        // cvtColor is used to transform image from one color space to another. Here it converts to Grayscale Image.
        cv::cvtColor( frame, frameGray,  cv::COLOR_RGB2GRAY);

        //It is a method that improves the contrast in an image, in order to stretch out the intensity range.
        cv::equalizeHist( frameGray, frameGray2 );

        //Detect the face
        faceCascade.detectMultiScale( frameGray2, faces, 1.1, 2, 0, cv::Size(80,80));

        cout << "Number of detected faces: " << faces.size() << std::endl;

        imshow( colorFrame, frame );

        //namedWindow( GrayFrame1, CV_WINDOW_AUTOSIZE );
        //namedWindow( GrayFrame2, CV_WINDOW_AUTOSIZE );

        //imshow( GrayFrame1, frameGray );
        //imshow( GrayFrame2, frameGray2 );

        char c=(char)waitKey(1);

// When everything done, release the video capture object
  // Closes all the frames

  return 0;

1>I am the only person in front of the camera, but the number of faces is one in the set= {0,1,2,3}, this is wrong, it should only print 1.

2>1 more question, can I detect vegtables, getting name of vegetables, using this code with some modifications?