Skip to content

Instantly share code, notes, and snippets.

View wowitsmrinal's full-sized avatar

Mrinal Mohit wowitsmrinal

View GitHub Profile
5
5
#22B14C X1
#3F48CC X1
#ED1C24 X10
#FF00FF X10
#FFF200 X1
D: 4.00
#99CCFF 100 3 Motorcycle 14 0.8 Car 18 0.6 Train 22 0.5
#99FF66 50 2 Helicopter 25 0.2 Jet 30 0.1
6
6
#3F48CC X1
#B5E61D X0
#FFC90E X2
#ED1C24 X2
#880015 X1
#A349A4 X6
D: 4.00
#808000 250 2 Bicycle 10 0.9 Motorcycle 14 0.8
@wowitsmrinal
wowitsmrinal / map2
Created January 10, 2013 17:00
Map 2
5
4
#FF80FF X1
#EFE4B0 X1
#C3C3C3 X1
#FF8000 X1
#22B14C X1
D: 2.00
#A349A4 200 0
#808000 200 0
@wowitsmrinal
wowitsmrinal / map1
Created January 10, 2013 16:53
Map 1
6
5
#FFF200 X1
#A349A4 X2
#ED1C24 X10
#3F48CC X1
#B97A57 X1
#22B14C X15
D: 5.00
#880015 90 5 Motorcycle 14 0.8 Car 18 0.6 Train 22 0.5 Helicopter 25 0.2 Jet 30 0.1
@wowitsmrinal
wowitsmrinal / mapfile
Last active December 10, 2015 21:29
Map input file
6
6
#3F48CC X1
#B5E61D X0
#FFC90E X2
#ED1C24 X2
#880015 X1
#A349A4 X6
D: 4.00
#808000 250 2 Bicycle 10 0.9 Motorcycle 14 0.8
@wowitsmrinal
wowitsmrinal / wasd
Created January 7, 2013 16:48
Remote Controlled Car
#define PINL1 8 //left motor pin 1
#define PINL2 9 //left motor pin 2
#define PINR1 10 //right motor pin 1
#define PINR2 11 //right motor pin 2
void setup()
{
//Set motor pinouts as output
pinMode(PINL1,OUTPUT);
pinMode(PINL2,OUTPUT);
@wowitsmrinal
wowitsmrinal / basic_comm
Created January 7, 2013 13:20
Basic Communication
void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bits per second
Serial.println("Hello world!"); // prints hello with ending line break
}
void loop() {}
@wowitsmrinal
wowitsmrinal / binary.cpp
Created December 9, 2012 17:30
Binary Conversion
#define IMGDATA(image,i,j,k) *((uchar *)&image->imageData[(i)*(image->widthStep) + (j)*(image->nChannels) + (k)]) //extracts pixel information
IplImage* get_binary(IplImage* grayimg, int threshold)
{
IplImage* bin; //To store and return the result
bin = cvCreateImage(cvGetSize(grayimg),IPL_DEPTH_8U,1);
for(int i=0; i < grayimg->height; i++) {
for(int j=0; j < grayimg->width; j++) {
//It is checked if the gray-scale equivalent is larger than the threshold or not
@wowitsmrinal
wowitsmrinal / grayscale.cpp
Created December 9, 2012 17:19
Grayscale
#define IMGDATA(image,i,j,k) *((uchar *)&image->imageData[(i)*(image->widthStep) + (j)*(image->nChannels) + (k)]) //extracts pixel information
IplImage* get_grayscale(IplImage* colorimg)
{
IplImage* gray; //To store and return the result
gray = cvCreateImage(cvGetSize(colorimg),IPL_DEPTH_8U,1); //Resultant image initialized
for(int i=0; i < colorimg->height; i++) {
for(int j=0; j < colorimg->width; j++) {
//Conversion formula for gray-scale is applied as had been discussed
IMGDATA(gray,i,j,0) = 0.33*IMGDATA(colorimg,i,j,0)+0.56*IMGDATA(colorimg,i,j,1)+0.11*IMGDATA(colorimg,i,j,2);
@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