CharlyDelta
Posts: 128
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal
Contact: Facebook

Re: RPi Cam Web Interface

Thu Jan 16, 2020 12:17 pm

I based it on your code. That's the fun part. Thank you for the push that got me here!

Found it with

Code: Select all

annotate.write ('Obj = {}'.format (sensor.get_obj_temp()))
Have a good day, ras07 !

awezm
Posts: 5
Joined: Fri Jul 26, 2019 11:28 pm

Re: RPi Cam Web Interface

Sun Jan 19, 2020 12:23 pm

Hello,

How can I redirect the video output and the entire web interface to my custom website url instead of it being on http://ipAddress:port/subfolder?

ras07
Posts: 76
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Sun Jan 19, 2020 11:13 pm

awezm wrote:
Sun Jan 19, 2020 12:23 pm
How can I redirect the video output and the entire web interface to my custom website url instead of it being on http://ipAddress:port/subfolder?
That's a DNS and routing issue, and it's quite a bit beyond the scope of this forum/topic. But if you're trying to make it accessible to the outside world you should know that RPi-CWI isn't intended to be secure, and exposing it to the world is a really bad idea without a thorough understainging of the security considerations. In addition it can use some major bandwidth; unless you have a commercial internet feed, your upstream bandwidth likely isn't sufficient.

Unless you really know what you're doing, you shouldn't try to do this.

ras

Bagmulgwan
Posts: 19
Joined: Sun Apr 14, 2013 8:11 am

Re: RPi Cam Web Interface

Mon Jan 20, 2020 4:19 pm

I just got a surveillance camera working with the motion package. It's neat, but continuous surveillance is not really what I want to do with the camera. It's just that everything about this – to my mind, rather complex – project was easy to find and set up, because there are tons of examples on the web.

What I really want is simply a remote camera that I can use to check the state (open/closed) of a garage door somewhere close – but not visible from a window, say. There is no need for motion detection. I just want a button in a browser window that I can click and see whether the door is open or closed. Simple, right? Would anyone here know of such a project – that would help me get started, at least? Thank you in advance!

ras07
Posts: 76
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Tue Jan 21, 2020 4:15 am

Bagmulgwan wrote:
Mon Jan 20, 2020 4:19 pm
What I really want is simply a remote camera that I can use to check the state (open/closed) of a garage door somewhere close – but not visible from a window, say. There is no need for motion detection. I just want a button in a browser window that I can click and see whether the door is open or closed. Simple, right? Would anyone here know of such a project – that would help me get started, at least? Thank you in advance!
RPi Cam Web Interface would work fine for this and is easier to set up than Motion. Note that it doesn't work with USB cameras, however, in case that's what you already have.

Bagmulgwan
Posts: 19
Joined: Sun Apr 14, 2013 8:11 am

Re: RPi Cam Web Interface

Tue Jan 21, 2020 7:20 am

ras07 wrote:
Tue Jan 21, 2020 4:15 am
RPi Cam Web Interface would work fine for this and is easier to set up than Motion. Note that it doesn't work with USB cameras, however, in case that's what you already have.
Thank you, but Motion was, in fact, so easy to set up in maybe half an hour that it really was no problem at all. The problem was its complexity, and RPi Cam Web Interface seems just about as complex. I don't want a package that can do 15-20 things; I just want a simple application that lets me check the garage door's state (open/closed) remotely when I want. (In my experience, the more complex an application, the more liable it is to break.)

The "simple application" would be something like this: A button on a web page. When clicked, it runs raspistill, say, and takes one photo. And then shows the photo on the remote screen.

That's all. I can do it now by ssh'ing to the remote RPi, running raspistill once, scp'ing the jpg to my PC and then viewing the image locally. But clicking the button on the web page would be faster.

Bagmulgwan
Posts: 19
Joined: Sun Apr 14, 2013 8:11 am

Re: RPi Cam Web Interface

Tue Jan 21, 2020 5:06 pm

Bagmulgwan wrote:
Tue Jan 21, 2020 7:20 am
The "simple application" would be something like this: A button on a web page. When clicked, it runs raspistill, say, and takes one photo. And then shows the photo on the remote screen.

That's all. I can do it now by ssh'ing to the remote RPi, running raspistill once, scp'ing the jpg to my PC and then viewing the image locally. But clicking the button on the web page would be faster.
Finally thought of a faster way: ssh to the remote camera with the -X argument. Run raspistill. Then run links2 on the jpg file. The image appears on my local screen. Done.

Maybe this is fast enough for my modest purpose. No need for a web server on the Raspi, say.

RidleyNelson17
Posts: 1
Joined: Fri Feb 22, 2019 8:48 pm
Location: Minnesota, US, Earth
Contact: Twitter

Re: RPi Cam Web Interface

Thu Feb 13, 2020 1:34 am

Is there any way someone could possibly post a bithub link or any link to that matter to an .img file containing the latest build?

precaash
Posts: 2
Joined: Fri Feb 14, 2020 12:04 pm

Re: RPi Cam Web Interface

Fri Feb 14, 2020 12:17 pm

Hey guys,

I wrote a python script that sends an 'im' command to FIFO when a certain GPIO pin receives a signal and it works.
However I want that the pictures that are taken that way have a different file name: e.g. from "im_0030_20200214_105335.jpg" to "trig_0030_20200214_105335.jpg".

As a first step I want to permanently change the saved file name. I read that I would need to configure the raspimjpeg file (there are two: /etc/raspimjpeg and /var/www/html/raspimjpeg) so I change it with the following command:

Code: Select all

 sudo sed -i 's,image_path /var/www/html/media/im_%i_%Y%M%D_%h%m%s.jpg,image_path /var/www/html/media/trig_%i_%Y%M%D_%h%m%s.jpg,g' raspimjpeg
(Yes, I changed both)
It changes the file content, but once I take a picture the filename still remains as ""im_0030_20200214_105335.jpg"

It feels to me like the changes are not applied. How should I proceed?

Thank you in advance! This forum has already proven helpful to me numerous times! :D

ras07
Posts: 76
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Fri Feb 14, 2020 7:39 pm

precaash wrote:
Fri Feb 14, 2020 12:17 pm
I wrote a python script that sends an 'im' command to FIFO when a certain GPIO pin receives a signal and it works.
However I want that the pictures that are taken that way have a different file name: e.g. from "im_0030_20200214_105335.jpg" to "trig_0030_20200214_105335.jpg".

As a first step I want to permanently change the saved file name. I read that I would need to configure the raspimjpeg file (there are two: /etc/raspimjpeg and /var/www/html/raspimjpeg) so I change it with the following command:

Code: Select all

 sudo sed -i 's,image_path /var/www/html/media/im_%i_%Y%M%D_%h%m%s.jpg,image_path /var/www/html/media/trig_%i_%Y%M%D_%h%m%s.jpg,g' raspimjpeg
(Yes, I changed both)
It changes the file content, but once I take a picture the filename still remains as ""im_0030_20200214_105335.jpg"

It feels to me like the changes are not applied. How should I proceed?
I'm not positive, but I'd imagine you'd have to restart the camera to reread the configuration file. This will probably cause timing and other issues, and is generally heavy-handed in a way that may not suit your needs.

I'd recommend a different approach: leave the raspimjpeg file alone, and instead set some kind of flag (could be a temporary file somewhere) in your python script. Then edit (or create) the end_img.sh script in the macros directory to rename the file after it's captured (the script gets the file name on the command line, so you'll need to parse that to figure out what to change). Then clear the flag (erase the temp file or whatever).

Incidentally, two things to note regarding your first solution - the first is that /var/www/html/raspimjpeg is just a symlink to /etc/raspimjpeg, so you wouldn't need to edit both; they are the same file. The second is that settings in uconfig will override settings in raspimjpeg, so could just make the setting changes there rather than mess with raspimjpeg (and that would generally be better). My guess is you would still have to restart the camera though - I think my suggestion would be preferable.

User avatar
Amarand
Posts: 13
Joined: Tue Apr 28, 2015 7:32 pm
Location: Galloway, OH, USA
Contact: Website Yahoo Messenger Facebook YouTube

Re: RPi Cam Web Interface

Mon Feb 17, 2020 4:38 pm

I did a search in this topic for the word "focus" and didn't find anyone asking this question....

I've been successfully using the ArduCAM drop-in programmable focus camera with RPi Cam Control for a few weeks now. Works great.

The focus control all goes through the same ribbon cable, which is nice. I guess other versions have you connect the focus control to the GPIO?

Because only one program can be talking to the camera at once (apparently), I need to "Stop Camera" and then run the Python tools to adjust focus, then "Start Camera" again once the focus is right.

What I'd love to see is a focus control built into the RPi Cam Web Interface, so I can do the focus and preview right in the same app.

Is that something that could eventually happen?

precaash
Posts: 2
Joined: Fri Feb 14, 2020 12:04 pm

Re: RPi Cam Web Interface

Thu Feb 20, 2020 8:48 am

ras07 wrote:
Fri Feb 14, 2020 7:39 pm
precaash wrote:
Fri Feb 14, 2020 12:17 pm
I wrote a python script that sends an 'im' command to FIFO when a certain GPIO pin receives a signal and it works.
However I want that the pictures that are taken that way have a different file name: e.g. from "im_0030_20200214_105335.jpg" to "trig_0030_20200214_105335.jpg".

As a first step I want to permanently change the saved file name. I read that I would need to configure the raspimjpeg file (there are two: /etc/raspimjpeg and /var/www/html/raspimjpeg) so I change it with the following command:

Code: Select all

 sudo sed -i 's,image_path /var/www/html/media/im_%i_%Y%M%D_%h%m%s.jpg,image_path /var/www/html/media/trig_%i_%Y%M%D_%h%m%s.jpg,g' raspimjpeg
(Yes, I changed both)
It changes the file content, but once I take a picture the filename still remains as ""im_0030_20200214_105335.jpg"

It feels to me like the changes are not applied. How should I proceed?
I'm not positive, but I'd imagine you'd have to restart the camera to reread the configuration file. This will probably cause timing and other issues, and is generally heavy-handed in a way that may not suit your needs.

I'd recommend a different approach: leave the raspimjpeg file alone, and instead set some kind of flag (could be a temporary file somewhere) in your python script. Then edit (or create) the end_img.sh script in the macros directory to rename the file after it's captured (the script gets the file name on the command line, so you'll need to parse that to figure out what to change). Then clear the flag (erase the temp file or whatever).

Incidentally, two things to note regarding your first solution - the first is that /var/www/html/raspimjpeg is just a symlink to /etc/raspimjpeg, so you wouldn't need to edit both; they are the same file. The second is that settings in uconfig will override settings in raspimjpeg, so could just make the setting changes there rather than mess with raspimjpeg (and that would generally be better). My guess is you would still have to restart the camera though - I think my suggestion would be preferable.
Thank you very much for your suggestion! I will try it out today and let you know if it works.
EDIT:

So this is what I did:
I created two shell scripts in the macros folder, which take the two latest files of the media folder and change the prefix. (Two latest because of the thumbnail file)

It actually works fairly well, even combined with my GPIO-trigger python script. BUT sometimes it doesn't change the name (sometimes it just remains as im_.....).

I'm puzzled as to why this is happening. It happens randomly inbetween, but also the file name of the last taken image is not changed.

Any suggestion why? I'm renaming it using:

Code: Select all

cd /var/www/html/media

LATEST=$(ls -t | head -2)
sudo rename 's/^im/trig1/' $LATEST
And tbh, I haven't quite understood what you meant by creating this temporary file. What purpose does it have? Thank you in advance!

ras07
Posts: 76
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Thu Feb 20, 2020 6:56 pm

precaash wrote:
Thu Feb 20, 2020 8:48 am
I created two shell scripts in the macros folder, which take the two latest files of the media folder and change the prefix. (Two latest because of the thumbnail file)

It actually works fairly well, even combined with my GPIO-trigger python script. BUT sometimes it doesn't change the name (sometimes it just remains as im_.....).

I'm puzzled as to why this is happening. It happens randomly inbetween, but also the file name of the last taken image is not changed.

Any suggestion why? I'm renaming it using:

Code: Select all

cd /var/www/html/media

LATEST=$(ls -t | head -2)
sudo rename 's/^im/trig1/' $LATEST
And tbh, I haven't quite understood what you meant by creating this temporary file. What purpose does it have? Thank you in advance!
I'm not sure what your code is doing ... is rename a script you wrote? It's not a Linux command ... In any case, if you're trying to do all that from your Python trigger script, you might have timing issues - the image file may or may not exist by the time you try to rename it.

All I meant with the temporary file is to use it as a flag to indicate that the image was initiated from your GPIO trigger, as opposed to some other means (motion detection or manually through the UI). Then use the built-in scripting facility in RPI-CWI to do the rest.

In your Python script, create the temp file with something like:

Code: Select all

f = open("/var/www/html/media/triggerFlag","w+")
f.close
(Execute this before sending the im command to the FIFO queue)

Then edit (or create) the end_img.sh script in the macros directory as follows:

Code: Select all

#!/bin/bash
if [ -f "/var/www/html/media/triggerFlag" ]; then
        mv $1 ${1/im_/trig_}
        mv $1.*.th.jpg ${1/im_/trig_}.th.jpg
        rm /var/www/html/media/triggerFlag
fi
The name of the image file gets sent to end_img.sh as command line parameter $1 so it makes it easy to manipulate. If
/var/www/html/media/triggerFlag doesn't exist, then nothing gets renamed.

(Note that this code doesn't quite preserve the original thumbnail file name format; im_0001_20200102_123456.jpg.i0001.th.jpg is going to get renamed to trig_0001_20200102_123456.jpg.th.jpg ... if you care about this you'll need to do a bit more parsing of the file name in the second mv command.)

Aquakitty
Posts: 2
Joined: Thu Feb 13, 2020 4:38 am

Re: RPi Cam Web Interface

Fri Feb 21, 2020 7:14 pm

Hi guys,
I am using RPi_Cam_Web_Interface on a Raspberry Pi Zero W with an authentic Raspberry Pi v2 camera. My problem is I thought the streaming images would be a little bit better quality. I am not sure if this is related, but I am also getting a problem where the camera freezes and I get an mmal: mmal_vc_component_enable: failed to enable component: ENOSPC error, but this only seems to be happening when it is cold, in mornings and evenings to make things even more confusing.

So my questions are two fold:
1) Does this streaming quality (I manually took a still) look normal? To me it looks barely better than a 1.3 mega pixel camera on old flip phones! Changing the resolution to 1080p makes no difference to the pixelization
2) If this is not normal could I possibly have a faulty camera?
I am pretty sure this is just not designed for what I want and am expecting too much, seems like it would be better just for basic surveillance or close ups.

Image
Enlarged

Image
Small

ras07
Posts: 76
Joined: Tue May 22, 2018 4:04 am

Re: RPi Cam Web Interface

Sat Feb 22, 2020 3:41 am

Aquakitty wrote:
Fri Feb 21, 2020 7:14 pm
My problem is I thought the streaming images would be a little bit better quality. I am not sure if this is related, but I am also getting a problem where the camera freezes and I get an mmal: mmal_vc_component_enable: failed to enable component: ENOSPC error
Keep in mind that while camera will take stills at 8 megapixels, it will only shoot video at a max of 1080p (which is about 2MP). That said, I agree that the picture you posted doesn't look very good. To me it actually looks out of focus.

The lens on the Pi camera is threaded, and you can focus it by screwing it in and out. One of mine actually came with a little knob (and no instructions) that I eventually discovered fits over the lens to turn it to focus. But you can also do it with a pair of tweezers if you're careful. Sometimes they have a small dab of thread lock that you have to gently break loose before it will turn. I'd give this a try; it's possible that yours is just out of focus.

The freezing is probably unrelated. Here are a few things to try:

1. Make sure the ribbon cable (both ends) is clean, seats well, and the connectors are locked.
2. Make sure the camera is enabled in raspi_config (although it wasn't, the error woudln't be sporadic, it would be all the time).
3. Try increasing the GPU memory split (also in raspi_config) to 144.

I just started having a similar issue with one of my Zero W's. Mine's outside as well, and it seems like it may be related to cold and damp weather. If I come to any resolution I'll post back.

CharlyDelta
Posts: 128
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal
Contact: Facebook

Re: RPi Cam Web Interface

Sat Feb 22, 2020 4:19 pm

[Image][/url]

This is what I get with a V2 NoIr camera on a Zero W card. I actually adjusted the focus and this is the best I get. I also have the same camera in a nesting box and I let it work all winter long even in very cold weather (-30) without any problem.
I bought several V2 cameras and often it comes with a little gizmo to adjust the focus.

Image

Return to “Camera board”