Thread: MJPG lag OpenCV
View Single Post
  #5   Spotlight this post!  
Unread 04-03-2014, 20:45
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: MJPG lag OpenCV

So I wrote an engine that exploits my FPS engine and attempts to lower and raise the delay between each iteration to match a specific variable that can be set by a single keystroke. After this season, I will release my code because I have all sorts of feature selections and those features we will never use that could be useful for teaching freshmen the importance of configuration files and the ability to reconfigure on the go.

Actually, let me post a snippet of code

PHP Code:
the variables I can change on the go:

bool readConfig() {
    
msg("===Config File Read Started===");
    
//create a new ifstream from IOS to read the file
    
ifstream fin(confLocationToUse);
    
//check if the file is open
    
if (fin.is_open()) {
        
//read the file to the variables
        //one variable is read per line
        
fin >> trackTargets;
        
fin >> trackBalls;
        
fin >> trackOtherRobots;
        
fin >> useNiftyInterface;
        
fin >> calculateDistance;
        
fin >> unmodifiedFeed;
        
fin >> showFPS;
        
fin >> onboard;
        
fin >> captype;
        
fin >> capdev;
        
fin >> imageWidth;
        
fin >> imageHeight;
        
fin >> camFOV;
        
fin >> pi;
        
fin >> uri;
        
fin >> staticTarget_width;
        
fin >> staticTarget_height;
        
fin >> staticTarget_distanceFromFloor;
        
fin >> dynamicTarget_width;
        
fin >> dynamicTarget_height;
        
fin >> dynamicTarget_distanceFromFloor;
        
fin >> arena_ballheight;
        
fin >> arena_ballwidth;
        
fin >> cam_distanceFromFront;
        
fin >> cam_distanceFromFloor;
        
fin >> redAlliance;
        
fin >> target_hueslidermin;
        
fin >> target_hueslidermax;
        
fin >> target_satslidermin;
        
fin >> target_satslidermax;
        
fin >> target_valslidermin;
        
fin >> target_valslidermax;
        
fin >> target_accuracy;
        
fin >> target_blurKernelSquare;
        
fin >> target_minArea;
        
fin >> target_maxArea;
        
fin >> ball_hueslidermin;
        
fin >> ball_hueslidermax;
        
fin >> ball_satslidermin;
        
fin >> ball_satslidermax;
        
fin >> ball_valslidermin;
        
fin >> ball_valslidermax;
        
fin >> ball_accuracy;
        
fin >> ball_blurKernelSquare;
        
fin >> ball_minarea;
        
fin >> ball_maxarea;
        
fin >> ball_minsides;
        
fin >> ball_maxsides;
        
fin >> maxfframes;
        
fin >> lockFPS;
        
//close the file properly to save the changes and dismount the file, preventing corruption
        
fin.close();
        
//debug
        
msg("Configuration Read Successfully!");
        
//return a true for succeed
        
return 1;
    } else {
        
msg("Read Failure!");
        return 
0;
    }
}


The feature selection:
void featureList() {
    
//clear the screen
    
nl(32);
    
//list the available features and their statuses
    //draw a lovely interface
    
msg("====================================");
    
msg("===========Feature List=============");
    
msg("Name           ||   ID   || Enabled ");
    
msg("===============++========++=========");
    
msg("Track Targets? ||    1   ||    " bool2str(trackTargets));
    
msg("------------------------------------");
    
msg("Track Balls?   ||    2   ||    " bool2str(trackBalls));
    
msg("------------------------------------");
    
msg("track Robots?  ||    3   ||    " bool2str(trackOtherRobots));
    
msg("------------------------------------");
    
msg("calc Distance? ||    4   ||    " bool2str(calculateDistance));
    
msg("------------------------------------");
    
msg("Interface?     ||    5   ||    " bool2str(useNiftyInterface));
    
msg("------------------------------------");
    
msg("LiveFeed       ||    6   ||    " bool2str(unmodifiedFeed));
    
msg("------------------------------------");
    
msg("saves directory||    7   ||    1");
    
msg("------------------------------------");
    
msg("Show FPS       ||    8   ||    " bool2str(showFPS));
    
msg("------------------------------------");
    
msg("FPS Engine     ||    9   ||    " bool2str(fpsEngine));
    
msg("====================================");
    
msg("0 = done; press the ID with [RETURN]");
    
msg("         to toggle value!           ");
    
msg("====================================");
    
msg("==========Saves Directory===========");
    
msg(image_uri);
    
msg("====================================");

I am overpowering my program to the point where no team (except those who dare) would ever use every single one of them. Hopefully when my code is released, it will be quite educational for EVERYONE. I even have detailed comments almost every other line of code!

I have some exports of what the program can do so far too
Attached Thumbnails
Click image for larger version

Name:	2014-03-02 20_12_51-DevVision2014.png
Views:	39
Size:	211.6 KB
ID:	16480  Click image for larger version

Name:	2014-03-02 20_14_49-.png
Views:	38
Size:	234.3 KB
ID:	16481  

Last edited by yash101 : 04-03-2014 at 21:04.