BanNel
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Magic Mirror (Emotion Detection) on Raspberry Pi ![](https://i.imgur.com/q4JTW3H.png) :::info This is a Course Project, which based on IOT Technique. **Course**: Internet of Things Practical (IM5032) **Author**: Pokémon Trainer ::: :::danger **Code**: https://github.com/BanNel/NCUCourse-RaspberryPi/tree/master/IOTProject ⚠️ The code in this project is based on several author. For the detail, please check the references. ::: ## :elephant: Overview It is a Magic Mirror (Emotion Detection), which can detect **user’s emotion** and **give some feedback (Quote)**. ![](https://i.imgur.com/Db9RbbF.jpg) | Usage Example| Usage Example | Usage Example | | -------- | -------- | -------- | | ![](https://i.imgur.com/ytplxi3.gif) |![](https://i.imgur.com/ytplxi3.gif) |![](https://i.imgur.com/ytplxi3.gif) | ## :star2: Motivation **Remember to Smile!** Life is struggle, sometimes we will be sad, angry and will have a bad mood. But if we remember to smile up, the life may be much easier. Do you have the experience that someone told you to smile up? A positive emotion is really important, it's not only affect our feelings but also our health. William James, the noted psychologist and philosopher, believed that smiling has a positive effect on our mind. Richman (2005) examined the relationships between positive emotions and health, he found out that higher levels of positive emotions decreased likelihood of having or developing a disease. Results suggest that positive emotion may play a protective role in the development of disease. Tsujita (2011, **ACM**) proposed a new digital appliance that encourages the act of smiling in our daily lives. [Video](https://dl.acm.org/doi/10.1145/2030112.2030114#) | Tsujita (2011) Device | Tsujita (2011) Usage | | -------- | -------- | | ![](https://i.imgur.com/AlYVgo3.png) | ![](https://i.imgur.com/7cxuV5m.png) | Moore (2017, **ACM**) proposed study aimed at evaluating a bespoke smartphone-based affective technology that attempts to promote happiness through smiling, by reminding participants to smile on a regular basis. | Moore (2017) Research | | -------- | | ![](https://i.imgur.com/czdzR4t.png) | Based on these studies, we can know that smile is very important. So I build up a emotion detection device which can put in any place. For Example, put it in the workplace. When you are working, you may not notice that you have a bad emotion, so the device will remind you, and giving the corresponding quote depending on your emotion. Another example is put it in the restroom, cause we may stay in front of mirror when we are in depression, so the device will encourage you to cheer up! ## :ideograph_advantage: Usage This Project has two part: Screen Side and Control Side. The magic mirror have three kinds of mode, **Real Mirror mode**, **Camera mode** and another is the **Encourage Quote mode**. ### Screen Side | **Real Mirror mode** | **Camera mode** | **Encourage Quote mode** | | -------- | -------- | -------- | | ![](https://i.imgur.com/uWM3Mkx.png) | ![](https://i.imgur.com/eHKIyvy.png) | ![](https://i.imgur.com/u8TcBmo.png)| | Display the black background on screen, to pretend as the mirror. |Show the real time camera on the screen | It can detect user’s emotion and give some encourage quote.| ### Control Side (control by Website) | **Control Running mode** | **Monitor Camera** | | -------- | -------- | | ![](https://i.imgur.com/ULX0Q0P.png)| ![](https://i.imgur.com/lZ0YXGj.png) | | Change the Mode On Screen | Show the real time camera via website | ## :hammer: Dependencies ![](https://i.imgur.com/S2XAZjM.jpg) ### Hardware * Raspberry Pi Model 3B * Wi-Fi * Monitor (Screen) * Intel® Neural Compute Stick 2 (Intel® NCS2) * One Way Vision Glass Sticker (optional) ### Software * Python 3.7 * Open-Vino (4.1.2-openvino) ## :diamond_shape_with_a_dot_inside: Installation ### 1. Prepare the Devices First, you must prepare the following device to start the installation. 1. Raspberry Pi Model 3B 2. Micro SD Card (larger than 16GB) 3. Pi Camera 4. Internet 5. Confidence --- ### 2. Install Raspbian OS and Environment :::warning *If you had install the Raspbian OS and the conda, python environment just skip to the next step.* ::: 1. Download the Raspbian OS from [Raspberrypi](https://www.raspberrypi.org/downloads/raspbian/) 2. Install it ! 3. After OS Installation, check the conda version, python version. It's recommend to install in python 3.7 for this example. --- ### 3. Test Camera :::danger *Turn of the Raspbian Power, before you install the camera on the board (Important)* ::: Once you have the finish the OS installation and the Python Environment, we can test the PiCamera first, to make sure the hardware is working perfectly. 1. ==Turn of the Raspbian Power, before you install the camera on the board (Important)== 2. Install the Camera ![](http://www.dexterindustries.com/wp-content/uploads/2016/03/insert_camera_cable_in_pi.jpg) 3. Power Raspberry Pi! 4. Open terminal and capture the image by camera ```javascript raspistill -o Desktop/image45.jpg ``` 5. If it works fine, than go to next step. --- ### 4. Install Intel® Neural Compute Stick 2 (Intel® NCS2) ![](https://software.intel.com/sites/default/files/managed/9c/6e/ncs2-lid-box.png) Next, we are going to install the NCS2 on Raspberry Pi. 1. Check Full Installation Guide [NCS Stick 安裝](/JHKd2oUUQRu4ut61XfAQZA) --- ### 5. Install OpenVino & Test OpenVino Environment ![](https://miro.medium.com/max/4142/1*h4QNjKbGtTbaQgtM939y4A.png) After Install NCS2 and check NCS2 works fine, next we are going to isntall OpenVino 1. Check Full Installation Guide [IOT Install OPENCV](/VxuNdeIPT_ql6Kr8CY18XQ) --- ### 6. Install Flask 1. Check the website source [The Flask Mega-Tutorial Part I: Hello, World!](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world) --- ### 7. Combine & Run the code 1. FULL Code Check the [Github](https://github.com/BanNel/NCUCourse-RaspberryPi/tree/master/IOTProject) --- ### 8. Place the Glass Sticker (Optional) ![](https://ae01.alicdn.com/kf/HTB1hqyEhVuWBuNjSszbq6AS7FXa2/Two-side-Silver-Mirror-Window-Film-Insulation-Solar-Tint-Stickers-UV-Reflective-One-Way-Privacy-Decoration.jpg_q50.jpg) 1. Place an one Way Vision Glass Sticker on the screen (optional). * When screen turn black, the screen will act as the mirror by the sticker. * When the screen light up, the screen will pass through the sticker and show the Image on the screen. --- ## :+1: Future Study * Combine with Google Assistant, to let the mirror talks intelligently. * It also have a feature to display the video or image remotely. --- ## :confetti_ball: Code Reference :::success Thanks for all the Source, without you I couldn't make it perfect. ::: ### Website Templates * http://www.mashup-template.com/preview.html?template=energy ### Pi Camera on Flask (Real time) * https://www.pyimagesearch.com/2016/01/18/multiple-cameras-with-the-raspberry-pi-and-opencv/ ### Emotion Detection on Raspberry Pi * https://chtseng.wordpress.com/2019/04/13/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%A8%B9%E8%8E%93%E6%B4%BE%EF%BC%8Bncs%E4%BA%8C%E4%BB%A3%E4%BD%BF%E7%94%A8model-zoo%E5%8F%8A%E8%87%AA%E5%B7%B1%E8%A8%93%E7%B7%B4%E7%9A%84%E6%A8%A1%E5%9E%8B/#h2 * https://github.com/PINTO0309/OpenVINO-EmotionRecognition --- ## :cactus: Research Reference * Richman, L. S., Kubzansky, L., Maselko, J., Kawachi, I., Choo, P., & Bauer, M. (2005). Positive emotion and health: going beyond the negative. Health psychology, 24(4), 422. * Tsujita, H., & Rekimoto, J. (2011, September). Smiling makes us happier: enhancing positive mood and communication with smile-encouraging digital appliances. In Proceedings of the 13th international conference on Ubiquitous computing (pp. 1-10). ACM. * Moore, G., Galway, L., & Donnelly, M. (2017, May). Remember to smile: design of a mobile affective technology to help promote individual happiness through smiling. In Proceedings of the 11th EAI International Conference on Pervasive Computing Technologies for Healthcare (pp. 348-354). ACM. --- ## :cactus: Thanks This course is awesome! Thanks for all the one and Remember to Smile! > Nothing you wear is more important than your smile. Connie Stevens ![](https://i.imgur.com/TTEdY4a.jpg) ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully