Message Boards Message Boards

GROUPS:

Is the meeting room available right now?

Posted 7 months ago
1480 Views
|
1 Reply
|
9 Total Likes
|

I've tried an idea to check if the meeting room is available right now using Raspberry Pi, Wolfram Language and Apple Watch.

enter image description here

The method is as follows.

  1. Take photos in the meeting room by Raspberry Pi with camera
  2. Check whether the meeting room is available from the photos
  3. Deploy the result with the photo into Wolfram Cloud
  4. Check it with Apple Watch on the arm

enter image description here

WL Codes from 1. to 3. is as follows. Check if some are in the meeting room using CurrentImage[] and FindFaces[].

While[True,
 img = CurrentImage[];
 cnt = Length@FindFaces[img];
 CloudDeploy[
  Grid[{{If[cnt == 0, Style["\[HappySmiley] vacant", Blue, Bold, 96], 
      Style["\[SadSmiley] occupied", Red, Bold, 96]]},
    {Image[img, ImageSize -> Large]}}, Frame -> All],
  "Room", Permissions -> "Public"];
 oldimg = newimg;
 Pause[10];
 ]

The output of CloudDeploy[] is CloudObject with a fixed URL. You can refer to this URL by a browser, but APPLE WATCH does not have any browser app. So, you send the email with this URL in the body of it to your iPhone and you click the URL on the email on your Apple Watch linked to your iPhone. And then you can browse the URL on your Apple Watch.

enter image description here

After checking the above WL codes with WL on my Windows PC, I finally checked them with Raspberry Pi. However, CurrentImage[] and FindFaces[] output error messages and didn't work on my Raspberry Pi(Raspberry Pi:9.11, WL:12.0.1.0).

  • DeviceRead::raspiCamError: Error enabling camera-preview
  • FindFaces::sys: FindFaces is not yet available on Linux-ARM.

So I've made something that would be alternatives to them on Raspberry Pi. The following is alternative to CurrentImage[].

snap[] := Module[{r},
  r = Run["sudo raspistill -n -w 320 -h 240 -o tmp.jpg"];
  If[r == 0, Import["tmp.jpg"], Print["raspistill failed"]]
  ]

The alternative of FindFaces[] is that the existence of people is judged by the difference between the two images. The above WL codes are as follows using these.

oldimg = snap[];
While[True, newimg = snap[];
 dif = ImageDifference[newimg, oldimg];
 CloudDeploy[
  Grid[{{If[(dif // ImageData // Max) > 0.1, 
      Style["\[SadSmiley] occupied", Red, Bold, 96], 
      Style["\[HappySmiley] vacant", Blue, Bold, 96]]}, {Image[newimg,
       ImageSize -> Large]}}, Frame -> All], "Room", 
  Permissions -> "Public"];
 oldimg = newimg;
 Pause[10];
 ]

It is necessary to save the email with the URL of the meeting room as this way. It's smarter to develop an APPLE WATCH app, but unfortunately I don' t have a Mac-PC. And it' s difficult for me to develop an iOS app in my Windows environment. In addition, there are many security issues for practical use.

enter image description here - Congratulations! This post is now featured in our Staff Pick column as distinguished by a badge on your profile of a Featured Contributor! Thank you, keep it coming!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract