1. Engineers

    Engineers! Claim your free membership
    on CrazyEngineers.io RIGHT NOW!

    Do not stay behind!

    Sign Up in < 10 Seconds

    Dismiss Notice

Video processing in matlab

Discussion in 'Electrical | Electronics | Communications' started by silverscorpion, Nov 15, 2007.

  1. silverscorpion

    Engineering Discipline:
    Electronics & Telecommunications
    Hi guys,
    There's a robotics contest coming up in our univ. For that i've to build a robot that "sees" another robot in the arena and chases and catches it. Let's call mine as the cop and the other as thief. The arena will be video captured aerially and the video fed to the computer to which the robot is interfaced. The bot is autonomous. While designing the bot in itself is a big challenge, processing the video feed to identify where the thief is located currently is an even bigger problem. Does anyone know matlab? I know only the basics like plotting, func. generation, aliasing etc... Or is there some other software available to process the video? Can any one help me out on processing the video feed?
  2. silverscorpion

    Engineering Discipline:
    Electronics & Telecommunications
    Hey guys,
    Nobody knows matlab here? help meeee.....
  3. xheavenlyx

    xheavenlyx Addict

    Engineering Discipline:
    Electrical & Instrumentation
    Hi there Scorpion,

    A few Q you will have to answer before I can help.

    1. Do you have complete MATLAB? Do you have Image Processing, Signal Processing etc etc toolboxes??

    2. What markers will be used to identify the robots? All cannot be the same color or shape or something. Give me more to help you here.

    3. As you say you know MATLAB a bit, it would be nice if you can give me more details for your competition, rules, computer, camera (hardware) you will be using. Cuz, MATLAB has to detect the hardware first to get the images.

    4. I know a bit of video processing in MATLAB and simulink, but again you need the toolboxes and blocksets. Before asking what these are I would have to tell you to read up.(I think you already know :) )

    5. I am hoping you have a good team because building a robot itself is a challenge, having video processing is another story. Its not that tough, but you need a LOT of time if doing it alone...
  4. silverscorpion

    Engineering Discipline:
    Electronics & Telecommunications
    Hi xheavenlyx,
    Thanx for ur support and here is my update to the problem.

    I. Ya, i do think I have the complete matlab. In particular, I have the image processing and signal processing toolbox, as you mentioned will be necessary.

    II. These are the rules regarding the competition...
    As you see, the camera used is a standard web cam.

    And this is the sample arena.
    III These are the constraints of my bot...
    IV This is about the camera...
    Also, there'll be only two bot in the arena at any time, mine and the other. ie, participants won't be pitted against each other...

    That's it for now. Hope this will suffice... Expecting ur reply eagerly...
  5. xheavenlyx

    xheavenlyx Addict

    Engineering Discipline:
    Electrical & Instrumentation
    Dude, this one is a very interesting problem but you should know before hand, I nor anyone else can do the whole thing for you, since its very involving.

    You gave a really good reply, but the last answer? Do you have a good team to make the bot? Ok, whatever it is, I will reply with the algorithm within a day or two.
  6. xheavenlyx

    xheavenlyx Addict

    Engineering Discipline:
    Electrical & Instrumentation
    so firstly, you gotta divide the resolution in 5x5 with the same ratio of square as the field.

     So 32/160 = x/640      (32/160=0.2 which means 20% of hight)
         x = 128
         24/120 = x/480     (24/120=0.2 which means 20% of width. coincident?)
         x = 96
    you should be knowing how to start a video object and import each frame in MATLAB. If not check some tutorials online or something, even MATLAb help is awesome! But I will give the code anyway (learn from it to suite ur neeeds, thats why I am giving this to you)

    %% Block to aquire image from webcam.
    % Create video input object. 
    vid = videoinput('winvideo',1,'YUY2_320x240') %Check help for this before you start!! different frmats are possible.
    % Set video input object properties for this application.
    % Note that example uses both SET method and dot notation method.
    %vid.FrameGrabInterval = -1;
    %% Processing block
    % Start acquiring frames.
    while(vid.FramesAcquired<=100) % Stop after 100 frames
        imgrgb = getdata(vid);          %Store RGB image in imgrgb
    Next step will be to convert it to a grayscale image:

    %I = .2989*imgrgb(:,:,1)+.5870*imgrgb(:,:,2)+.1140*imgrgb(:,:,3);
    Then you threshold the image. (Search for thresholding in MATLAB)

    First do all this, get familiar.
  7. silverscorpion

    Engineering Discipline:
    Electronics & Telecommunications
    Hello xHx,
    Very sorry for the long break. I'm glad that I'm back to video processing. I've built a team of four people who are very eager to do this robot. Now these are the things we've planned to do:

    1. We've almost designed the chassis for the robot.
    2. We're gonna use stepper motors which are to be driven by ULN2308 IC.
    3. We're gonna interface the bot with the parallel port of the computer.
    4. We've got ourselves more familiar with matlab and have learnt some basic image processing skills like filters, image type conversions, correlation etc.

    Now the harder part: What to do next?

    Well, matlab should take the video feed, determine where the thief is currently, and tell the current co-ordinates to the bot via parallel port. So, how to do it? How is shape recognition done in matlab? Lots of help required. Please help. Waiting for your reply...

  8. xheavenlyx

    xheavenlyx Addict

    Engineering Discipline:
    Electrical & Instrumentation
    Dude, oh my god!!! Sorry for the lateeee reply. I was busy with my project and on top of that last week i was in bombay for medical reasons!!

    As I have mentioned before check the help files for many many examples, write down your objectives and look for the code in help files one by one, and everyone does it in their own way. It would take a lot of time if I did the whole thing.

    Check and tell me.
  9. sanih

    sanih Apprentice

    how can i save image of video fram by fram into the certain file?
    please help me it's very important for me.
    it's better for me if you ask me with matlab simulink!
  10. sherlyram

    sherlyram Newbie

    hi all
    i wan't to know about how we will get GOP from mpeg video also is any command is there to identify I frames in a video file?

    help me please

Share This Page