diff --git a/Udai/1st.cpp b/Udai/1st.cpp new file mode 100644 index 0000000..3b98aae --- /dev/null +++ b/Udai/1st.cpp @@ -0,0 +1,6 @@ +#include +#include +#include +#include +#include "blobdetection.cpp" + diff --git a/Udai/Makefile b/Udai/Makefile new file mode 100644 index 0000000..d9ab27d --- /dev/null +++ b/Udai/Makefile @@ -0,0 +1,7 @@ +all: image run +image: OOPass.cpp + g++ -g $^ -o $@ -Wall `pkg-config opencv --cflags --libs` +run: + ./image +clean: + rm image diff --git a/Udai/OOPass.cpp b/Udai/OOPass.cpp new file mode 100644 index 0000000..dff4ae3 --- /dev/null +++ b/Udai/OOPass.cpp @@ -0,0 +1,255 @@ +#include +#include +#include +#include + +#include "blobdetection.cpp" + + +class game +{ +public: +cv::Mat img; +int *selected; +int **visited; +int *colour; +int *cenx; +int *ceny; +int dice; +int currx; +int curry; +int score; +int shape; +int rows; +int cols; + + +game() +{ currx = curry = 0; +score = 0; +} +void processmap(char []); +void start(); +void colouredarray(); +void inputdice(); +void calculateposition(); +int finish(); +}; + + + +int main() +{ + game g; + int i; + g.processmap("/home/udai/Documents/circles.jpeg"); + g.start(); + for(i = 1; i>players; + g.selected = new int[g.shape]; + int* finalscore = new int[players]; + for(i=0; i0) + std::cout<<"Next player now!\n"; + g.currx = g.curry = g.score = 0; + for(int j=1; jmax) + { + max = finalscore[i]; + winner = i; + } + } + std::cout<<"Winner of the game is Player "<>dice; + +while((dice<1)||(dice>6)) +{ + std::cout<<"Roll the dice"; + std::cin>>dice; +} +} + +void game::calculateposition() +{ +int i, j, temp; +float dist; +float min = sqrt( pow(rows, 2) + pow(cols, 2) ); +if(dice%2==0) + { + for(i=1; i(i,j)[0] >=240) && (img.at(i,j)[1] <=15) && (img.at(i,j)[2] <= 15) ) || + ( (img.at(i,j)[0] <=15) && (img.at(i,j)[1] >=240) && (img.at(i,j)[2] <= 15) ) || + ( (img.at(i,j)[0] <=15) && (img.at(i,j)[1] <=15) && (img.at(i,j)[2] >= 240) ) ) + + newimg.at(i,j) = 255; + else + newimg.at(i,j) = 0; + } + + cv::imshow("mywin", newimg); + cv::waitKey(0); + +//int **visited; +visited = new int*[newimg.rows]; +for(i=0; i(i,j)==255)&&(visited[i][j]==-1)) + {BFS(newimg, visited, shape, i, j); + shape++;} +for(i=0; i(i,j) = 255*sin(visited[i][j]); + std::cout<<"Number of blobs are "<(i,j)[0] = +//cv::Mat bin(img.rows, img.cols, CV_8UC1, cvScalarAll(0)); + +void game::start() +{ + int i, j; + int *count = new int[shape]; + cenx = new int[shape]; + ceny = new int[shape]; + colour = new int[shape]; + for(i=1; i(ceny[i],cenx[i])[0] >= 230) && (img.at(ceny[i],cenx[i])[1] <= 25) && (img.at(ceny[i],cenx[i])[2] <=25 )) + colour[i] = 0; + else if ((img.at(ceny[i],cenx[i])[0] <=25) && (img.at(ceny[i],cenx[i])[1] >=230) && (img.at(ceny[i],cenx[i])[2] <= 25)) + colour[i] = 1; + else if ((img.at(ceny[i],cenx[i])[0] <=25) && (img.at(ceny[i],cenx[i])[1] <=25) && (img.at(ceny[i],cenx[i])[2] >= 230)) + colour[i] = 2; + else colour[i] = -1; + } + +} \ No newline at end of file diff --git a/Udai/blobdetection.cpp b/Udai/blobdetection.cpp new file mode 100644 index 0000000..f0fb5ca --- /dev/null +++ b/Udai/blobdetection.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +struct node +{ + int x; + int y; +}; + +void BFS(cv::Mat newimg, int**visited, int shape, int i, int j) +{ +int front, rear; +node *q = new node[newimg.rows*newimg.cols]; +front = rear = 0; +q[front].x = j; +q[front].y = i; + +while(1) +{ + for(int u = q[front].y-1; u<=q[front].y+1; ++u) + for(int v = q[front].x-1; v<=q[front].x+1; ++v) + if((u>=0)&&(u<=newimg.rows)&&(v>=0)&&(v<=newimg.cols)) + if((visited[u][v]==-1)&&(newimg.at(u,v)==255)) + { + visited[u][v] = 0; + rear++; + q[rear].x = v; + q[rear].y = u; + } + visited[q[front].y][q[front].x] = shape; + front++; + + if(front>rear){delete q; break;} +} +} \ No newline at end of file diff --git a/aditya/Gazebo_assignment/my_robot/model.config b/aditya/Gazebo_assignment/my_robot/model.config deleted file mode 100644 index 7d5baae..0000000 --- a/aditya/Gazebo_assignment/my_robot/model.config +++ /dev/null @@ -1,16 +0,0 @@ - - - Test DD - 1.0 - model.sdf - - - Aditya - me@my.email - - - - AGV Simulation Task-1 - - - diff --git a/aditya/Gazebo_assignment/my_robot/model.sdf b/aditya/Gazebo_assignment/my_robot/model.sdf deleted file mode 100644 index 43eec7a..0000000 --- a/aditya/Gazebo_assignment/my_robot/model.sdf +++ /dev/null @@ -1,105 +0,0 @@ - - - - false - - 0 0 .1 0 0 0 - - - - .4 .2 .1 - - - - - - - - .4 .2 .1 - - - - - -0.15 0 -0.05 0 0 0 - - - .05 - - - - - - 0 - 0 - 1.0 - 1.0 - - - - - - -0.15 0 -0.05 0 0 0 - - - .05 - - - - - - 0.1 0.13 0.1 0 1.5707 1.5707 - - - - .1 - .05 - - - - - - - .1 - .05 - - - - - - 0.1 -0.13 0.1 0 1.5707 1.5707 - - - - .1 - .05 - - - - - - - .1 - .05 - - - - - - 0 0 -0.03 0 0 0 - left_wheel - chassis - - 0 1 0 - - - - - 0 0 0.03 0 0 0 - right_wheel - chassis - - 0 1 0 - - - - diff --git a/aditya/OOPS_assignment/CMakeLists.txt b/aditya/OOPS_assignment/CMakeLists.txt deleted file mode 100644 index 574ed87..0000000 --- a/aditya/OOPS_assignment/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project( Game ) -find_package( OpenCV REQUIRED ) -add_executable( game src/main.cpp ) -target_link_libraries( game ${OpenCV_LIBS} ) \ No newline at end of file diff --git a/aditya/OOPS_assignment/Makefile b/aditya/OOPS_assignment/Makefile deleted file mode 100644 index 845e3af..0000000 --- a/aditya/OOPS_assignment/Makefile +++ /dev/null @@ -1,160 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E remove -f - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/aditya/agv-sandbox/agv-sandbox/aditya/OOPS_assignment - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/aditya/agv-sandbox/agv-sandbox/aditya/OOPS_assignment - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..." - /usr/bin/cmake -i . -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/aditya/agv-sandbox/agv-sandbox/aditya/OOPS_assignment/CMakeFiles /home/aditya/agv-sandbox/agv-sandbox/aditya/OOPS_assignment/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/aditya/agv-sandbox/agv-sandbox/aditya/OOPS_assignment/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named game - -# Build rule for target. -game: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 game -.PHONY : game - -# fast build rule for target. -game/fast: - $(MAKE) -f CMakeFiles/game.dir/build.make CMakeFiles/game.dir/build -.PHONY : game/fast - -src/main.o: src/main.cpp.o -.PHONY : src/main.o - -# target to build an object file -src/main.cpp.o: - $(MAKE) -f CMakeFiles/game.dir/build.make CMakeFiles/game.dir/src/main.cpp.o -.PHONY : src/main.cpp.o - -src/main.i: src/main.cpp.i -.PHONY : src/main.i - -# target to preprocess a source file -src/main.cpp.i: - $(MAKE) -f CMakeFiles/game.dir/build.make CMakeFiles/game.dir/src/main.cpp.i -.PHONY : src/main.cpp.i - -src/main.s: src/main.cpp.s -.PHONY : src/main.s - -# target to generate assembly for a file -src/main.cpp.s: - $(MAKE) -f CMakeFiles/game.dir/build.make CMakeFiles/game.dir/src/main.cpp.s -.PHONY : src/main.cpp.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... game" - @echo "... rebuild_cache" - @echo "... src/main.o" - @echo "... src/main.i" - @echo "... src/main.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/aditya/OOPS_assignment/src/main.cpp b/aditya/OOPS_assignment/src/main.cpp deleted file mode 100644 index 9fea354..0000000 --- a/aditya/OOPS_assignment/src/main.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include - -cv::Mat inputimg() -{ - cv::Mat img; - img=cv::imread("./images.jpeg",1); - return img; -} - -void showimg(cv::Mat img) -{ - cv::imshow("window",img); - cv::waitKey(1000); - cv::destroyAllWindows(); -} - -cv::Mat cvtbinary(cv::Mat img,char color) -{ - int i,j; - cv::Mat binary(img.rows,img.cols,CV_8UC1,cvScalarAll(0)); - for(i=0;i(i,j)[color]>=200) - binary.at(i,j)=255; - } - } - return binary; -} - -char if_circle(cv::Mat img,int *x,int *y,char color) -{ - img=cvtbinary(img,color); - cv::Rect ROI(*x,*y,img.cols-*x,img.rows-*y); - img=img(ROI); - std::vector circles; - Canny(img,img,100,300,3); - GaussianBlur( img, img, cv::Size(9, 9), 2, 2 ); - // showimg(img); - HoughCircles(img,circles,CV_HOUGH_GRADIENT,1,img.rows/10,200,50,0,0); - if(circles.size()==0) - return 0; - else{ - *x=circles[circles.size()-1][0]; - *y=circles[circles.size()-1][1]; - return 1; - } -} - -class player -{ -public: - int score,x,y; - player() - { - score=0; - x=0; - y=0; - } -}; - -class boardgame -{ -public: - cv::Mat board; - boardgame() - { - board=inputimg(); - showimg(board); - } - int dice_read() - { - int x; - std::cout<<"Enter number on dice:"; - std::cin>>x; - return x; - } - char score(int x,int *score,int *pose_x,int *pose_y) - { - if(!x&1){ - (*score)*=2; - if(if_circle(board,pose_x,pose_y,2)) - return 1; - } - else if(x==1){ - (*score)+=10; - if(if_circle(board,pose_x,pose_y,0)) - return 1; - } - else{ - (*score)+=x; - if(if_circle(board,pose_x,pose_y,1)) - return 1; - } - return 0; - } -}; - -int main() -{ - boardgame bg; - player p1,p2; - while(1){ - std::cout<<"\n\n\tPlayer 1 plays\n"; - //std::cout<<"Pos. of Player1:"< - ---> - - -*/ diff --git a/aditya/Ros_assignment/publisher_subscriber/manifest.xml b/aditya/Ros_assignment/publisher_subscriber/manifest.xml deleted file mode 100644 index a178819..0000000 --- a/aditya/Ros_assignment/publisher_subscriber/manifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - publisher_subscriber - - - aditya - BSD - - http://ros.org/wiki/publisher_subscriber - - - - - - diff --git a/aditya/Ros_assignment/publisher_subscriber/src/publisher.cpp b/aditya/Ros_assignment/publisher_subscriber/src/publisher.cpp deleted file mode 100644 index 198ead4..0000000 --- a/aditya/Ros_assignment/publisher_subscriber/src/publisher.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "ros/ros.h" -#include "std_msgs/String.h" -#include - -int main(int argc,char **argv) -{ - ros::init(argc, argv,"talker"); - ros::NodeHandle n; - ros::Publisher chatter_pub = n.advertise("chatter",1000); - ros::Rate loop_rate(10); - int count=0; - while(ros::ok()){ - std_msgs::String msg; - std::stringstream ss; - ss <<"hello world "<< count; - msg.data = ss.str(); - ROS_INFO("%s", msg.data.c_str()); - chatter_pub.publish(msg); - ros::spinOnce(); - loop_rate.sleep(); - ++count; - } - return 0; -} diff --git a/aditya/Ros_assignment/publisher_subscriber/src/subscriber.cpp b/aditya/Ros_assignment/publisher_subscriber/src/subscriber.cpp deleted file mode 100644 index c07d02d..0000000 --- a/aditya/Ros_assignment/publisher_subscriber/src/subscriber.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "ros/ros.h" -#include "std_msgs/String.h" -/** -* This tutorial demonstrates simple receipt of messages over the ROS -system. -*/ -void chatterCallback(const std_msgs::String::ConstPtr& msg) -{ - ROS_INFO("I heard: [%s]", msg->data.c_str()); -} -int main(int argc,char **argv) -{ - /** - * The ros::init() function needs to see argc and argv so that it can - perform - * any ROS arguments and name remapping that were provided at the - command line. For programmatic - * remappings you can use a different version of init() which takes - remappings - * directly, but for most command-line programs, passing argc and argv - is the easiest - * way to do it. The third argument to init() is the name of the - node. - * - * You must call one of the versions of ros::init() before using any - other* part of the ROS system. - */ - ros::init(argc, argv,"listener"); - /** - * NodeHandle is the main access point to communications with the ROS - system. - * The first NodeHandle constructed will fully initialize this node, - and the last - * NodeHandle destructed will close down the node. - */ - ros::NodeHandle n; - /** - * The subscribe() call is how you tell ROS that you want to receive - messages - * on a given topic. This invokes a call to the ROS - * master node, which keeps a registry of who is publishing and who - * is subscribing. Messages are passed to a callback function, here - * called chatterCallback. subscribe() returns a Subscriber object - that you - * must hold on to until you want to unsubscribe. When all copies of - the Subscriber - * object go out of scope, this callback will automatically be - unsubscribed from - * this topic. - * - * The second parameter to the subscribe() function is the size of - the message - * queue. If messages are arriving faster than they are being - processed, this - * is the number of messages that will be buffered up before beginning - to throw - * away the oldest ones. - */ - ros::Subscriber sub = n.subscribe("chatter",1000, chatterCallback); - /** - * ros::spin() will enter a loop, pumping callbacks. With this - version, all - * callbacks will be called from within this thread (the main one). - ros::spin() - * will exit when Ctrl-C is pressed, or the node is shutdown by the - master. - */ - ros::spin(); - return 0; -} diff --git a/krishna95/oops assignment/CMakeLists.txt b/krishna95/oops assignment/CMakeLists.txt deleted file mode 100644 index 95daeb9..0000000 --- a/krishna95/oops assignment/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.4.6) -include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) - -# Set the build type. Options are: -# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage -# Debug : w/ debug symbols, w/o optimization -# Release : w/o debug symbols, w/ optimization -# RelWithDebInfo : w/ debug symbols, w/ optimization -# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries -#set(ROS_BUILD_TYPE RelWithDebInfo) - -rosbuild_init() - -#set the default path for built executables to the "bin" directory -set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) -#set the default path for built libraries to the "lib" directory -set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - -#uncomment if you have defined messages -#rosbuild_genmsg() -#uncomment if you have defined services -#rosbuild_gensrv() - -#common commands for building c++ executables and libraries -#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) -#target_link_libraries(${PROJECT_NAME} another_library) -#rosbuild_add_boost_directories() -#rosbuild_link_boost(${PROJECT_NAME} thread) -#rosbuild_add_executable(example examples/example.cpp) -#target_link_libraries(example ${PROJECT_NAME}) -#rosbuild_add_executable(talker src/gameImage.h ) -rosbuild_add_executable(game src/game/maingame.cpp src/game/Image.h src/game/Image.cpp src/game/Player.h src/game/Player.cpp src/game/Game.h src/game/Game.cpp) diff --git a/krishna95/oops assignment/Game.cpp b/krishna95/oops assignment/Game.cpp deleted file mode 100644 index 0cc921a..0000000 --- a/krishna95/oops assignment/Game.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "Game.h" - -void Game::numofplayers(int x){ - cout<<"starting to create an array of players"<id=Id; - player->pos.x=0; - player->pos.y=0; - player->score=0; - player->_count=image.count; - - } - void Game::setting(Image image){ - cout<<"enter the setting zone"<>>>>>> 06d2ba277a670859eec28c9fc13fb8ed2bd719a5 diff --git a/krishna95/oops assignment/Game.h b/krishna95/oops assignment/Game.h deleted file mode 100644 index 28269f6..0000000 --- a/krishna95/oops assignment/Game.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef GAME_H -#define GAME_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Player.h" -#include "Image.h" - - -//g++ game.cpp 'pkg-config opencv --cflags --libs' -using namespace std; - -class Game{ - private: - int dice; - public: - Player *winner; - cv::Mat img; - Player *players; - int num_players; - void numofplayers(int x); - void setplayer( Player* player,int Id,Image image); - void setting(Image image); -}; - -<<<<<<< HEAD -#endif -======= -#endif ->>>>>>> 06d2ba277a670859eec28c9fc13fb8ed2bd719a5 diff --git a/krishna95/oops assignment/Image.cpp b/krishna95/oops assignment/Image.cpp deleted file mode 100644 index a7165dd..0000000 --- a/krishna95/oops assignment/Image.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include "Image.h" -#include -using namespace std; -struct point { - int x; - int y; -}point; - - -struct ind -{ - int x;int y; - struct ind* next; -}; - ind *front,*rear; - -void enqueue(int x,int y){ - ind* n; - n=(ind*)malloc(sizeof(ind)); - n->x=x; - n->y=y; - n->next=NULL; - if(front==NULL){front=n;rear=front;} - else {rear->next=n;rear=n;} -} - - -void dequeue(){ - ind* t; - t=front; - front=t->next; - free(t); -} - - -void qfront(int* x,int *y){ - if(front!=NULL){ - *x=front->x; - *y=front->y;} - return; -} - - -int qempty(){ - if(front==NULL)return 1; - return 0;} - -cv::Mat Image::color_to_binary(cv::Mat img1) -{ - cv::Mat bin(img1.rows,img1.cols,CV_8UC1,cvScalarAll(0)); - for (int i=0;i(i,j)[0]==0 && img1.at(i,j)[1]==0 && img1.at(i,j)[2]==0 ) - bin.at(i,j)=0; - else - bin.at(i,j)=255; - } - } - return bin; -} - -void Image::find_prop(cv::Mat bin,cv::Mat img1){ - cout<<"find_prop has started"<(blob[k].y,blob[k].x)[0]==255) - { cout<<"here"<(blob[k].y,blob[k].x)[1]==255) - { cout<<"here"<(blob[k].y,blob[k].x)[2]==255) - { cout<<"here"<(i,j)==255){ - if(A[i][j]==-1){ - *count=*count+1; - enqueue(i,j); - while(qempty()==0){ - qfront(&x,&y); - int k,l; - dequeue(); - for(k=x-1;k<=x+1;k++){ - for(l=y-1;l<=y+1;l++){ - if(k=0 && l>=0 && A[k][l]==-1 && bin.at(k,l)==255){ - enqueue(k,l); - A[k][l]=*count; - } - } - } - A[x][y]=*count; - } - } - } - } - } - std::cout<<"number of blobs"<<*count<>>>>>> 06d2ba277a670859eec28c9fc13fb8ed2bd719a5 - - - - - - - - - diff --git a/krishna95/oops assignment/Image.h b/krishna95/oops assignment/Image.h deleted file mode 100644 index d7910d9..0000000 --- a/krishna95/oops assignment/Image.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef IMAGE_H -#define IMAGE_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct prop{ - char color; - int x; - int y; -}; - - - -class Image{ - private: - cv::Mat img; - int **A; - public: - prop *blob; - int count; - Image(cv::Mat img3); - cv::Mat color_to_binary(cv::Mat img1); - void BlobDetect(cv::Mat bin,int *count,cv::Mat img1); - void definearray(int count); - void find_prop(cv::Mat bin,cv::Mat img1); - -}; - -<<<<<<< HEAD -#endif -======= -#endif ->>>>>>> 06d2ba277a670859eec28c9fc13fb8ed2bd719a5 diff --git a/krishna95/oops assignment/Player.cpp b/krishna95/oops assignment/Player.cpp deleted file mode 100644 index aa32d52..0000000 --- a/krishna95/oops assignment/Player.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "Player.h" - - - - -void Player::Reqcolor(int outcome){ - if (outcome%2==0) - reqcolor='r'; - else - if (outcome==1) - reqcolor='b'; - else - reqcolor='g'; - cout<<"required colour is "<pos.x && blob[i].y>pos.y) - { - if (sqrt((blob[i].x-pos.x)*(blob[i].x-pos.x)+(blob[i].y-pos.y)*(blob[i].y-pos.y)) -#include -#include -#include -#include "Image.h" - -using namespace std; - - struct point { - int x; - int y; -}; - - -class Player { -private: - int outcome; - char reqcolor; - public: - int score; - int id,_count; - point pos; - - void Reqcolor(int outcome); - point RequiredPos(point pos,int outcome,prop *blob); - point updatepos(point pos,int outcome,prop *blob); - int updatescore(int outcome,int score); - void update(int outcome,prop *blob); - void play(prop *blob); -}; - -<<<<<<< HEAD -#endif -======= -#endif ->>>>>>> 06d2ba277a670859eec28c9fc13fb8ed2bd719a5 diff --git a/krishna95/oops assignment/board.jpg b/krishna95/oops assignment/board.jpg deleted file mode 100644 index c28806b..0000000 Binary files a/krishna95/oops assignment/board.jpg and /dev/null differ diff --git a/krishna95/oops assignment/maingame.cpp b/krishna95/oops assignment/maingame.cpp deleted file mode 100644 index 7956a1c..0000000 --- a/krishna95/oops assignment/maingame.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include "Image.h" -#include "Player.h" -#include "Game.h" -#include -using namespace std; -int main(){ - Game game; - game.img=cv::imread("board.jpg",1); - - cv::namedWindow("win",0); - cv::imshow("win",game.img); - cv::waitKey(0); - Image board(game.img); - cout<<"enter the number of players"<>game.num_players; - cout<<"done"< - - - beginner_tutorials - - - krish.kgp - BSD - - http://ros.org/wiki/beginner_tutorials - - - - - - - - diff --git a/krishna95/ros assignment/publisher.cpp b/krishna95/ros assignment/publisher.cpp deleted file mode 100644 index 0b347d9..0000000 --- a/krishna95/ros assignment/publisher.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "ros/ros.h" -#include "std_msgs/String.h" -#include -int main(int argc,char ** argv) -{ - ros::init(argc,argv,"talker"); - ros::NodeHandle n; - ros::Publisher agv_pub=n.advertise("chatter",100); - int count=0; - ros:: Rate loop_rate(10); - while (ros::ok()) - { - std_msgs:: String msg; - std:: stringstream ss; - ss << "hello world" << count; - msg.data=ss.str(); - ROS_INFO("%s",msg.data.c_str()); - agv_pub.publish(msg); - ros::spinOnce(); - loop_rate.sleep(); - ++count; - - } - return 0; -} \ No newline at end of file diff --git a/krishna95/ros assignment/subscriber.cpp b/krishna95/ros assignment/subscriber.cpp deleted file mode 100644 index 53ef39a..0000000 --- a/krishna95/ros assignment/subscriber.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "ros/ros.h" -#include "std_msgs/String.h" - -void callback(const std_msgs::String::ConstPtr& msg) -{ - ROS_INFO("I heard: [%s]",msg->data.c_str()); -} -int main(int argc,char ** argv) -{ - ros::init(argc, argv,"listener"); - ros::NodeHandle n; - ros::Subscriber sub=n.subscribe("chatter",100,callback); - ros::spin(); - return 0; -} \ No newline at end of file diff --git a/oops assignment/CMakeLists.txt b/oops assignment/CMakeLists.txt deleted file mode 100644 index 95daeb9..0000000 --- a/oops assignment/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.4.6) -include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) - -# Set the build type. Options are: -# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage -# Debug : w/ debug symbols, w/o optimization -# Release : w/o debug symbols, w/ optimization -# RelWithDebInfo : w/ debug symbols, w/ optimization -# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries -#set(ROS_BUILD_TYPE RelWithDebInfo) - -rosbuild_init() - -#set the default path for built executables to the "bin" directory -set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) -#set the default path for built libraries to the "lib" directory -set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - -#uncomment if you have defined messages -#rosbuild_genmsg() -#uncomment if you have defined services -#rosbuild_gensrv() - -#common commands for building c++ executables and libraries -#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) -#target_link_libraries(${PROJECT_NAME} another_library) -#rosbuild_add_boost_directories() -#rosbuild_link_boost(${PROJECT_NAME} thread) -#rosbuild_add_executable(example examples/example.cpp) -#target_link_libraries(example ${PROJECT_NAME}) -#rosbuild_add_executable(talker src/gameImage.h ) -rosbuild_add_executable(game src/game/maingame.cpp src/game/Image.h src/game/Image.cpp src/game/Player.h src/game/Player.cpp src/game/Game.h src/game/Game.cpp) diff --git a/oops assignment/Game.cpp b/oops assignment/Game.cpp deleted file mode 100644 index d485945..0000000 --- a/oops assignment/Game.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "Game.h" - -void Game::numofplayers(int x){ - cout<<"starting to create an array of players"<id=Id; - player->pos.x=0; - player->pos.y=0; - player->score=0; - player->_count=image.count; - - } - void Game::setting(Image image){ - cout<<"enter the setting zone"< -#include -#include -#include -#include -#include -#include -#include -#include -#include "Player.h" -#include "Image.h" - - -//g++ game.cpp 'pkg-config opencv --cflags --libs' -using namespace std; - -class Game{ - private: - int dice; - public: - Player *winner; - cv::Mat img; - Player *players; - int num_players; - void numofplayers(int x); - void setplayer( Player* player,int Id,Image image); - void setting(Image image); -}; - -#endif \ No newline at end of file diff --git a/oops assignment/Image.cpp b/oops assignment/Image.cpp deleted file mode 100644 index 4fdfc11..0000000 --- a/oops assignment/Image.cpp +++ /dev/null @@ -1,160 +0,0 @@ -#include "Image.h" -#include -using namespace std; -struct point { - int x; - int y; -}point; - - -struct ind -{ - int x;int y; - struct ind* next; -}; - ind *front,*rear; - -void enqueue(int x,int y){ - ind* n; - n=(ind*)malloc(sizeof(ind)); - n->x=x; - n->y=y; - n->next=NULL; - if(front==NULL){front=n;rear=front;} - else {rear->next=n;rear=n;} -} - - -void dequeue(){ - ind* t; - t=front; - front=t->next; - free(t); -} - - -void qfront(int* x,int *y){ - if(front!=NULL){ - *x=front->x; - *y=front->y;} - return; -} - - -int qempty(){ - if(front==NULL)return 1; - return 0;} - -cv::Mat Image::color_to_binary(cv::Mat img1) -{ - cv::Mat bin(img1.rows,img1.cols,CV_8UC1,cvScalarAll(0)); - for (int i=0;i(i,j)[0]==0 && img1.at(i,j)[1]==0 && img1.at(i,j)[2]==0 ) - bin.at(i,j)=0; - else - bin.at(i,j)=255; - } - } - return bin; -} - -void Image::find_prop(cv::Mat bin,cv::Mat img1){ - cout<<"find_prop has started"<(blob[k].y,blob[k].x)[0]==255) - { cout<<"here"<(blob[k].y,blob[k].x)[1]==255) - { cout<<"here"<(blob[k].y,blob[k].x)[2]==255) - { cout<<"here"<(i,j)==255){ - if(A[i][j]==-1){ - *count=*count+1; - enqueue(i,j); - while(qempty()==0){ - qfront(&x,&y); - int k,l; - dequeue(); - for(k=x-1;k<=x+1;k++){ - for(l=y-1;l<=y+1;l++){ - if(k=0 && l>=0 && A[k][l]==-1 && bin.at(k,l)==255){ - enqueue(k,l); - A[k][l]=*count; - } - } - } - A[x][y]=*count; - } - } - } - } - } - std::cout<<"number of blobs"<<*count< -#include -#include -#include -#include -#include -#include -#include -#include - -struct prop{ - char color; - int x; - int y; -}; - - - -class Image{ - private: - cv::Mat img; - int **A; - public: - prop *blob; - int count; - Image(cv::Mat img3); - cv::Mat color_to_binary(cv::Mat img1); - void BlobDetect(cv::Mat bin,int *count,cv::Mat img1); - void definearray(int count); - void find_prop(cv::Mat bin,cv::Mat img1); - -}; - -#endif \ No newline at end of file diff --git a/oops assignment/Player.cpp b/oops assignment/Player.cpp deleted file mode 100644 index 3b3cde0..0000000 --- a/oops assignment/Player.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "Player.h" - - - - -void Player::Reqcolor(int outcome){ - if (outcome%2==0) - reqcolor='r'; - else - if (outcome==1) - reqcolor='b'; - else - reqcolor='g'; - cout<<"required colour is "<pos.x && blob[i].y>pos.y) - { - if (sqrt((blob[i].x-pos.x)*(blob[i].x-pos.x)+(blob[i].y-pos.y)*(blob[i].y-pos.y)) -#include -#include -#include -#include "Image.h" - -using namespace std; - - struct point { - int x; - int y; -}; - - -class Player { -private: - int outcome; - char reqcolor; - public: - int score; - int id,_count; - point pos; - - void Reqcolor(int outcome); - point RequiredPos(point pos,int outcome,prop *blob); - point updatepos(point pos,int outcome,prop *blob); - int updatescore(int outcome,int score); - void update(int outcome,prop *blob); - void play(prop *blob); -}; - -#endif \ No newline at end of file diff --git a/oops assignment/board.jpg b/oops assignment/board.jpg deleted file mode 100644 index c28806b..0000000 Binary files a/oops assignment/board.jpg and /dev/null differ diff --git a/oops assignment/maingame.cpp b/oops assignment/maingame.cpp deleted file mode 100644 index 0db6c5c..0000000 --- a/oops assignment/maingame.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include -#include "Image.h" -#include "Player.h" -#include "Game.h" -#include -using namespace std; -int main(){ - Game game; - game.img=cv::imread("board.jpg",1); - - cv::namedWindow("win",0); - cv::imshow("win",game.img); - cv::waitKey(0); - Image board(game.img); - cout<<"enter the number of players"<>game.num_players; - cout<<"done"< - - - beginner_tutorials - - - krish.kgp - BSD - - http://ros.org/wiki/beginner_tutorials - - - - - - - -