Has anyone tried changing the size of the images that are processed?
I'm guessing that changing these two variables in settings.py should be the only thing needed, but I've only tried it in the simulator and it produced some strange results. It swerves all over the place. I've attached an example.
imageWidth = 160 # Camera image width imageHeight = 120 # Camera image height
Anyone have any suggestions/tips they'd be willing to share?
Images:
There is another value you will need to change as well:
Put simply
trackSepX
is the approximate width of a single lane in pixels. This is used to figure out how far the robot is from the centre of the track. As this will likely be too small for a larger image the robot thinks it is further away than it is, causing the excessive steering corrections.In most cases you should be able to scale the existing number by the ratio between the new and old image widths. For example if changing to a resolution of 320 x 240:
If you change the aspect ratio you may need to actually measure the width of the lanes in pixels at the relevant position in the image to get an accurate figure. In this case the simulator will likely not be representative of the Pi Camera.
On a side note if you are changing the camera resolution or frame rate be sure to check the supported modes from the Pi Camera V2 (see here). The camera seems to favour lower # modes in the chart as long as they match in aspect ratio and frame rate (not exceeding the resolution), the hardware / firmware / driver does the down-scaling to the exact resolution for you. In particular if the aspect ratio and frame rate you ask for results in a partial FoV you will get a very zoomed in image!
For reference the standard settings use mode #4:
Add new comment