Search code examples
pythonraspberry-pipicamera

Is there a way to use ROI (Region of Interest) through a Rapsberry Pi in Code?


I'm looking to take images using my raspberry pi v2 camera module and extract a specific part of those using ROI.

-roi 0.5,0.5,0.25,0.25  

However, ROI seems to only be a flag for taking still images through the command line, is there any way to use ROI with the 'camera' module in code?.

such as...

camera.resolution = (2592, 1944)
camera.framerate = 15
#does this next line exist somewhere?
camera.roi = (0.5,0.5,0.25,0.25)

Any help would be much appreciated!


Solution

  • I found the PIL Library has a function .crop() that did exactly what I needed. Link here PIL Link