camera feed rotation
hello !
i just got a C920 Camera i want to install in my prusa enclosure
but i want to install it vertically
how i can rotate the video feed ?
regards
Oren
RE: camera feed rotation
Hi, sorry. I have not worked out rotation yet. It's in the backlig of things to do.
RE: camera feed rotation
okay thanks 🙂 will follow this
and as a feedback, everything runs really smoothly for me with the last version
i tried a pi camera 2.1 connected with my pi zero 2W through RPi Port
and i am working with the C920, works also like a charm
next step, have both camera working to have the view of the nozzle with the pi cam and the global view with the c920 attached to my enclosure 🙂
and last but not least equip my enclosure with some leds to get better light
RE: camera feed rotation
i spoke a bit too quickly
my c920 stopped working with the RPI Zero plugged on the RPI port and each time i am plugging it in, i have a short circuit. must look into this
RE: camera feed rotation
Would love to see this feature added!
RE: camera feed rotation
I too would like to see this. Thank you!
RE: camera feed rotation
That would be a great feature!
RE: camera feed rotation
Hi, sorry, seems like this will take a while to do. Rotating a jpeg actually takes a lot of processing power (in terms of RasPi Zero), so one would have to do that in javascript on the user side. coordinating that will take longer, especially with other stuff taking priority, sorry
RE:
some cameras expose controls such as rotate or hflip/vflip
if run
v4l2-ctrl -d /dev/device-name --all
and it shows 'rotate' in the list in the section User Control, then you should be able to do
v4l2-ctrl -d /dev/device-name --set-ctrl=rotate=90
prior prusalink start to rotate image 90 degrees, which would be done on device and would not need any additional processing.
See my GitHub and printables.com for some 3d stuff that you may like.
RE:
if camera does not support rotation then I guess the fastest would be using ffmpeg transpose (for example '-vf "transpose=1"') - as spawning subprocess with lowest io/lowest cpu priority (AFAIR default for ffmpeg)
See
https://ffmpeg.org/ffmpeg-filters.html#transpose
https://www.baeldung.com/linux/ffmpeg-rotate-video
See my GitHub and printables.com for some 3d stuff that you may like.
RE: camera feed rotation
Yep, I could do this for the select few v4l2 cameras, but then some peeps would have the menu and some not, so that won't fly and doing it for every camera is not in the cards right now. So please anyone that can, feel free to use the v4l2 trick for now :/
Rotating YUYV pixel maps using numpy sounds like not fun, again, i'm not going to get time to play around with cameras, i'm pretty sure so please hack away. I am open to pull requests that do this tho, it just needs to work for every camera and it needs to be fast potentially disabled for (is_potato_cpu) hosts.
RE: camera feed rotation
Hi,
A simpler solution is to rotate the image in the browser. On the dashboard screen the image HTML tag has a
class="camera_snapshot"
attribute, if you update the CSS style to include
transform: rotate(180deg)
the browser will flip the image right side up.
Can Prusa add a dropdown (90,180,270) that will allow the appropriate transform to be applied client side to the image?
Thanks
RE: camera feed rotation
A temporary fix below
- ssh into the Raspberry Pi
- edit `/home/<user>/.local/lib/python3.11/site-packages/prusa/link/static/main.b3e029296dd89863b3f2.css
- look for `.camera__snapshot`
- update `camera__snapshot{cursor:pointer}` to `camera__snapshot{cursor:pointer;transform:rotate(180deg);`
<user> would be the user you setup for SSH when you flashed the image.
FYI the rotation degrees are dependent on your camera orientation. Mine is upside down therefor I need to rotate 180 degrees.
RE: camera feed rotation
Thanks for suggestions. I'm using RPi camera with Zero2 on MK3 running PrusaLink 0.81 I tested using
update `camera__snapshot{cursor:pointer}` to `camera__snapshot{cursor:pointer;transform:rotate(180deg);`
Sadly the image is still upside down. Thoughts?