Avisos
Vaciar todo

camera feed rotation  

  RSS
oufledingue
(@oufledingue)
Active Member
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

Respondido : 22/06/2023 12:09 pm
Tojik
(@tojik)
Miembro Moderator
RE: camera feed rotation

Hi, sorry. I have not worked out rotation yet. It's in the backlig of things to do.

 

Respondido : 22/06/2023 12:20 pm
oufledingue
(@oufledingue)
Active Member
Topic starter answered:
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

Respondido : 22/06/2023 12:30 pm
oufledingue
(@oufledingue)
Active Member
Topic starter answered:
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

 

Respondido : 22/06/2023 3:42 pm
Friedham
(@friedham)
Miembro
RE: camera feed rotation

Would love to see this feature added!

Respondido : 31/10/2023 4:26 am
victor.fehlberg
(@victor-fehlberg)
Miembro
RE: camera feed rotation

I too would like to see this. Thank you!

Respondido : 30/12/2023 5:29 am
Gnilema
(@gnilema)
Miembro
RE: camera feed rotation

That would be a great feature!

Respondido : 20/01/2024 11:15 am
Tojik
(@tojik)
Miembro Moderator
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

Respondido : 26/01/2024 3:38 pm
_KaszpiR_
(@_kaszpir_)
Honorable Member
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.

Respondido : 26/01/2024 10:29 pm
_KaszpiR_
(@_kaszpir_)
Honorable Member
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.

Respondido : 26/01/2024 10:43 pm
Tojik
(@tojik)
Miembro Moderator
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.

Respondido : 06/02/2024 12:47 pm
Rick
 Rick
(@rick-12)
Active Member
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

Respondido : 18/09/2024 2:30 pm
Rick
 Rick
(@rick-12)
Active Member
RE: camera feed rotation

A temporary fix below

  1. ssh into the Raspberry Pi
  2. edit `/home/<user>/.local/lib/python3.11/site-packages/prusa/link/static/main.b3e029296dd89863b3f2.css
  3. look for `.camera__snapshot`
  4. 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.

Respondido : 18/09/2024 3:07 pm
LayerFormed
(@layerformed)
Active Member
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?

Respondido : 19/09/2024 6:28 am
Compartir: