Programming & devoleping in Linux

Hi,

I'm currently thinking about a project, about the know-how.
The project involves intensive use of the CPU, the memory and IO communication.

I need to simulate an environment while there's a flow of IO data (from the simulator) between the PC and a stack of external minicomputers.

Simultaneously, the PC receives a certain amount of high resolution pictures from a camera (several dozens) and then recombine them into one big picture in less than a minute. The big picture now must go through a process of image recognition. This process is repeated continuously.

After every successful process of image recognition, the data acquired is recombined with the data from simulator and stored in a hard disk.

The simulator will receive/send chunks of data every 1ms.
At the end of the whole process, which will take a couple of weeks, the data stored will be graphically revealed and analyzed.

Related to the project, I think mastering the C++ and C# on a Linux platform is a good choice.

The questions are:
1. What Linux distribution should I choose?
2. Because I'm a newbie at image recognition, with what should I start? Should I use other's library?
3. Do you know some tutorials/books about image recognition? Isn't there any program already available for this stuff or should I make the program on my own?
4. What do you think about these books:
a).http://www.amazon.com/5-0-Nutshell-The-Definitive-Reference/dp/1449320104/ref=sr_1_1?ie=UTF8&qid=1361459105&sr=8-1&keywords=c%23 for learning C#
b).http://www.amazon.com/The-Linux-Programming-Interface-Handbook/dp/1593272200/ref=sr_1_1?ie=UTF8&qid=1361458627&sr=8-1&keywords=linux+api for learning the Linux API
c).http://www.amazon.com/Primer-Plus-Edition-Developers-Library/dp/0321776402/ref=sr_1_1?ie=UTF8&qid=1361458647&sr=8-1&keywords=c%2B%2B for improving my C++

Thank you,
RobertEagle
C# on a Linux platform
?
Yes, it's just a programming language. I know it is under the label of Microsoft but this has to mean that's inefficient on Linux? What would be the other choices? I need something to fit my project.
It's more than a label. C# is a Microsoft developed language and is only supported on Windows. You can use it on Linux, but why bother? You'd be better off with Java.

But of course, you're free to use C# on Linux. So if you want use it, don't let me stop you.
Linux is not necessarily essential for this. You can do it on windows as well. I use Seimens SIMATIC cards for IO usage. This is similar to your stack of external microcomputers. The cards are relatively cheap (200 euros) and very reliable. The Simatec NCM manager well give you the tools to write the raw values to somewhere in your processes memory.

For the image splicing, are your cameras waving around or are they fixed with respect to each other? If they are fixed, then I'd recommend skipping the image recognition stuff. Figure out where the images overlap, and manually splice the images togeather. It'll save a ton of processing power.

Otherwise, for photo stitching I really like Hugin. http://hugin.sourceforge.net/. It gives a lot of options, lets you set things like the lens parameters, and will automatically detect the overlapping points. The downside is that to make a really good stitch, it will take a significant amount of time (to stitch 12x 10MB photos, it took Hugin about 45 minutes on my i7 processor). Also, I don't think it takes command line parameters. Fortunately it is open source which means that you can take it apart and use only the parts of it that you need. That may save some processing time and will let you integrate it into your system.

As for C#, I don't think that there is a compiler for C# under Linux. That's because the language is integrated so deeply with the Win API that it is tough (impossible?) to make it platform independent.

The nice part about Linux is that it is light weight and will not take up resources that you don't need for this, thereby making your image processing potentially faster. However any "embedded" OS will do the same thing.

Your project sounds like a lot of fun. What is the end objective of this device?
Linux, from what others told me, is more open to things, not so ,,restrictive" as Windows, has a better community, and basically you can do anything. But this is what others told me.

Those minicomputers are actually microcontrollers (DSPs or ARM). To be honest, those microcontrollers, totaling 1000 Inputs/Outputs are going to be connected to 1000 neurons from a rat. They will record the ,,brain's" activity.

The camera is not fixed. The camera shall be moved sequentially after each photo taken (not by me, but by a precise stepper motor). Obviously, the camera's image is magnified through some optics. The whole area to be photographed is around 1mm2. With the photos made, the software makes the image recognition to find out the connections between the neurons. The whole area must be photographed and analyzed in no more than 1 minute. The connections are creating quite fast.
To be fully understood the program must run at least 2-3 weeks.
Now, from what you say, only the stitching takes a lot of time, and even with an i7.
Maybe using the video card to process the data? With what book should I start? OpenCV?

The objective of this project is finding certain properties of the axons and neurons, so deductively I can understand the functions and behavior of the neural network.
The end objective is to create (in correlation with my theories), not artificial intelligence (through physics it can be proved that it's impossible to create intelligence), but a superior type of processing.

A few issues i see that haven't been addressed yet.
First image recognition is not a trivial task at all and if you don't have a solid understanding of c++ (and programming concepts in general) it will be hard for you to implement. with that being said your probably going to want to study up on pattern recognition and neural networks.
Also what data are you storing over this 2-3 week period?
As far as the processing time, stitching 12 small images into 1 large image in under a minute isn't that unfeasible but that's mainly going to be based on how efficient your implementation is and how large the original small images are (as said above 12 10mb pictures takes a long time). Also do you need the image recognition on the large image to be done in this same 1 min period?
Also are the small camera's guaranteed to be oriented in a way that ensures that there is going to be some overlap so they can be properly stitched? I ask this because you only say they are moved by a step motor. Even if they are moved as long as they stay in the same alignment and overlap in the same place every time stewbonds thought about skipping the stitching should hold true or at-least knowing this can make it much much easier.
Last edited on
closed account (S6k9GNh0)
http://www.mono-project.com/What_is_Mono
@K0T4K0t4

It's certainly not an impossible task. While image recognition is difficult, there are lots of pre-made solutions already out there, especially for the simple task of stitching photos. You'd just need to implement what's out there. Hopefully he doesn't have to do the image recognition in real-time.

One such library which makes it easy is OpenCV
http://opencv.org/

Edit: I didn't realize OpenCV also had tailored functions for stitching. That's way too easy then:
http://docs.opencv.org/modules/stitching/doc/stitching.html
Last edited on
The data coming from those 1000 inputs/outputs is about the cell activation (axon activation).
Without the recognition I can't figure out where the signal goes.

The idea was to do real-time image recognition, stitching and photographing. The longer the time of doing this process, the more I loose accuracy regarding the neural network.
Maybe saving all those photos each minute, and after the simulation ends, I do the big image recognitions and with the data got from the IOs I could rebuild every part of the test. But it would take a lot of time and a lot of space. Just imagine that I have to do the photographing process for more than 30000 times.
For every big image recognition process I have to get no more than 100Kb (if I save it as ASCII format). Compare 100Kb*30000 with 100Mb*30000.

Nevertheless a single ms of data going/coming from a single neuron is made out of this:
a b (c) where a is a 16bit value which represents the id of the neuron, b is a 8bit value representing the action potential and c is a 24bit value which appears every second and represents the time.
The camera will stay on the on the alignment, because it's precise. Anyway, I suppose I could take in account some symbols over the board so the camera gets in the same position as the last one.

After all, on what GUI programming language should I focus on a Linux platform?
Should I buy from Amazon a book about OpenCV, even if I don't know CV?
Regarding the CV, I just need to do my job, I don't want to become a guru in CV.

RobertEagle

BTW: Video cards are as much as 30 times more powerful than any CPU in terms of flops. Wouldn't it be a good idea to redirect a part of what I have to process to the video card?
Last edited on
BTW: Video cards are as much as 30 times more powerful than any CPU in terms of flops. Wouldn't it be a good idea to redirect a part of what I have to process to the video card?


It would be nice if you could utilize the GPU. How feasible that would be depends on what kind of processes you will be doing.

It sounds like image IO and image recognition are going to be your bottlenecks. If you could somehow get key parts of the image recognition to run independently and on the GPU, then you might be able to save a lot of time.

I don't know anything about image recognition or openCV, but I noticed that there is a library out there called OpenCV_GPU.

The OpenCV GPU module is a set of classes and functions to utilize GPU computational capabilities. It is implemented using NVidia CUDA Runtime API , so only that vendor GPUs are supported. It includes utility functions, low level vision primitives as well as high level algorithms. I.e. the module is being developed as a powerful infrastructure for fast vision algorithms building on GPU with some high level state of the art functionality.


http://opencv.willowgarage.com/wiki/OpenCV_GPU

You might want to check that out.

It's not always fast to do computations on the GPU. You need to be able to serialize your tasks, and you need to give a large enough workload per thread to make the overhead (memory transfer etc.) worth it. Do some googling about image recognition on the GPU.
Last edited on
@stewbond
I never said it was impossible... i assume you didn't really read my post before making comments about it but in the future please actually read posts before trying to put words in someones mouth. I simply said that it wasn't trivial and i went on to say "it isn't unfeasible" that means its feasible or doable. Also when you have processing time constraints prebuilt solutions are usually not the best bet because they will have extra overhead and will take longer than making something for your specific use.

@op
Yes it would be nice if you could do some of the image recognition using the gpu but the performance gain that you are going to get from it is going to be highly dependent on the gpu your using and how well you utilize it. Its also important to note that not all gpu's are capable of being used for this type of task.

OpenCV will probably be your best bet as far as something preexisting. Also openCV GPU can only work on nvidia cards(an not even all of them) if i recall correctly. You also mentioned that you don't necessarily have to do all the processing in real time so id recommend that you set it up so you aren't forced to stay within the one minute mark for all the processing. Maybe do it in order as it comes in and have a cache of things that still need to be processed. The reason i mention this is because image recognition times can very greatly depending on a number of factors. So even though it might take several minutes on one image it might run much faster on others so by using a cache of stuff to process you might be able to get an average time close to the 1 minute mark and even if you have stuff thats unprocessed after your 2-3weeks it should be a relatively small amount.

Also in what time frame are you hoping to have this up and running in?
Last edited on
Already I'm thinking about the documentation.
I've decided for that C++ book for improving me, that Linux API book for being able to utilize in a proper manner.
Also I'm thinking for a OpenCV book, and still I don't know what to choose for a GUI application.
As I said, I need a program which at the end of all processes, displays graphically the results. Trying to understand everything just by reading numbers is like Einstein explaining you the General Relativity in the bus. For that I need a programming language. Still I'm not sure what to pick.

After starting this, I'll need to setup the hardware, which involves the silicons and bio organism.

In the best case, I hope at the end of this year, 2013.
Last edited on
Well good luck.
You should probably try to teach yourself one part at a time and make sure your comfortable using things like opencv before you try to implement it in your final project. Your probably also going to want to set up at least one small opencv program before hand too and run some simulations on test data to make sure that you are getting good and accurate results.
For gui's in c++ on linux you'll probably want to use qt or gtk.
If you know, could you recommend me a good book about GTK from the Amazon?

Related to the OpenCV what do you think about this book? Shall I buy it or not?
- http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134/ref=sr_1_2?ie=UTF8&qid=1361570298&sr=8-2&keywords=opencv
I don't want a book that's for advanced programmers, just one so I can do what I have to.
Yes, you're right about the before tests. If I don't make some tests before, it's very likely my code won't work.

I want to tell you from now, that you all were very helpful for my project and we keep in touch for the upcoming news:).

Thank you again,
RobertEagle
Topic archived. No new replies allowed.