How to generate 3D point cloud data file from multiple images of the object? - matlab

Are there any tools or algorithm in Matlab or OpenCv, which will take multiple images of any object as input (from different location around the object) and produce the 3D coordinate of the object in the world.

Like Naveh said, in OpenCV the building blocks are there, but putting it together is something you would have to do.
That being said, people have generated a number of SfM tools in both C++ and Matlab. Depending on your goals there are a number of prepackaged things you can look at:
-There is a SfM Matlab Toolbox here, I have not personally used it but I've seen it a number of times.
-If you are just looking for a black-box solution, check out Visual SfM, it is a GUI-fied version of a common SfM workflow.
-A while ago I put together a guide for installing the Visual SfM components individually on Fedora, if you wanted to dig into them. I'm not sure how relevant it is now but it might help.
Regardless, you should certainly educate yourself on the processes involved in creating 3D structure from imagery. It is a complicated process with many details which need to be understood.

What you are asking for is a fully fledged structure from motion algorithm. I don't think such a thing exists in MATLAB or OpenCV right off the shelf. However, the building blocks required for such an algorithm are there.
I suggest you do some background reading to better understand what specific algorithm will suit your needs. A good place to start is in Richard Szeliski's textbook, chapter 7. A free draft is available here. This book is recommended both in general as a good computer vision textbook, and specifically as well for your question, in which Szeliski himself is quite an expert.

Related

Making a Matlab program run with Octave

I have recently found a Matlab program (TraitLab) that I would like to try and use, but I do not have a Matlab license. Given that I thought GNU Octave and Matlab are mostly compatible, I tried to run it in octave, but the GUI way to run the program depends on loading a .fig file (now I know that I can use load to get the struct content of that file, but that does not make it a figure I can pass around to various GUI functions), and the headless way to run it reports many parse errors about
nested functions not implemented in this context
Is there an obvious way to get a function written for Matlab that shows these two symptoms to run under Octave?
I have downloaded TraitLab and it is obvious to me that it is a program that will need heavy modification for you to run on octave, which you probably don't have time (or possibly expert knowledge) to implement.
In this case you really only have two other options.
1) Write to the developers and ask them if they could re-implement their code in such a way to make it Octave compatible. I wouldn't hold my breath since it's an academic library, but it's always worth pointing out that there is demand for Octave compatible code. Also given this is old code, it's still worth contacting the stats lab in oxford, since they may have moved to a different codebase that might also suit your needs (e.g. I know that a lot of stats people in oxford have made the switch to julia).
2) In the meantime, if you really want to run this but you don't have matlab, find a matlab installation (e.g. from a friend, or at your university) and create a standalone-version using Matlab's "Application Compiler".
OR
Consider buying matlab. It has a reputation for being prohibitively expensive, partly because University-wide licences do cost an arm and a leg. But for personal use (especially if you are a student?), with the right licence and only the necessary toolkits, it's actually not as prohibitively expensive as you might think.

MATLAB code for object detection using a webcam?

I am using an Arduino to control a car and I want to make it autonomous by using a webcam to see the object I want and make the car move to this location. I need several things:
MATLAB code
Interface between MATLAB and Arduino
How do I connect between them (software, not hardware)
I need any tutorial to learn or any instructions to make my project. I see many people have done this before, but unfortunately they did not mention how to start these kind of projects.
This question is fairly broad, so I apologize in advance for my somewhat general response.
The easiest way to interface a webcam with MATLAB is to make use of the Image Acquisition Toolbox. This link provides documentation detailing how to do this.
There is a good chance that you'll also want to make use of the Image Processing toolbox in MATLAB to be able to process the acquired images to determine where to go. See this doc. Though, after you've determined more specifically how you plan to process these images, there are probably numerous algorithms that you could find online that would not explicitly require this toolbox.
As far as interfacing with Arduino is concerned, there is a support package from the MathWorks that allows you to interface MATLAB code and Simulink models with Arduino. See this link
The only other general suggestion that I have is to consider using Simulink for this project rather than MATLAB. I feel that the model based approach of Simulink is a much better fit when designing control systems.
I hope that this helps you get things started.

OpenCV vs Matlab - Line/Hallway Detection

For my computer vision class, I'm going to be doing a project where I extract information about a hallway based on an image of that hallway. In particular, the lines of the hallway which extend toward a vanishing point will be of interest. My question is whether I should use Matlab, OpenCV, or something else to implement this.
I don't have a ton of time for this project. This fact makes Matlab seem like a good option since it seems you can usually get things up and running quickly there. On the other hand, I hope to take what I do for this class project and extend it out further for research once the class is complete. This makes OpenCV seem better as (from what I've read) it's much more efficient. It's possible another choice would be to implement it in Matlab for the project than port that code to an OpenCV form later. It should be noted that I have plenty of experience with C/C++, but only a little in both Matlab and OpenCV.
At the moment, I'm leaning toward just using OpenCV from the start. However, I would like the opinion of someone who's had a bit more experience here than myself. If you'd recommend something over both OpenCV and Matlab, please say so. Also, if you have any tips on what packages or toolkits might be useful for such a project, they would be greatly appreciated.
Any suggestions? Thanks for your time!
Using which one it is easier for you to write a piece of code to read an image file and display it?
If you know C++ very well, then it should be easy to debug the code. Since you say you have little experience with Matlab, if you make a small mistake in the code debugging can take a long time.
So I suggest break down the problem into:
read image and display it, this is very easy in both
detect edges using a simple/classic method, this is super easy in both, display the result and visually check it's correctly done
use a robust line fitting method, the RANSAC and Hough transform methods are probably what you're going to use, OpenCV makes using the easier than you can guess, Matlab also has built in functions to detect lines using the Hough transform, and gives you the start/end points of each segment. But if you're finding a vanishing point, you shouldn't need those.
The decision is yours, this is not a very difficult problem, can find loads of help on the web. Good luck with the project, and please let us know how it goes.

what advantages MATLAB has over SCILAB and vice versa?

i'm a computer systems engineering undergraduate student, i just want to know what advantages MATLAB has over SCILAB and vice versa other than that SCILAB is freeware.
i mean from a computer engineer point of view.
thanks
I can't get into the nitty-gritty details, as I haven't used SCILAB extensively.
But from a bird's eye view, MATLAB is a very polished software, with decades of development behind it. And a price to match. It has a huge array of specialized packages, good support, a reasonably well designed UI, and it's generally user-friendly enough for non-computer engineers to work with. It's also very common in the industry, so it's not a bad thing to have on your resume.
But if you don't have very complex needs (which I suspect, given the use I made of MATLAB during my undergrad years) and you don't need the robustness and polish of a professional package, SCILAB will probably meet your needs.
And since it's based on the MATLAB language, what you'll learn can be transferred later on if your needs change, or you find yourself working in an environment where MATLAB is the default.
Scilab is to MATLAB as OpenOffice is to MS Office. That is to say, it's a not-quite-a-clone, and it's not as polished. You do get most of the functionality of MATLAB, and the price is much more agreeable.
That said, if you want a free/open pretend MATLAB, I personally prefer Octave, since the syntax is closer to MATLAB's.
If you aren't bothered about MATLAB compatibility, then check out the statistics language/environment R, which is delightful.
Matlab is the de-facto industrial standard, is ready now and here, and has a big firm behind to push it.
Scilab has been for long time the open source alternative, but honestly it never appealed me. I think that or they never belived enough on the project, or that you need too much money to make a valid product of this kind.
And it is a real pity, since we desperately need a good open source alternative, because being open source is the only way to be very efficient on different platform: actually matlab is very good at prototyping small-medium programs, but since it is closed source, it's very difficult to scale it up, to supercomputers for example, requiring often a complete rewrite of the code.
Sage might be the third way, it has a lot of potential, and I would bet on it. Check it. It doesn't reinvent the wheel like Scilab did, but take existing software and merge it in a new program. It is based on python which gained a lot of momentum in the computing world, since it has shown to be both easy enough to quick prototype, and versatile enough to run on exotic platforma like supercomputers or GPGPU.
# MatlabDoug
It is feasible in small-medium environment, but on very big task the flexibility of open source is invaluable.
Starting from low-level tool like open-mpi that allows you to finely tune your applications, through higher-level framework like PETSc that lift a lot of work from your shoulders, to java and python implementations that let you concentrate on the algorithms forgetting about many of the headaches of the lower level languages.
But the real proof is that an astonishing majority of the top500 supercompunters prefers open source alternatives.

Robot simulation environments

I would like to make a list of remarkable robot simulation environments including advantages and disadvantages of them. Some examples I know of are Webots and Player/Stage.
ROS will visualize your robot and any data you've recorded from it.
Packages to check out would rviz and nav_view
This made me remember the breve project.
breve is a free, open-source software package which makes it easy to build 3D simulations of multi-agent systems and artificial life.
There is also a wikipage listing Robotics simulators
Microsoft Robotics Studio/Microsoft Robotics Developer Studio 2008
Also read this article on MSDN Magazine
It all depends on what you want to do with the simulation.
I do legged robot simulation, I am coming from a perspective that is different than mobile robotics, but...
If you are interested in dynamics, then the one of the oldest but most difficult to use is sd/fast. The company that originally made it was acquired by a large cad outfit.
You might try heading to : http://www.sdfast.com/
It will cost you a bit of money, but I trust the accuracy of the simulation. There is no contact or collision model, so you have to roll you own. I have used it to simulate bipeds, swimming fish, etc.. There is also no visualization. So, it is for the hardcore programmer. However, it is well respected among us old folk.
OpenDynamics engine is used by people http://www.ode.org/ for "easier" simulation. It comes with an integrator and a primitive visualization package. There are python binding (Hurray for python!).
The build in friction model.. is ... well not very well documented. And did not make sense. Also, the simulations can suddenly "fly apart" for no apparent reason. The simulations may or may not be accurate.
Now, MapleSoft (in beautiful Waterloo Canada) has come out with maplesim. It will set you back a bit of money but here is what I like about it:
It goes beyond just robotics. You can virtually anything. I am sure you can simulate the suspension system on a car, gears, engines... I think it even interfaces with electrical circuit simulation. So, if you are building a high performance product, than MapleSim is a strong contender. Goto www.maplesoft.com and search for it.
They are pretty nice about giving you an eval copy for 30 days.
Of course, you can go home brew. You can solve the Lagrange-Euler equations of motion for most simple robots using a symbolic computation program like maple or mathematica.
EDIT: Have not be able to elegantly do certain derivatives in Maple. I have to resort to a hack.
However, be aware of speed issue.
Finally for more biologically motivated work, you might want to look at opensim (not to be confused with OpenSimulator).
EDIT: OpenSim shares a team member with SD/Fast.
There a lots of other specialized simulators. But, beware.
In sum here are the evaluation criteria for a simulator for robot oriented work:
(1) What kind of collision model do you have ? If it is a very stiff elastic collision, you may have problem in numerical stability during collisions
(2) Visualization- Can you add different terrains, etc..
(3) Handy graphical building tools so you don't have to code then see-what-you-get.
Handling complex system (say a full scale humanoid) is hard to think about in your head.
(4) What is the complexity of the underlying simulation algorithm. If it is O(N) then that is great. But it could be O(N^4) as would be the case for a straight Lagrange-Euler derivation... then your system just will not scale no matter how fast your machine.
(5) How accurate is it and do you care?
(6) Does it help you integrate sensors. For mobile robots you need to have a "robot-eyes view"
(7) If it does visualization, can it you do things like automatically follow the object as it is moving or do you have to chase it around?
Hope that helps!
It's not as impressive looking as Webots, but RobotBasic is free, easy to learn, and useful for prototyping simple robot movement algorithms. You can also program a BasicStamp from the IDE.
I've been programming against SimSpark. It's the open-source simulation engine behind the RoboCup 3D Simulated Soccer League.
It's extensible for different simulations. You can plug in your own sensors, actuators and models using C++, Ruby and/or RSG (Ruby Scene Graph) files.
ABB has a quite a solution called RobotStudio for simulating their huge industrial robots. I don't think it's free and I don't guess you'll get much fun out of it but it's quite impressive. Here's a page about it
I have been working with Carmen http://carmen.sourceforge.net/ and find it useful.
One of the disadvantages with Carmen is the documentation with all respect I think the webpage is a bit outdated and insufficient. So I like to hear from other people with experience in working with Carmen, or student reports/projects dealing with Carmen.
You can find a great list with simulation environments http://www.intorobotics.com/robotics-simulation-softwares-with-3d-modeling-and-programming-support/
MRDS is one of the best and it's free. Also LabView is good to be used in robotcs
National Instruments' LabView is a graphical programming environment for developing measurement, test, and control systems.
It could be used for 3D control simulation with SolidWorks.
MRDS is free and is one of the best simulation environment for robotics. Workspace also can be used, and please check this link if you want a complete list with robotics simulation software
Trik Studio has a nice and clear 2D model simulator and also visual and textual programming programming environments for them. They also soon will support 3D modeling tools based on Morse simulator. Also it is free and opensource and has multi-language interface.