1. Got a question or need help troubleshooting? Post to the troubleshooting forum or Search the forums!

Adjust camera angle on R2

Discussion in 'Troubleshooting' started by Redriche, Jul 29, 2017.

  1. Redriche

    Redriche Member

    Joined:
    Jun 7, 2017
    Messages:
    66
    Likes Received:
    16
    Has anyone figured out our is it even possible to adjust the camera angle on the R2? The current view kinda sucks.


    [​IMG]


    Sent from my iPhone using Tapatalk
     
  2. Todd Wessendorf

    Todd Wessendorf Active Member

    Joined:
    Feb 14, 2016
    Messages:
    125
    Likes Received:
    48
    I have noticed that the camera view in OcotPrint using the Robo3d Theme the image is rotated about 15 degrees CCW. By that I mean it looks level. When I turn that theme off and reboot OctoPrint, the Camera View looks like what you are showing above.

    At the very least, there must be a way to have it display rotated slightly within OctoPrint on the camera page.

    T
     
  3. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    I added a camera on the C2 and have noticed as well that there's @Todd Wessendorf 's 15-degree difference between the port 8080 version of the MJPG streamer and the images/videos which are appearing on the OctoPrint screen. Fortunately for me, my mount allows me to twist the camera until I like the results.

    From this page, it looks like -rot is the setting for adjusting the default image rotation. Although it's supposed to accept any angle, they suggest that it only supports 0/90/180/270 since that's all that OctoPrint feels like allowing you to do. From this page, it looks like the config.yaml supports a few things. Unfortunately, she's just not allowing enough control sent to the underlying program.

    Searching the repository for ffmpeg turns up at least this python script...
    https://github.com/foosel/OctoPrint...4/tests/timelapse/test_timelapse_renderjob.py
    ...which possibly could be tweaked to include the -rot setting you'd be interested in. Searching for old/closed issues, nobody's mentioned this before on their repository.

    The OctoPrint -> Settings -> Webcam page has a variety of settings, just not this one. The checkboxes at the bottom translate into the orthogonal numbers listed above.

    I suppose if you wanted a real ugly hack, you could go to that /usr/bin/avconv folder, rename ffmpeg to ffmpeg-original and then create a shell script called ffmpeg which calls the original and adds the magic rotation argument. o_O (Or just hold your head like this to view the photos.)

    I will add to this that some have complained of wonky videos when rotation is turned on.
     
  4. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,422
    Likes Received:
    7,299
    weird. I did nothing special to add my camera to the Pi and Octoprint does not appear to have rotated it any.
     
  5. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    Are you using the Robo theme? That's what's rotating the image in the Octoprint view, which is why you don't have the same angle when viewing the raw stream.
     
  6. Redriche

    Redriche Member

    Joined:
    Jun 7, 2017
    Messages:
    66
    Likes Received:
    16
    You can change the theme in the app?


    Sent from my iPhone using Tapatalk
     
  7. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    You can remove the theme in OctoPrint Settings >> Plugin Manager, there are very few themes to replace it with, not much theme development in the OctoPrint community. You will go back to the standard OctoPrint interface if you remove the Robo theme.
     
    #7 WheresWaldo, Aug 3, 2017
    Last edited: Aug 3, 2017
  8. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    You can't apply the theme to the app, no. But you can open the standard page in your mobile's browser.
     
  9. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,422
    Likes Received:
    7,299
    Yep, I am indeed using the Robo theme.
     
  10. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Same here (I'm using the Robo theme).
     
  11. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    I know everyone now sees that the image is rotated in the robotheme. Here is the actual code used, it is in main.css
    Code:
    #webcam_image {
        position: relative;
        top: -54px;
        left: -47px;
        -ms-transform: rotate(-10deg);
        -webkit-transform: rotate(-10deg);
        transform: rotate(-10deg);
    }
    I am not a web programmer so I have only cursory knowledge of cascading style sheets, but it would appear that it is only the display of the webcam image is rotated and not the actual feed. That would lead me to think that timelapse videos would NOT be rotated.
     
    OutsourcedGuru likes this.
  12. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Sweet jebus, there it is. Well done. You're absolutely correct on the timelapse not following this. I never would have guessed they'd do this in CSS, of all things. No wonder.

    Could possibly be called a clever hack if they actually knew about the ffmpeg bug in -rot.
     
  13. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Please note that this causes your browser, which likely runs very much faster than the rPi to do the actual rotation. Regardless of bug or no, the rPi is already taxed just running the interface as well as OctoPrint and all the plugins.
     
  14. Geof

    Geof Volunteer Moderator
    Staff Member

    Joined:
    Nov 9, 2015
    Messages:
    6,728
    Likes Received:
    2,328
    Robo octo doesn't have a rotate option on the cam? My type a does ? (running octo with Type A theme) Screen shots attached. Dont know if it will help ? Screenshot (18).png Screenshot (19).png Screenshot (20).png
     
  15. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    @Geof, without seeing their skin source it would be hard to tell if they are rotating the source or rotating the display of the images. Robo chose to rotate the display. Doing it this way puts all the processing necessary on the browser and not the rPi, but I believe the TypeAMachines Seris 1 uses a BeagleBonesBlack instead of a RaspberryPi.
     
  16. Geof

    Geof Volunteer Moderator
    Staff Member

    Joined:
    Nov 9, 2015
    Messages:
    6,728
    Likes Received:
    2,328
    Ah gotya. Will look to see if they keep a Repo and send to you but I do think your right, it may not be a RPI, I will have to pull the cover off Monday when the print finishes and take a peek
     
  17. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Interesting plot twist... just went into my C2 and the rotation CSS isn't in the main.css file... at the top. And yet, it's seen at the bottom of the stylesheet in the @media section labeled:

    E. Between 980px and 1199px

    So this means that *sometimes* it will be rotated and sometimes it won't. :laugh: If you resize your OctoPrint browser window, it might start rotating that 10%. Resize it slightly back and it ought to go back (at least, in theory from what I see here).

    For my C2 manual upgrade, I've commented out each rotation in the CSS. Problem solved.
     

Share This Page