RPi_Cam_Web_Interface icon indicating copy to clipboard operation
RPi_Cam_Web_Interface copied to clipboard

Only see part of image in preview with camera module V2

Open tom-2015 opened this issue 7 years ago • 17 comments

I'm using the new V2 camera module but in the preview I can only see the left upper part of the total image the camera is capturing. When I take a picture it does record the full image.

It's like the preview picture is only capturing the old 5MP resolution, how can I adjust this?

tom-2015 avatar Jul 17 '17 10:07 tom-2015

That is strange as others use v2 OK.

The preview image is derived from the video format.

First try browsing to http://cameraip/folder/cam_pic.php where you need to replace the cameraip and folder if used. This should give you one snapshot of the images used to produce the preview stream. Does that look OK or is it cut off as well?

Try also changing the video format under camera settings.

If you have done any custom settings then please upload content of uConfig file in the web folder so I can check that out.

roberttidey avatar Jul 17 '17 11:07 roberttidey

Changing the video resolution solved the problem but FPS is really low now, should have taken a v1 camera :(

tom-2015 avatar Jul 17 '17 16:07 tom-2015

That still doesn't sound right. V2 should give same performance as V1.

Do you mean fps on the preview or fps on the actual video recording?

The preview fps should be the video recording fps divider by the preview 'divider' setting. This defaults to 1 so a 25fps video rate should give a 25 fps preview. Bandwidth can become an issue if using a wireless connection. You can check the fps on preview by turning on developer tools in the browser and leaving the preview at the default setting as each preview frame is then fetched separately and you can see those requests being handled on the network tab.

roberttidey avatar Jul 17 '17 21:07 roberttidey

No it was the preview window but today it is working fine, maybe it was because of the F12 debug/network window in Firefox was open yesterday. I'll see if it happens again coming days.

Thanks for the help anyway.

tom-2015 avatar Jul 18 '17 18:07 tom-2015

Same issue here on a Raspberry Pi 3, Camera V1.3, running on Raspbian Stretch: Only the upper left corner of the stream is visible. Also on a recording and on browsing to cam_pic.php.

Changing the resolution does not fix it.

width 512 quality 10 divider 1

video_width 1920 video_height 1080 video_fps 25 video_bitrate 17000000 video_buffer 0

h264_buffer_size 131072 h264_buffers 0 video_split 0

MP4Box background MP4Box_fps 25 MP4Box_cmd (set -e;MP4Box -fps %i -add %s %s > /dev/null 2>&1;rm "%s";) &

image_width 2592 image_height 1944 image_quality 10

mfr69bs avatar Dec 27 '17 23:12 mfr69bs

Check camera connections are secure at both the Pi and camera ends and press down on the flat end of the small ribbon cable on the camera itself.

Check whether raspivid captures the whole frame normally.

roberttidey avatar Dec 28 '17 09:12 roberttidey

You need to change the resolution in the RPi Cam Control web interface not in /boot/config.txt Click the camera settings button and enter video / picture resolution 3280x2464

tom-2015 avatar Dec 28 '17 09:12 tom-2015

@roberttidey

Check camera connections are secure at both the Pi and camera ends and press down on the flat end of the small ribbon cable on the camera itself.

That was the trick. THX!

@tom-2015

I did not write anything about /boot/config.txt. So please do not just write something about it.

There is also something below the "surface" (RPi Cam Control web interface) for raspimjpeg. So called configuration files ;-)

mfr69bs avatar Dec 28 '17 11:12 mfr69bs

RPi Cam Control v6.4.31 Cam module v2

Video Res = 1920x1080 Image Res = 1920x1080

Expected output: Preview shows the same FOV as the captured image

Observed output: Preview shows significantly smaller FOV as the captured image

grafik

Solution: Set Video Res to 1640x922 -> preview shows the same viewing angles (horizontal + vertical) as the captured image

tmo26 avatar Oct 27 '18 09:10 tmo26

Yes. This is due to the way the GPU handles the FOV.

The preview is based on the video resolution. The 1920 x 1080 selects 1920 x 1080 pixels from the camera to process. The still image capture takes a larger region and then scales it down to fit the 1920 x 1080 frame

roberttidey avatar Oct 27 '18 10:10 roberttidey

Apologies Sorry to resurrect an old issue, but I've been playing with the software today to use as the stream for 3d printer recording, and the issue with the above comment is that 720p (16:9) does not have the same issue as the 1080p. While 1080p corps the image as show above, 720p does not, so it is not due to the aspect ratio, or number of pixels selected (you would expect 720p to select an even smaller FOV based on that argument)

The way I got around this was by setting the video capture to 1440x1080 only then do i get something that can be cropped to 1080p

andyryan avatar Apr 28 '20 11:04 andyryan

When I select the HD Ready 720p preset (1280 x 720) then I get exactly the same FOV preview as when I select Full HD (1920 x 1080). This is what I would expect as the aspect ratio is selecting the portion of the camera sensor that can be used to give that aspect ratio. The sensor is intrinsically 4:3 so only video formats with that aspect ratio will show the full sensor FOV.

roberttidey avatar Apr 28 '20 12:04 roberttidey

1440x1080Capture 720pCapture 1080pCapture

Above are three images that I hope better illustrate the issue. The top most is 1440x1080 (a 4:3 ratio). As expected you get the fill field of view of the camera

The second is 720p (16:9) As expected, you get the full horizontal FOV, but the top and bottom portion of the images are cropped out.

The third is 1080p. You would expect the same FOV as 720p, with a higher pixel count. However the FOV is also reduced in the horizontal direction.

Note: this is only happening for video. It does not occur when setting the image resolution to 1920x1080.

Edit: To clarify, it occurs in both the preview and the captured video

andyryan avatar Apr 28 '20 18:04 andyryan

Under further investigation

roberttidey avatar Apr 28 '20 21:04 roberttidey

OK. Check out https://picamera.readthedocs.io/en/release-1.12/fov.html for an explanation of the FOV for different modes

roberttidey avatar Apr 28 '20 21:04 roberttidey

Colour me corrected. That is the strangest way of a camera handing resolutions I've ever seen.

andyryan avatar Apr 29 '20 10:04 andyryan

It is all to do with only dealing with integer pixels and not interpolating which would be very processor intensive. So with 1280 width it is possible to bin (add two pixels together) and get the nearly the whole FOV. With 1920 x 1080p that is not possible so they revert using single pixels and cropping from the centre.

As you can see the effects are different between V1 and V2 camera which have different pixel counts.

So for 16:9 capture with V1 then HD Ready gives nearly the best FOV. For V2 you can go to 1640 x 922.

If you are using v2 then you can use the uPresets.html to load in a different sets of preset resolutions for convenience. Look at the example uPresetsP-IMX219.html. If the option data in this is put into a uPrests.html file then this will load and set new presets.

roberttidey avatar Apr 29 '20 11:04 roberttidey