Ask Your Question

97Viper's profile - activity

2014-09-26 09:11:43 -0600 received badge  Student (source)
2014-09-25 14:42:49 -0600 asked a question Object recognition routines.

After writing several routines in C++ using SIFT and SURF and running examples found on websites, including yours, although they all run and "work" none do a good job of recognizing learned objects. Is there such a routine out there that does the following: Given a staged HD digital frame of an object (Called Object) with a distinct outline and unique features. Given a HD webcam. A Frame from the webcam (the Scene) is grabbed with the Object in the Scene. The Object is unobscured, " large enough", in a similar rotational position, The Object and the Object in the Scene are facing the camera similarly. The routine returns a indicator that gives the probability of the Object being in the Scene. The routine returns an indicator of the location of the Object in the scene. It must do it consistently without having to change parameters in the code. Is something like this available anywhere. I can't find or code it. Help, please.

2014-06-26 19:04:07 -0600 asked a question surf object/scene dependences

Have created many object detection programs (SURF &SIFT) and they all work but don't do a good job of finding my objects in the scene. Is there some dependencies or relationships I am not addressing when defining pixels in the object and scene? Maybe some suggestions I need to address.

2014-06-12 18:41:46 -0600 asked a question writing and reading high definition frames to a file

I am using frames described by:

cap.set(CV_CAP_PROP_FOURCC, CV_FOURCC('H', '2', '6', '4'));
cap.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
cap.set(CV_CAP_PROP_FRAME_WIDTH, 1920);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1080);
cap.set(CV_CAP_PROP_FPS, 30);

Issue is writing the frame to a file and then reading it back in the original HD format. imwriting to file as a .jpeg and imreading it back to the same frame.

2014-02-10 19:56:02 -0600 asked a question Subtracting pixels of 2 different Mat using Vec3b & always get 0 diff.

include <iostream>

include <opencv2 opencv.hpp="">

include <opencv2 core="" types_c.h="">

include <opencv2 highgui="" highgui.hpp="">

include <opencv2 objdetect="" objdetect.hpp="">

include <opencv2 imgproc="" imgproc.hpp="">

include <iostream>

include <stdio.h>

using namespace cv; using namespace std; int R; int B; int G; int R1; int B1; int G1; int Total;

int main() { CvCapture* capture = 0; VideoCapture cap(0); // open the default camera if (!cap.isOpened()) // check if we succeeded return -1;

Mat frame1;
Mat frame2;
Mat frame1copy;
Mat frame2copy;

for (;;)
    cap >> frame1; // get a frame from camera


    imshow("frame1copy", frame1copy);

    if (waitKey(1000) >= 0) break;// Break with Esc

    cap >> frame2; // get a new frame from camera

    imshow("frame2copy", frame2copy);

    if (waitKey(1000) >= 0) break;// Break with Esc

    for (int i = 0; i < 480; i++)
    for (int j = 0; j < 640; j++)
        cv::Vec3b tmp =<cv::Vec3b>(i, j);
        B = (int)tmp(0);
        G = (int)tmp(1);
        R = (int)tmp(2);

        cv::Vec3b tmp1 =<cv::Vec3b>(i, j);
        B1 = (int)tmp(0);
        G1 = (int)tmp(1);
        R1 = (int)tmp(2);

        Total = R + B + G-R1-B1-G1;
        std::cout << "Total=  "<< Total <<std::endl;


return 0;


2013-11-20 13:35:44 -0600 commented answer Pixcel values in 2 different frames always show to be the same.

Thanks. Was hoping I didn't have to go from picture frame to matrix and back to picture frame to do pixcel operations.

2013-11-19 18:28:35 -0600 asked a question Pixcel values in 2 different frames always show to be the same.

I capture 2 different frames yet when I try to compare pixcel values between the 2 frames, they appear to be identical. I am probable misusing Vec3b. Please help an obvious novice. Thanks.

// November 11 2013 Capture and display values of 2 full color frames
#include "stdafx.h"
#include "iostream"
#include "opencv2/core/types_c.h"
#include "opencv2/opencv.hpp"
using namespace cv;
int main(int, char**)
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;   

        Mat frame;
        cap >> frame; // get frame from camera

        imshow("frame", frame);

        if(waitKey(1000) >= 0) break;

        Mat frame1;
        cap >> frame1; // get frame1 from camera    

        imshow("frame1", frame1);

        if(waitKey(1000) >= 0) break;

        for(int i=0; i<480; i++)
            for(int j=0; j<640; j++)
                {cv::Vec3b tmp1 =<cv::Vec3b>(i,j);std::cout << "i= "<<i<<" j= "<<j<< " frame1  "<<(int)tmp1(0) << " " << (int)tmp1(1) << " " << (int)tmp1(2)<< std::endl;
                 cv::Vec3b tmp =<cv::Vec3b>(i,j);std::cout << "          frame   "<<(int)tmp(0) << " " << (int)tmp(1) << " " << (int)tmp(2)<< std::endl;

        if(waitKey(1000) >= 0) break;

        if(waitKey(1000) >= 0) break;
    // the camera will be deinitialized automatically in VideoCapture destructor
    return 0;
2013-11-08 17:19:04 -0600 asked a question Reading pixels from 2 Mats & get the same data
for(int i=0; i<frame.rows; i++)
    for(int j=0; j<frame.cols; j++)
        //read the pixel from the first frame<Vec3b>(i,j)[0];<Vec3b>(i,j)[1];<Vec3b>(i,j)[2];
        std::cout << "BGR  "<<"i="<< i<<"  j="<<j <<"  "<<blue << " " <<green<< " " << red << std::endl;

        //read the pixel from the second frame<Vec3b>(i,j)[0];<Vec3b>(i,j)[1];<Vec3b>(i,j)[2];
        std::cout << "BGR1  "<<"i=" << i << " j=" <<j<< "  "<< blue1 << " " << green1 << " " <<   red1 << std::endl;

        // ---more code

I am new to opencv. I am trying to read pixel values from the same row and column from 2 separate Mats called Mat frame and Mat frame1. My program shows them as always being the same value in Mat frame and Mat frame1 and that isn't true. Could you help me please?