Showing posts with label MATLAB GUI. Show all posts
Showing posts with label MATLAB GUI. Show all posts

Sunday, 11 August 2013

Music Player with Hand Gesture Control using Neural Network

Hello guys, I have already posted an article on hand gesture recognition using neural network,if you have not see it then please go through it first.Well,here is the Link 

So,using the previous implementation I am now going to show you how you can built a Music Player that will be controlled by hand gestures.That means there will be a separate predefined gesture for performing every individual task that will be performed on the player.

That means there will be an unique gesture for Play,another for pause and so on.


So here are the steps using which you can built it easily :

1. I hope you are all familiar with Matlab GUI,if not then please see this Link 

2. Now here I am not going to briefly explain how to play and pause music in matlab,here my main focus is to tell you how can you control this using hand gestures.

Still,if any one has any problem in building the music player he or she can tell his or her problem through comment,then I will post the code for that later.

3. For example lets assume we use the following gesture for play action.





Then we have to get at least 5-10 pic like this and save it into a folder.

4.  Now train the network with the sample picture,so that when ever any similar gesture is detected during testing,then system would perform some task.

For code reference,please visit this link below :

Gesture Recognition using Neural Network

5.Now the point is where to insert the code. Well for every recognition system we go for a threshold value to determine whether it is the desired result.In the previous Hand gesture recognition system post also I have done the same in the end.

So insert the desired music player action code within that MATCH_FOUND code block.
like this,

if(PLAY_IMG_MATCH_FOUND==TRUE)
{
  //Music player play code
}

Similarly if you want to perform any hard ware related task then just go to this link  and insert the code in the same block as I mentioned before.

Just for example,I have shown this one example PLAY action with this sample images and one gesture.

You can use different gestures for performing different task like PAUSE,STOP etc.

There are lot more things to do with this project...try it yourself, and please let me know about your new works...best of luck...thanks for visiting,have lots of fun :)

Wednesday, 13 February 2013

Making a Photoviewer with GUI using Matlab

Code :


clc;
imr=input('Enter the full path of the image frames:','s');
somefolder=imr;
filelist=dir(somefolder);
for i=1:size(filelist,1)
    if filelist(i).isdir ~=true
        fname=filelist(i).name;
        if strcmp(fname(size(fname,2)-3:size(fname,2)),'.jpg')==1
            tmp=imread([somefolder fname]);
            if size(tmp,3)==3;
                tmp=imresize(tmp,[400,400],'bilinear');
                imshow(tmp);
                pause(1);
                disp([fname,':loaded']);
            end
        end
    end
end

Building GUI :

If you dont know how create basic matlab GUI then you can see my previous post :

Building GUI with Matlab

Step 1 : I have made a very simple interface,drawn just a button  and an axes


Step 2 : Now open the GUI .m file by clicking view and then m-file editor



Step 3: Now paste the above code in the pushbutton_callback function and save

Step 4: Now run the code,press play button,then it should ask for the image folder path,write the path press          enter it will show the images

Building GUI with Matlab

1. Type 'guide' on the console and press enter



2. Now select a guide template and mark 'save on start up as' option then change the name,ex. test.fig
then press ok.

3. A screen will appear like this one...



4. Now you can draw button,use axis for showing images or videos,and make your own GUI.

5. To edit the matlab code do this,



6. Copy the matlab code what you want to execute after pressing a button within that particular button function

7. Then run your code pressing 'f5' it should show the GUI you built.