Visual studio 2012 closes immediately

asked 2014-04-19 12:29:41 -0500

Yasmin93 gravatar image

updated 2014-04-19 13:03:49 -0500

I know this question is asked before but i tried all solutions and it didn't work out in my case , from changing properties linker system adding cvwaity() key all didn't work , also ctrl +f5 didn't work , so can you please help , i need to go on with my project and this is making me late .

the windows opens and closes immediately , sometimes it opens and stays and then when i try running again and it goes back to the habit of closing immediately

//Code for hand detection and tracking;

include <iostream>

include "opencv/cv.h"

include "opencv/highgui.h"

using namespace std;

IplImage image = 0, *hsv = 0, *hue = 0, *mask = 0, *backproject = 0, *histimg = 0,back = 0, back2 = 0,image2 = 0,image3 = 0,bg = 0; CvHistogram *hist = 0;

//IplImage * ContrastBrightness(IplImage *, int , int ); int backproject_mode = 0; int select_object = 0; int track_object = 0; int show_hist = 1;

CvPoint origin; CvPoint RECT1; CvPoint RECT2; CvPoint p1; CvPoint p2;

CvRect selection; CvRect track_window; CvRect roiS; //Rect for size of ROI

CvBox2D track_box;

CvConnectedComp track_comp;

int hdims = 16; float hranges_arr[] = {0,180}; float* hranges = hranges_arr; int vmin = 10, vmax = 256, smin = 30; int area=0; int contrast=100, bright=50,smooth=7; double x,y,h,w;

void on_mouse( int event, int x, int y, int flags, void* param ) { if( !image ) return; if( image->origin ) y = image->height - y;

if( select_object ) { selection.x = MIN(x,origin.x); selection.y = MIN(y,origin.y); selection.width = selection.x + CV_IABS(x - origin.x); selection.height = selection.y + CV_IABS(y - origin.y); selection.x = MAX( selection.x, 0 ); selection.y = MAX( selection.y, 0 ); selection.width = MIN( selection.width, image->width ); selection.height = MIN( selection.height, image->height ); selection.width -= selection.x; selection.height -= selection.y; } switch( event ) { //on left mouse click ,mark as origin and intialize rectangle case CV_EVENT_LBUTTONDOWN: origin = cvPoint(x,y); selection = cvRect(x,y,0,0); select_object = 1; break; case CV_EVENT_LBUTTONUP: select_object = 0; if( selection.width > 0 && selection.height > 0 ) track_object = -1; break; } } //Page 61of 83 //Audible Sign Language FYP Report- Spring 2006 CvScalar hsv2rgb( float hue ) { int rgb[3], p, sector; static const int sector_data[][3]= {{0,2,1}, {1,2,0}, {1,0,2}, {2,0,1}, {2,1,0}, {0,1,2}}; hue = 0.033333333333333333333333333333333f; sector = cvFloor(hue); p = cvRound(255(hue - sector)); p ^= sector & 1 ? 255 : 0; rgb[sector_data[sector][0]] = 255; rgb[sector_data[sector][1]] = 0; rgb[sector_data[sector][2]] = p; return cvScalar(rgb[2], rgb[1], rgb[0],0); } int main( int argc, char** argv ) {

CvCapture* capture = 0; capture = cvCaptureFromCAM(0); //creating 3 windows and co controlling their position cvNamedWindow( "CamShiftDemo", 1 ); cvMoveWindow( "CamShiftDemo", 335, 100 ); cvNamedWindow( "ROI", 1 ); cvMoveWindow( "ROI", 10, 100 ); cvNamedWindow( "grey", 1 ); cvMoveWindow( "grey", 670, 100 );

bg=cvLoadImage ("bg.jpg",1);

//C++: void setMouseCallback(const string& winname, MouseCallback onMouse, void* userdata=0 ) //cvSetMouseCallback( "CamShiftDemo", on_mouse, 0 );

//C++: int createTrackbar(const string& trackbarname, const string& winname, int* value Optional pointer to an integer variable whose value reflects the position of the slider ... (more)

edit retag flag offensive close merge delete

Comments

1

i kinda sympathize with your ide

berak gravatar imageberak ( 2014-04-19 13:39:22 -0500 )edit