Skip to content

Instantly share code, notes, and snippets.

View wowitsmrinal's full-sized avatar

Mrinal Mohit wowitsmrinal

View GitHub Profile
@wowitsmrinal
wowitsmrinal / input_format
Last active October 12, 2015 17:18
Input File Format
<int> Number of regions
<int> Number of cities
<hex> Color of region 1 X<int> Multiplier of region 1
<hex> Color of region 2 X<int> Multiplier of region 2
.
.
.
D: <float> Distance Scaling Factor
<float> Initial Money
<hex> Color of city 1 X<int> Booty of city 1 <int> No. of vehicles <int> Cost of vehicle 1 <float> Distance Scaling Factor of vehicle 1 ...
@wowitsmrinal
wowitsmrinal / map.txt
Last active October 12, 2015 17:18
Sample Input
6
6
#3F48CC X1
#B5E61D X0
#FFC90E X2
#ED1C24 X2
#880015 X1
#A349A4 X6
D: 4.00
0.0
@wowitsmrinal
wowitsmrinal / fileinput.c
Last active October 12, 2015 17:18
File Input
struct vehicle
{
char name[20];
int cost;
float distance_scaling_factor;
}Vehicle;
float distance_scaling_factor;
float bankBalance;
int no_of_cities,no_of_regions;
struct city
@wowitsmrinal
wowitsmrinal / opencvtest.cpp
Created December 9, 2012 16:13
OpenCV Test
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
printf("\nOpenCV is correctly installed! Press any key to exit!\n");
cvWaitKey(0);
@wowitsmrinal
wowitsmrinal / readimage.cpp
Created December 9, 2012 16:24
Read Image
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
IplImage* img;
char win[] = "Showing an Image";
@wowitsmrinal
wowitsmrinal / genimage.cpp
Created December 9, 2012 16:33
Generate Image
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
IplImage* img;
char win[] = "Striped Image";
@wowitsmrinal
wowitsmrinal / genimage.cpp
Created December 9, 2012 16:33
Generate Image
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
IplImage* img;
char win[] = "Striped Image";
@wowitsmrinal
wowitsmrinal / viewvideo.cpp
Created December 9, 2012 16:48
View Video
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
CvCapture* capture = cvCreateFileCapture("testvid.avi"); //The video is loaded into a pointer of type CvCapture
IplImage* frame; //To store each frame of the video as an image
@wowitsmrinal
wowitsmrinal / mousecallback.cpp
Created December 9, 2012 17:00
Mouse Callback
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int mx=0, my=0, clicked=0; //Global variables to store image co-ordinates and the flag to check
void mouse_callback(int event, int x, int y, int flags, void* param)
{
@wowitsmrinal
wowitsmrinal / capturecam.cpp
Created December 9, 2012 17:07
Capture from Camera
#include "stdafx.h"
#include <stdio.h>
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
CvCapture* capture = cvCreateCameraCapture(-1); //The streaming video is loaded into a pointer of type CvCapture
IplImage* frame; //For each frame of the video