Community
cancel
Showing results for 
Search instead for 
Did you mean: 
MHawa1
Beginner
2,201 Views

my browser can't see OpenCV.html on Edison web server, why ?

Hello, I'm hoping someone can shed some light on the issue I've been seeing when trying to setup Edison board to run OpenCV sample application.

I've followed the instructions on this helpful tutorial : http://makezine.com/projects/make-43/photographic-memory/ http://makezine.com/projects/make-43/photographic-memory/

I'm able to load the software, setup the WIFI, get internet access to load packages, and was able to execute the suggested program. However, to see the final result I need to point my web browser to the file " http://192.168.1.17/OpenCV.html" in order to examine the result of image modifications done by the sample program. Unfortunately, I can't seem to get the Edison's server to serve up the page, rather I get this error message:

"The page at /OpenCV.html was not found."

Another anomaly I encountered may be related to this server, is that my browser can't see the default page if I use the name of my board " http://edison.local". However, I can see the default web page (just fine) if I use this address in browser " http://192.168.1.17". For some reason the name of the board is not getting resolved.

Has anyone seen this kind of error ? any suggestions on how to solve these issues? thank you in advance for any help.

0 Kudos
23 Replies
idata
Community Manager
132 Views

Hi M.Hawana,

 

 

Thank you for reaching out.

 

I would like to know which image version you're using on your Edison board? Is it the latest or a previous image?

 

Not so long ago some users reported issues with the Edison device information webpage with recent images, so I'm wondering if this might be related to the same issue. Also, looking at the tutorial you're following I can see that it was made in 2014-2015, so I'm pretty sure an older image was used for the project. I would suggest you to try with an older image, here's the link to download version 2.1 http://downloadmirror.intel.com/25028/eng/edison-image-ww25.5-15.zip http://downloadmirror.intel.com/25028/eng/edison-image-ww25.5-15.zip.

 

 

Regards,

 

-Pablo
MHawa1
Beginner
132 Views

Pablo, thanks for your reply.

as for your question on what image I was using...I was using this version "edison-image-20160315".

as for the suggested image you provided

"http://downloadmirror.intel.com/25028/eng/edison-image-ww25.5-15.zip http://downloadmirror.intel.com/25028/eng/edison-image-ww25.5-15.zip" that image did not work either. I ended up with same results. It seems that the only page I'm able to get out of the web server of the Edison board is to display the default "Device Information" page.

It's difficult to work with this Edison board if I can't get the webserver to display the result of the image transformation of my experiments. This is such a fundamental feature I would assume it should work straight out of the box.

Can you suggest a way to debug this issue? Is there a switch to turn on that would cause the server to spit more debug information which may help in diagnosing this issue ? Can "Intel support team" help in this matter ?

idata
Community Manager
132 Views

Hi M.Hawana,

 

 

Thank you for testing with the instructions we provided in our first post. Let us take a closer look at this case to see if we can provide a different suggestion.

 

Just to clarify, when using the 2.1 image did you get the same "The page at /OpenCV.html was not found." message from your first post? Or did you get a different message this time?

 

 

Regards,

 

-Pablo
MHawa1
Beginner
132 Views

Hello Pablo,

yes, using the image you provided me in the last post, I got the same identical message as before.

idata
Community Manager
132 Views

Hi M.Hawana,

 

 

We believe the error occurs the default Webserver is running and it had priority. This also happens with the Webserver example from the Arduino IDE. It cannot be seen because the one inside the Edison is running.

 

What we do is that we disable this webpage from running from the start, we believe that might solve the issue. Look for the following file /usr/lib/edison_config_tools/edison-config-server.js and comment the line where the script starts running.

 

You can check this thread for additional details /thread/55649 https://communities.intel.com/thread/55649.

 

 

Regards,

 

-Pablo
MHawa1
Beginner
132 Views

Hello Pablo,

per your instructions, I commented out the webserver, and I reset the Edison board. So, now when I point my web browser to load the default page I get a different error:

This site can't be reached

192.168.1.17 refused to connect.

I also get a similar message when I try loading a specific page like " http://192.168.1.17/OpenCV.html".

Pablo, I'm not sure I understand your reasoning for wanting me to stop the default server, because I still need a webserver to display my images. In the example I mentioned at the beginning of this thread, there were no instructions to start a new server. So, in your suggestion above, did you have another webserver that is assumed to be running, or do you expect that I be starting another server myself ?

(PS: for the latter option if you want me to start a new server, then can you please point me to instructions to such a step)?

idata
Community Manager
132 Views

Hi M.Hawana,

 

 

Let us check if we can share some other instructions for you to set up a different webserver or a different way to solve the problem with the current one. Let us keep investigating.

 

 

Regards,

 

-Pablo
idata
Community Manager
132 Views

Hi M.Hawana,

Even if the guide is outside our scope of support given it is not part of our documentation, we have tried to follow every step from it just as you've been doing it. What we have found is an error with the Python code and while we try to edit it we were not able to make it work.

 

We received the following error:

OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /edison_dev/yocto/rel3.5/build_edison/tmp/work/core2-32-poky-linux/opencv/2.4.11+gitAUTOINC+2c9547e314-r0/git/modules/imgproc/src/color.cpp, line 3739

 

Traceback (most recent call last):

 

File "http://facedetection.py/ FaceDetection.py", line 12, in

 

gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

 

cv2.error: /edison_dev/yocto/rel3.5/build_edison/tmp/work/core2-32-poky-linux/opencv/2.4.11+gitAUTOINC+2c9547e314-r0/git/modules/imgproc/src/color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cvtColor

Looking at the comments from the Makezine tutorial, there are some users who reported issues with the Python script and with the guide itself. From our tests, everything seems to be working from the Edison side, but the complete process in the guide doesn't seem to be quite correct. The guide is from 2015, and is probably not updated.

 

If you have your own Python script and you're sure that it is working, you might want to share it with us so we can test it. We can't assure that we will solve the issue but we can definitely try.

Regards,

 

-Pablo
MHawa1
Beginner
132 Views

Hello Pablo,

thank you for the article, but I'm already aware of the issue mentioned in your response. Indeed I worked thru the problem via other comments on that thread. So, I'm not seeing the problem with respect to the python's script because I've modified it locally and overcame the assertion issue. with my changes to the script, I'm able to generate the modified image with the square outline on the faces. All of this took place before I started this discussion thread.

However, the main issue that caused me to start this discussion thread is the fact when I want to see the resulting image by pointing my web browser to Edison's html public directory. My browser can't display the image because the web server on Edison is not serving the HTML page called "OpenCV". For some reason, the web server can't find that html file even though it's located in the public directory. Is there something I can do to determine why the Edison web server encounters an error for invoking any webpage other than the default device page?

(PS: FYI, I've tested the OpenCV.html file on my host computer, windows 10 and the html page worked just fine, where I can see the before and after pictures resulting from python script. So, this is a work around, but it's ugly because I want to use the Edison's web server instead).

idata
Community Manager
132 Views

Hi M.Hawana,

 

 

Can we take a look at your Python script? The one that is already working? We were not able to try the "OpenCV" HTML file given we didn't fix the Python script, however, we didn't try to open any other HTML file so we would like to know what results we get if we try with your script. If we get the same results as you (the web server on Edison not serving any HTML file) we will definitely dig deeper on this issue.

 

 

Regards,

 

-Pablo
idata
Community Manager
132 Views

Hi M.Hawana,

 

 

Did you check our last post? Could you please provide your Python script?

 

 

Regards,

 

-Pablo
MHawa1
Beginner
132 Views

Hello Pablo,

I'm sorry for the delay in my response. I was away from my lab computer for a while.

as you requested, the script used on the site suffers from permission access and a file name extension changes. So, I've provided my changes below.

However, please Keep in mind, the issue that I'm requesting your help with has nothing to do this the script. the real issue is that I can't access any HTML document in the Edison public server directory (from my browser on my host computer, windows 10).

So, to answer your question above, about sharing my script changes, they involve manual changes. I put print message to show you what you have to do. Essentially, you'll need to these steps:

  1. manually copy the image with the faces, and "haarcascade_frontalface_alt.xml" setup file to the web-server directory "/usr/lib/edison_config_tools/public"
  2. change directory and execute the script from there: python FaceDetection_mods.py

as a result, you'll see print messages pointing to what I've explained here. if you've copied the files correctly, there should be no error messages. The out file will be created called "in_facefound.png" (this is an image with red rectangles around faces that have been detected).

So, now that script is completed, you'll end up with two images in web-server public directory "in.jpg" and "in_facefound.png". To see these two images, I should invoke script "OpenCV.html" from my browser on the host. This should enable me to see the images on my host. Hence my problem with the web-server on the Edison. My browser can't see anything in directory "/usr/lib/edison_config_tools/public".

In summary, Please note that I can successfully ssh (using WIFI) to my Edison and can run the above script. But I can't point my browser to the edison to perform basic access of any images or html files.

MHawa1
Beginner
132 Views

Pablo, ...Ooop's I attached the wrong file. Here is the modified python script I referenced in my last reply "FaceDetection_mods.py".

idata
Community Manager
132 Views

Hi Hawana,

 

 

Yes, don't worry about that. I remember that your issue is not with the script but with the Edison server that is not opening any other site besides the Edison information page. Let me give it a try, and I will let you know my results afterwards.

 

 

Regards,

 

-Pablo M.
idata
Community Manager
132 Views

Hi Hawana,

 

 

You have to add the path of the file in the edison-config-server.js file. Open it using vi and add the path in the WHITELIST_PATHS variable as follow:

 

 

var WHITELIST_PATHS = {

 

"/index.html": true,

 

"/": true,

 

"/main.css": true,

 

"/OpenCV.html": true,

 

"/logo-intel.png": true

 

};

 

 

Then save the file and reboot the Edison. It should work now if you try to open this new HTML file from the browser. The file edison-config-server.js is under /usr/lib/edison_config_tools. The OpenCV.html file has to be saved in the public directory.

 

 

Regards,

 

Pablo M.
MHawa1
Beginner
132 Views

Hello Pablo,

Thank you for the helpful feedback. I can see the script OpenCV.html using my browser now !!

However, the pictures that I want to display "in.jpg" and "in_foundface.png" are not displayed. Rather, I see their alternate names "before" and "after" with very small icon. Do you have any suggestions as to why the server is not able to display these images as intended by the above OpenCV.html ?

idata
Community Manager
132 Views

Hi Hawana,

 

 

I'm really happy to know you got it working! Regarding this new issue with the images, are you getting the same result with any other image you try? Have you tried loading an image that's hasn't been processed before with OpenCV, just like loading an image as one would do in a standard HMTL file? Also make sure that you're putting the images in the right directory.

 

 

Regards,

 

-Pablo M.
MHawa1
Beginner
132 Views

Hello Pablo,

I now can see the OpenCv.html performing as expected. I can see the pictures before and after ! Thank you for the help !

The reason it was not showing the pictures before, was that the script was not finding the image files even though they are present in public directory. This was evident when I tried to access the image file directly from my browser, and the browser reported this error:

"The page at /in.jpg was not found."

what I had to do is modify the server script again and give explicit permission for these two pictures by adding them to the white list of files (I don't like this solution, but it's a work around). I added two lines (in bold). Then I was able to see the pictures. Here is the a snippet from file "edison-config-server.js" :

var WHITELIST_PATHS = {

"/index.html": true,

"/": true,

"/main.css": true,

"/OpenCV.html": true,

"/in.jpg": true,

"/in_facefound.png": true,

"/logo-intel.png": true

};

In the process of trying to solve/debug the above problem, I have raised two questions which I hope you can answer:

1) it seems that above fix you provided, will cause me to have to modify server file and reboot system every time I want to see a new picture. This is because I have to add the specific file name to the whitelist above. Is there a way to tell the server to allow image file types instead of allowing specific file names?

2) if the boot flow encountered issues when invoking we server (or any other service for that matter). where are the boot messages? I looked in "/var/log" directory and did not see any log files. Do you know where I should look to determine if there are boot flow error messages that are not printed to the screen ?

idata
Community Manager
132 Views

Hi Hawana,

That's great news! Glad you were able to solve it.

 

Regarding your first question, I would suggest you to try the following (keep in mind I haven't test it myself so it may not work):

 

a. In your whitelist file, add the directory containing all these files instead of the specific file name. If I'm not mistaken the directory is called public.

 

b. You can also try to use *.* to check if it accepts every file name and every file type in that directory.

I'm not sure about your second question, let me investigate a little bit more and I'll get back to you soon.

Regards,

 

Pablo M.

 

idata
Community Manager
24 Views

Hi Hawana,

 

 

I would like to know if you tried my suggestions and if you got better results. Have you been working on this?

 

 

Regards,

 

Pablo M.
Reply