Color detection problem.
显示 更早的评论
I am trying to move my bot to the corresponding color in the image. I tried some algorithms but it didn't work out. I would be really happy if you could help me with this thing. I would be much obliged if you could provide me some kind of sample code or something. If you have this code please share the code with me.
Here's the image https://picasaweb.google.com/113606847351479489219/January142012#5697511886387683426
I am trying to move my bot to the black rectangle corresponding to the red.
Thanks in advance.
3 个评论
Chandra Kurniawan
2012-1-14
Your picture not found!
Please send me correct link.
Image Analyst
2012-1-14
What does "the black rectangle corresponding to the red" mean? Since you've been around here a while I would have thought you've already seen this: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Image Analyst
2012-1-14
What is a bot? You mean a robot? Like you're somehow communicating with a robot to move the robot to locations on the floor that are covered with colored paint or stickers?
回答(5 个)
i Venky
2012-1-14
0 个投票
1 个评论
Image Analyst
2012-1-14
I don't understand. Your image looks like you're doing a simulation yet you say you have a robot that is taking orders from your computer, perhaps via the Instrument Control Toolbox or something similar. So if you send out a signal through your serial communications line to move your robot to some real world location in a real room, on a calibrated playing field where distances are measured in meters, then how does that relate to your computer graphics simulation where things are measured in pixels?
Walter Roberson
2012-1-14
0 个投票
i Venky
2012-1-15
4 个评论
Image Analyst
2012-1-15
Yes, but you didn't answer my questions in my comment to your first answer to your question. The real world with your real robot have different images (presumably from one or more cameras) and a different coordinate system than your simulation (the computer graphics image).
Chandra Kurniawan
2012-1-15
@I Venky :
Hi,
I think you are not using appropriate methods.
That is true if you are using image processing techniques to detect the color of objects.
But, is the wrong way if you move the robot in image pixels.
It's better if you use vector. However pixel coordinates different with vector coordinate.
It's better if you convert this image into vector first.
You can make it with the command 'patch' from Matlab and then you can move these coordinates through 'Xdata' and 'Ydata'.
i Venky
2012-1-15
Image Analyst
2012-1-15
Yes, I believe you would. But that's asking way too much to have us give you code to control movement of a robot around a room while showing a simulation of it on the screen, particularly when you haven't been forthcoming in answering questions directly. You already have code for communicating with your robot over a serial line, and my File Exchange has several methods for finding colored patches in an image. You now have all the tools you need. I think the rest of your project is for you to adapt and integrate those concepts into your project.
Walter Roberson
2012-1-16
As you already have the other parts, all you need is
left = [0 0];
right = [0 1];
up = [1 0];
down = [1 1];
%calculate number of times need to go Left, Right, Up, Down. Then
for K = 1 : NLeft; out(left); end
for K = 1 : NRight; out(right); end
for K = 1 : NUp; out(up); end
for K = 1 : NDown; out(down); end
I would not have thought that would be a conceptual difficulty ?
类别
在 帮助中心 和 File Exchange 中查找有关 Detection and Tracking 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!