author

sharnam220

Inbox View Profile
5Comments

Tell us about yourself!

  • sharnam220 commented on prateek0927's instructable ball following robo

    where is the code bro. nice one

    View Instructable »
  • Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to…

    see more »

    Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to be usedfopen(ser); % starting serial Communication,opening serial portwhile(1)rgb_image = getsnapshot(vid); % storing image in an array variableflushdata(vid); %Flushing the bufferrbar=0;cbar=0;e=0;fR=rgb_image(:,:,1);fG=rgb_image(:,:,2);fB=rgb_image(:,:,3);% Storing RGB components of the image in seperate arraysI=((fR<=70) & (fG>=80) & (fB<=70)); % Converting the RGB Image into binary image///Detecting only the red component% Following are the steps For Detecting the red ballse=strel('disk',20);B=imopen(I,se);final=imclose(B,se);[L,n]=bwlabel(final);%imshow(rgb_image); %////THIS IS TO BE USED ONLY WHILE TESTING%hold on % ////THIS IS TO BE USED ONLY WHILE TESTINGfor k=1:n[r,c]=find(L==k);rbar=mean(r);cbar=mean(c);%plot(cbar,rbar,'Marker','*','MarkerEdgeColor','B' ,'MarkerSize',20) %////THIS IS TO BE USED ONLY WHILE TESTINGe=(((cbar>=x1)*2*2*2) + ((cbar<=x2)*2*2) + ((rbar>=y1)*2) + (rbar<=y2)) % Converting to decimal numberend% Decision Making Conditionsswitch (e)case 5disp('Move left'),fprintf(ser,'L');case 6disp('Move left'),fprintf(ser,'L');case 7disp('Move left'),fprintf(ser,'L');case 9disp('Move right'),fprintf(ser,'R');case 10disp('Move right'),fprintf(ser,'R');case 11disp('Move right'),fprintf(ser,'R');case 13disp('Move forward'),fprintf(ser,'F');case 14disp('Move back'),fprintf(ser,'B');otherwisedisp('Stop Moving'),fprintf(ser,'S');endendfclose(ser); % closing serial port

    View Instructable »
  • Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to…

    see more »

    Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to be usedfopen(ser); % starting serial Communication,opening serial portwhile(1)rgb_image = getsnapshot(vid); % storing image in an array variableflushdata(vid); %Flushing the bufferrbar=0;cbar=0;e=0;fR=rgb_image(:,:,1);fG=rgb_image(:,:,2);fB=rgb_image(:,:,3);% Storing RGB components of the image in seperate arraysI=((fR<=70) & (fG>=80) & (fB<=70)); % Converting the RGB Image into binary image///Detecting only the red component% Following are the steps For Detecting the red ballse=strel('disk',20);B=imopen(I,se);final=imclose(B,se);[L,n]=bwlabel(final);%imshow(rgb_image); %////THIS IS TO BE USED ONLY WHILE TESTING%hold on % ////THIS IS TO BE USED ONLY WHILE TESTINGfor k=1:n[r,c]=find(L==k);rbar=mean(r);cbar=mean(c);%plot(cbar,rbar,'Marker','*','MarkerEdgeColor','B' ,'MarkerSize',20) %////THIS IS TO BE USED ONLY WHILE TESTINGe=(((cbar>=x1)*2*2*2) + ((cbar<=x2)*2*2) + ((rbar>=y1)*2) + (rbar<=y2)) % Converting to decimal numberend% Decision Making Conditionsswitch (e)case 5disp('Move left'),fprintf(ser,'L');case 6disp('Move left'),fprintf(ser,'L');case 7disp('Move left'),fprintf(ser,'L');case 9disp('Move right'),fprintf(ser,'R');case 10disp('Move right'),fprintf(ser,'R');case 11disp('Move right'),fprintf(ser,'R');case 13disp('Move forward'),fprintf(ser,'F');case 14disp('Move back'),fprintf(ser,'B');otherwisedisp('Stop Moving'),fprintf(ser,'S');endendfclose(ser); % closing serial port

    View Instructable »
  • Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to…

    see more »

    Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to be usedfopen(ser); % starting serial Communication,opening serial portwhile(1)rgb_image = getsnapshot(vid); % storing image in an array variableflushdata(vid); %Flushing the bufferrbar=0;cbar=0;e=0;fR=rgb_image(:,:,1);fG=rgb_image(:,:,2);fB=rgb_image(:,:,3);% Storing RGB components of the image in seperate arraysI=((fR<=70) & (fG>=80) & (fB<=70)); % Converting the RGB Image into binary image///Detecting only the red component% Following are the steps For Detecting the red ballse=strel('disk',20);B=imopen(I,se);final=imclose(B,se);[L,n]=bwlabel(final);%imshow(rgb_image); %////THIS IS TO BE USED ONLY WHILE TESTING%hold on % ////THIS IS TO BE USED ONLY WHILE TESTINGfor k=1:n[r,c]=find(L==k);rbar=mean(r);cbar=mean(c);%plot(cbar,rbar,'Marker','*','MarkerEdgeColor','B' ,'MarkerSize',20) %////THIS IS TO BE USED ONLY WHILE TESTINGe=(((cbar>=x1)*2*2*2) + ((cbar<=x2)*2*2) + ((rbar>=y1)*2) + (rbar<=y2)) % Converting to decimal numberend% Decision Making Conditionsswitch (e)case 5disp('Move left'),fprintf(ser,'L');case 6disp('Move left'),fprintf(ser,'L');case 7disp('Move left'),fprintf(ser,'L');case 9disp('Move right'),fprintf(ser,'R');case 10disp('Move right'),fprintf(ser,'R');case 11disp('Move right'),fprintf(ser,'R');case 13disp('Move forward'),fprintf(ser,'F');case 14disp('Move back'),fprintf(ser,'B');otherwisedisp('Stop Moving'),fprintf(ser,'S');endendfclose(ser); % closing serial port

    Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to…

    see more »

    Hello i am using this code to control motor using arduino and matlab. But after running this program output is always stop moving even if i move the ball in all directions. Please help on this. Thanks :)clear;clc % Clearing Matlab desktopvid=videoinput('winvideo',1,'YUY2_320x240'); % Defining the video input objectset(vid,'FramesPerTrigger',1); % Setting frames per triggerpreview(vid); %////// Showing the video of the moving Ball(TO BE USED %% WHILE TESTING)pause(10);% Waiting for a certain time for the system to get initialisedrgb_image = getsnapshot(vid); % Storing Image in an array variable[a b c]= size(rgb_image); % Determining the size of the captured frame.y=a;x=b;% Defining Boundariesx1=x/2-120;x2=x/2+120;y1=y/2-30;y2=y/2+30;ser=serial('COM34'); % Defining the specified COM Port to be usedfopen(ser); % starting serial Communication,opening serial portwhile(1)rgb_image = getsnapshot(vid); % storing image in an array variableflushdata(vid); %Flushing the bufferrbar=0;cbar=0;e=0;fR=rgb_image(:,:,1);fG=rgb_image(:,:,2);fB=rgb_image(:,:,3);% Storing RGB components of the image in seperate arraysI=((fR<=70) & (fG>=80) & (fB<=70)); % Converting the RGB Image into binary image///Detecting only the red component% Following are the steps For Detecting the red ballse=strel('disk',20);B=imopen(I,se);final=imclose(B,se);[L,n]=bwlabel(final);%imshow(rgb_image); %////THIS IS TO BE USED ONLY WHILE TESTING%hold on % ////THIS IS TO BE USED ONLY WHILE TESTINGfor k=1:n[r,c]=find(L==k);rbar=mean(r);cbar=mean(c);%plot(cbar,rbar,'Marker','*','MarkerEdgeColor','B' ,'MarkerSize',20) %////THIS IS TO BE USED ONLY WHILE TESTINGe=(((cbar>=x1)*2*2*2) + ((cbar<=x2)*2*2) + ((rbar>=y1)*2) + (rbar<=y2)) % Converting to decimal numberend% Decision Making Conditionsswitch (e)case 5disp('Move left'),fprintf(ser,'L');case 6disp('Move left'),fprintf(ser,'L');case 7disp('Move left'),fprintf(ser,'L');case 9disp('Move right'),fprintf(ser,'R');case 10disp('Move right'),fprintf(ser,'R');case 11disp('Move right'),fprintf(ser,'R');case 13disp('Move forward'),fprintf(ser,'F');case 14disp('Move back'),fprintf(ser,'B');otherwisedisp('Stop Moving'),fprintf(ser,'S');endendfclose(ser); % closing serial port

    View Instructable »