I was looking around and I couldn’t find anything that could walk me through how to install a webserver on the jetson tk1. I did look into http://elinux.org/RPi_webserver however I was unsure if I could just do the same on the tk1 as shown in the tutorial.
Here’s the overview of what I would like to do.
Access jetson on lan using a web browser.
User gives image through web browser to jetson server
Although the RPi server uses lighttpd, several others are available. Looks like lighttpd uses a bit over 1GB of disk, while apache2 uses over 4GB. Others, such as tomcat, will use even more space. Servers which can be installed via “apt-get” (see also “apt search”) basically are just Ubuntu issues and not any different on Jetson/L4T (other than having limited disk space on Jetson).
Ahh thank you I will look into that. However, I am still completely stumped on how I should approach this problem. I have installed apache2 no problem and the default page popped up after install. However, I’m unsure of how to get my opencv code in c++ to be the backend for my locally hosted website.
Basically, you want a WEB page on the web server that takes the user uploaded image and passes it to your application. This must be done by the dynamic bit of a web page, maybe with Java or PHP or some other language that can be embedded into a web page. The web page code makes a call to start your C++ application.
“(still noob to linux)”
None of this is specific to Linux.
Your application then needs to output the results and make a call to code which updates a web page.
FYI - be careful, you want the code to run on the server - not on a users machine in a web browser.
A quick google, it is possible to develop a C++ application for a web page but most people do not - far to much work. Easier to do it in C# or do it the way I suggested.
This exercise is more challenging than it would first appear, and requires some understanding of how web servers and browsers work together. It’s beyond the scope of this forum (it’s probably more of a Stack Overflow question or go through a couple of tutorials type of thing). I’ll give my 2 cents worth. There are a myriad of ways of solving this, but most approaches require an understanding of the steps involved.
Access to Jetson on LAN through web browser. Install a web server on Jetson and you’re done.
User gives image through web browser to jetson server Most web servers/services have a way to do this, whether it’s passing a URL or uploading an image to the server. Most modern web servers & browsers have well documented ways to do this, depending on the data format.
Jetson server spits back output image to user.
This is actually two parts -
3A) Analyze specified image and create modified image
3B) Serve modified image
3B is trivial using the web server. 3A is the tricky bit.
As you noted, you would like to have the web server “back end” analyze the picture using OpenCV and then save the modified version to a place where the web server can send it back out to the user.
Not surprisingly, this will totally be dependent on the web server that you are using. In the case that you mention, if you are not constrained by the actual web server you choose, try to find one that has an available module or equivalent for interfacing with OpenCV.
For something like Apache, you would most likely write a module (or hopefully find one) to interface with OpenCV. For example, you could use mod_python for interfacing Apache with OpenCV via Python.
Your choice will probably have a lot to do with development language(s) which you are most comfortable.
I would expect that there will be (several) issues in getting everything up and running to your satisfaction, but certainly support in the web programming world is more than adequate to get you to your goal. My guess is that the biggest hurdle will be to get OpenCV to link correctly with the web server interface, depending on which version of OpenCV you use (regular OpenCV or OpenCV4Tegra). If you are using SIFT or SURF in your OpenCV processing, you will have to use regular OpenCV.
Web programming is a very large topic, and not specific to the embedded world, L4T, or any particular programming language…so many choices and answers to this it would cover several volumes of books. Here’s an answer which is somewhat generic and not an exact answer.
If you want to use CUDA or OpenCV, then your Jetson must have the libraries installed for executing those programs using CUDA or OpenCV. Then any program you put on your system which uses those (e.g., compiled via nvcc) will work with GPU. Many many ways exist to call outside programs in a web server, e.g., simple CGI. You simply need to research how to build that outside program for something like CUDA, then point your web server at this through CGI or similar. Get your program which is called via the web server to work without CUDA/OpenCV, and then adapt the program with CUDA/OpenCV once it works.
As an alternative, if a program calls a library, and if functions in that library can be rewritten and compiled to use CUDA, then the program does not need to know about CUDA and will simply work. So there are your choices…build a program which a web server will call directly designed for CUDA, or build a library which your program (called by a web server) links to, and this will also work.