|
Post by danny072 on Dec 11, 2013 5:31:40 GMT -8
Hi I am a new member so my apologies to all if this is posted in the wrong area.
Okay, my question is pretty simple I am sure but this whole Pi thing is new to me so please bear with me......I have the App working on my Ipad and the Server running on my Pi and everything is good.
What I cant seem to get going is the RemotePictureWebView and I don't even know where to start. Could you email me or post on here a noobs guide to getting this going indicating what code needs to be entered into which file.
Also can you advise how I could use Gertboard/Piface IO and Is there something I could do to send the text string from my Ipad and have it displayed on the Piface Control and Display unit (LCD)?
Sorry one question became many there.....Just a simpe idiots guide to Camera and I/O would be great
Thanks
Dan
|
|
|
Post by SDL on Dec 11, 2013 13:19:19 GMT -8
Hi Dan, Look over on switchdoc.blogspot.com One of our customers has done exactly what you want to do with your PiCamera. The code for the Project Curacao project is on github.com/projectcuracaoCheck out the source code under RasPiConnectServer, specifically in the local directory (the Local.py file in specific). You will find the code to do what you want with the Pi Camera. Here's the snippet: # object Type match if (objectType == PICTURE_REMOTE_WEBVIEW_UITYPE):
if (Config.debug()): print "PICTURE_REMOTE_WEBVIEW_UITYPE of %s found" % objectServerID
#W-15 is latest pi camera picture if (objectServerID == "W-15"):
#check for validate request if (validate == "YES"): outgoingXMLData += Validate.buildValidateResponse("YES") outgoingXMLData += BuildResponse.buildFooter()
return outgoingXMLData
# normal response requested
imageName = "picamera.jpg"
responseData = "<html><head>" responseData += "<title></title><style>body,html,iframe{margin:0;padding:0;}</style>" responseData += "</head>"
responseData += "<body><img src=\"" responseData += Config.localURL() responseData += "static/" responseData += imageName responseData += "\" type=\"jpg\" width=\"585\" height=\"300\">"
responseData +="</body>"
responseData += "</html>"
outgoingXMLData += BuildResponse.buildResponse(responseData)
outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData
And here is the code that generates the picamera.jpg from the ProjectCuracao code files. def takePicture(source): # take picture print "taking picture" output = subprocess.check_output ("raspistill -o /home/pi/RasPiConnectServer/static/picameraraw.jpg -t 0",shell=True, stderr=subprocess.STDOUT ) output = subprocess.check_output("convert '/home/pi/RasPiConnectServer/static/picameraraw.jpg' -pointsize 72 -fill white -gravity SouthWest -annotate +50+100 'ProjectCuracao %[exif:DateTimeOriginal]' '/home/pi/RasPiConnectServer/static/picamera.jpg'", shell=True, stderr=subprocess.STDOUT)
pclogging.log(pclogging.INFO, __name__, source )
print "finished taking picture" return
The first thing you need to with your Gertboard/PiFace IO is to write software on the Pi (I'd use python) and get your text displayed on the LCD. Then it is a pretty simple matter to take text from the Text Control and send it to the gertboard. Read the documentation on the text control and then use the examples in the Execute directory in the RasPiConnect server to see how to receive it. Put all of your code in the Local.py file as described in the documentation. Once you have done one of these, they are all simple. Best regards, BP
|
|
|
Pi Camera
Dec 13, 2013 8:48:17 GMT -8
via mobile
Post by Danny072_1 on Dec 13, 2013 8:48:17 GMT -8
Thats great and most comprehensive.... Thankyou i will give it a shot
|
|
|
Post by Darren on Mar 13, 2014 15:11:40 GMT -8
Also check your config file, I had problems with the pi cam. After I realised I needed my no-IP address in there instead of the local ip, it still didn't work.
I then found I needed thet trailing / on the URL.
So, put the correct (in my case the external) address and the trailing / worked
|
|
grandad
New Member
No Quite So Confused.
Posts: 30
Raspberry Pi: Yes
Other Device: 2nd Pi, PCs, iPad, Android Tablet and many, many gadgets!
|
Post by grandad on Mar 22, 2014 4:11:54 GMT -8
Hi, Thought I would recommend imagemagick as THE tool for overlaying text / logos onto your Raspi Camera snaps I used the convert code in BP's previous post, from Project Curacao to get text / date / time overlayed onto my pictures. The snippet of my Local.py which takes the pic and overlays the text is below. Thanks to Mike (ve7mkf) for the code to actually take the picture. # B-3 Take a photo with the RasPi Camera if (objectServerID == "B-3"):
#check for validate request # validate allows RasPiConnect to verify this object is here if (validate == "YES"): outgoingXMLData += Validate.buildValidateResponse("YES") outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData
# not validate request, so execute
# note that python is in the main directory for this call, not the local directory
with picamera.PiCamera() as camera: camera.resolution = (320, 240) camera.start_preview() time.sleep(2) output = subprocess.call(["aplay", "sounds/shutter.wav"]) camera.capture('static/picamraw.jpg') output = subprocess.call("convert 'static/picamraw.jpg' -pointsize 12 -fill white -gravity SouthWest -annotate +10+5 'RasPiCam %[exif:DateTimeOriginal]' 'static/picam.jpg'", shell=True) responseData = "OK" outgoingXMLData += BuildResponse.buildResponse(responseData) outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData Here is a pic with date / time / text overlayed:-  Martin [edit] DOH! Unfortunately, the convert code line overflows the page. Just scroll it sideways with the mouse. [/edit]
|
|