Ask Your Question
0

How to use #include cvcam.h in opencv 3.0?

asked 2016-02-29 22:01:41 -0600

txrxmo gravatar image

updated 2016-03-05 08:52:22 -0600

I am trying to run a program that includes the header cvcam.h. It was made with opencv 2.4 but now i am trying to run it with opencv 3.0. For the header #include "highgui.h", i changed it to #include "opencv2/highgui/highgui.hpp". I am not quite sure on how to do it for cvcam.h. I hope someone can help. Thanks! =)

#ifdef _CH_
#pragma package <opencv>
#endif

#ifndef _EiC
#include "cv.h"
#include "cvcam.h"
#include "highgui.h"
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#endif



IplImage *image = 0, *hsv = 0, *hue = 0, *mask = 0, *backproject = 0, *histimg = 0, *plot = 0, *display = 0, *clone = 0;
CvHistogram *hist = 0;

int backproject_mode = 0;
int select_object = 0;
int track_object = 0;
int show_hist = 1;
const int eye_origin = 160;


// Width of boxex across eye
int col5_left = 0;
int col5_right = 0;
int col4_left = 0; //310;
int col4_right = 0; //325;
int col3_left = 0; //330;
int col3_right = 0; //345;
int col2_left = 0; //355;
int col2_right = 0; //370;
int col1_left = 0; //375;
int col1_right = 0; //390;

// Height of boxes across eye
int row1_upper = 0; //262; //317
int row1_lower = 0; //254; //279
int row2_upper = 0; //254; //269
int row2_lower = 0; //246; //231
int row3_upper = 0; //246; //221
int row3_lower = 0; //238; //183 
int row4_upper = 0;
int row4_lower = 0;

//Display numbers
int display_col1 = 10;
int display_col2 = 110;
int display_col3 = 210;
int display_col4 = 310;
int display_col5 = 410;
int display_row1 = 120;
int display_row2 = 240;
int display_row3 = 360;
int display_row4 = 480;

//Display boxes
int box_width = 80;
int box_height = 110;
int box_gapX = 20;
int box_gapY = 10;

//Camera-to-screen ratio
float ratio = 0.118; //camera to eye dist = 6cm, screen to eye dist = 51cm, ratio = 6/51
float scale_width = 0, scale_height = 0, scale_gapX = 0, scale_gapY = 0;
int refresh = 0;
int calibrate = 1;
int EyeCenter_pre = 0;
float scalingX = 1.32; //1.32 for 19", 1 for 15"
float scalingY = 1.13;// 1.13 for 19"
// Data writing
float f;
FILE * pFile;
clock_t delay, time1, time2, time3, time4, timediff_from3, timediff_from2, timediff_from1, track_time;
clock_t time5, time6, time7, time8, time9, time10, time11, time12, time13, START;
clock_t last_time1,last_time2,last_time3,last_time4,last_time5,last_time6,last_time7,last_time8,last_time9,last_time10,last_time11,last_time12,last_time13;
int blank1=1,blank2=1,blank3=1,blank4=1,blank5=1,blank6=1,blank7=1,blank8=1,blank9=1,blank10=1,blank11=1,blank12=1,blank13=1;
float frequency1=2,frequency2=4,frequency3=2,frequency4=8,frequency5=3,frequency6=2,frequency7=9,frequency8=2,frequency9=11,frequency10=4,frequency11=7,frequency12=3,frequency13=1;
time_t rawtime;
clock_t run_start,run_stop;
int running_time=0;
struct tm * timeinfo;
int new_num = 0, pre_num = 0; 
const int eye_threshold = 2;
// get capture parameters.         
int width, height, fps;          
// create video writer for the output.        
CvVideoWriter* writer = NULL; 
int isColor = 1;
int fps     = 5;  // or 30
int frameW  = 640; // 744 for firewire cameras
int frameH  = 480; // 480 for firewire cameras
CvPoint plot_pos;
CvPoint origin;
CvRect selection;
CvRect track_window;
CvBox2D track_box;
CvConnectedComp track_comp;
CvFont font, font1;
CvPoint NewEyeCenter;
CvPoint EllipseCenter;
CvPoint Center;
CvPoint EyeCenter;
int hdims = 16;
float ...
(more)
edit retag flag offensive close merge delete

Comments

it's gone. and though that code was probably still running with opencv2.4, it must be using code from opencv1.0, which is a long time ago. (and probably a bad idea tying to use it today)

can you post the code ? maybe someone can help you to adapt / re-write it.

berak gravatar imageberak ( 2016-03-01 00:01:42 -0600 )edit

Hello! Wil it be okay to post the code? As i am not so familiar with how things work in this forum.

txrxmo gravatar imagetxrxmo ( 2016-03-01 08:24:19 -0600 )edit

edit your question, and append

berak gravatar imageberak ( 2016-03-01 09:05:21 -0600 )edit

Alright! thanks! Will do just that

txrxmo gravatar imagetxrxmo ( 2016-03-01 09:56:19 -0600 )edit

you could get it to compile, if you change the headers to:

#include "opencv/cv.h"
#include "opencv/highgui.h"

(you don't need cvcam at all)

berak gravatar imageberak ( 2016-03-06 02:03:45 -0600 )edit

thanks berak! i shall try that!

txrxmo gravatar imagetxrxmo ( 2016-03-07 07:29:35 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-29 23:18:07 -0600

zshn25 gravatar image
#include <opencv2/opencv.hpp>

should do it

edit flag offensive delete link more

Comments

Hello i tried but it did not work

txrxmo gravatar imagetxrxmo ( 2016-03-01 08:24:41 -0600 )edit

Then maybe the problem is something else. Help me help you by posting your code

zshn25 gravatar imagezshn25 ( 2016-03-03 00:29:45 -0600 )edit

Okay...i hope you wont mind as the code is super long

txrxmo gravatar imagetxrxmo ( 2016-03-03 09:15:48 -0600 )edit

ifdef _CH_

#pragma package <opencv>
#endif

#ifndef _EiC
#include "cv.h"
#include "cvcam.h"
#include "highgui.h"
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#endif



IplImage *image = 0, *hsv = 0, *hue = 0, *mask = 0, *backproject = 0, *histimg = 0, *plot = 0, *display = 0, *clone = 0;
CvHistogram *hist = 0;

int backproject_mode = 0;
int select_object = 0;
int track_object = 0;
int show_hist = 1;
const int eye_origin = 160;


// Width of boxex across eye
int col5_left = 0;
int col5_right = 0;
int col4_left = 0; //310;
int col4_right = 0; //325;
int col3_left = 0; //330;
int col3_right = 0; //345;
int col2
txrxmo gravatar imagetxrxmo ( 2016-03-03 09:17:05 -0600 )edit

Is there any way i can post a long code?

txrxmo gravatar imagetxrxmo ( 2016-03-03 09:18:11 -0600 )edit

Please stop using the depriciated C code. For example use Mat instead of IplImage, etc.That should do it

And, yes, you can add long code. Edit your question and add the code to it in the end

zshn25 gravatar imagezshn25 ( 2016-03-04 08:03:00 -0600 )edit

Hello..i have attached the code i wanted to run in opencv 3.0....i am not sure how as this was only given to me to run it.

txrxmo gravatar imagetxrxmo ( 2016-03-05 08:53:27 -0600 )edit

If you just want to run it, then this code will directly run with OpenCV 3.0.0. But using the depreciated C functions is not recommended. Also, I think the problem is in including the libraries. How are you compiling this? If you are using Visual Studio in Windows, then follow this tutorial to compile.

zshn25 gravatar imagezshn25 ( 2016-03-06 23:55:22 -0600 )edit

@zshn25 thanks i will try it now. As at the moment the only dependencies i include are opencv_ts300d and opencv_world300d and all the codes given to me to run are done using opencv 2.4.

txrxmo gravatar imagetxrxmo ( 2016-03-07 07:29:20 -0600 )edit

you don't need the opencv_ts lib (it's only for unit tests)

then, there's a duplicate declaration of "fps".

but just saying, once you got it to run -- leave it alone ! . don't try to build anything new on top of that horrible pile of ...

berak gravatar imageberak ( 2016-03-07 07:45:35 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-29 22:01:41 -0600

Seen: 1,573 times

Last updated: Mar 05 '16