6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: New 8MP Camera - Q&A thread

Mon Sep 12, 2016 9:54 am

thanasispap wrote:Hi,

I want to ask whats the process for upscaling/downscaling to the required resolution (binning I suppose but 2x2 or what?).
I have noticed that when I change resolution to 640x480 the full FoV remains.

I read the docs, but my questions still remains...
(http://picamera.readthedocs.io/en/relea ... mera-modes)
The end of section 6.1 actually covers this, but never mind.

The algorithm is not infallible, but scores each sensor mode against the requested mode, with the main criteria being:
- Must be able to provide the requested frame rate if at all possible.
- The sensor mode flags must allow the requested mode type. This is why the full res mode is always selected for stills captures, as that is the only mode that has the still mode flag set.
- Diff between requested width and height against the sensor mode width and height. Score against the mode if it needs to scale the sensor image upwards.
- Diff in the requested mode aspect ratio vs the sensor mode aspect ratio.

You don't give full details, but I'm assuming you've not changed the default frame rate so it'll either be a fixed 30fps, or a variable 1-30fps (used for stills modes). That eliminates modes 6&7 as they have a frame rate range of 40-90 (or possibly 120) fps.
Scoring on aspect ratio will give modes 1&5 a lower score as they are 16:9.
Scoring on resolution will therefore choose mode 4 at 1640x1232 as being closest to 640x480 without upscaling.
Mode 4 has a full FOV, so that is what you see.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

thanasispap
Posts: 14
Joined: Thu Jul 28, 2016 2:59 pm

Re: New 8MP Camera - Q&A thread

Mon Sep 12, 2016 10:41 am

The end of section 6.1 actually covers this, but never mind.

The algorithm is not infallible, but scores each sensor mode against the requested mode, with the main criteria being:
- Must be able to provide the requested frame rate if at all possible.
- The sensor mode flags must allow the requested mode type. This is why the full res mode is always selected for stills captures, as that is the only mode that has the still mode flag set.
- Diff between requested width and height against the sensor mode width and height. Score against the mode if it needs to scale the sensor image upwards.
- Diff in the requested mode aspect ratio vs the sensor mode aspect ratio.

You don't give full details, but I'm assuming you've not changed the default frame rate so it'll either be a fixed 30fps, or a variable 1-30fps (used for stills modes). That eliminates modes 6&7 as they have a frame rate range of 40-90 (or possibly 120) fps.
Scoring on aspect ratio will give modes 1&5 a lower score as they are 16:9.
Scoring on resolution will therefore choose mode 4 at 1640x1232 as being closest to 640x480 without upscaling.
Mode 4 has a full FOV, so that is what you see.
Ok, I think my question wasn't clear enough.

1) On doc. examples; "If you set the resolution to 1024x768 (a 4:3 aspect ratio), and framerate to anything less than 42fps, the 1296x972 mode will be selected, and the camera will downscale the result to 1024x768.". This example is for V1 camera but the question is the same. What is the implementation to achieve this resolution? The downscale/upscale how its implemented? I ask in order to examine this camera system for its performance capabilities. I always change framerate before making any modification in cameras resolution to be in the correct limits as the doc. says.

2) I change resolution from 1640x1232 to 640x480 with that piece of code;

Code: Select all

 
def setResolution(self, x, y):
        if(int(x)>1630 and int(y) > 900):
            print("Change framerate")
            if(int(x)> 3200 and int(y) > 2400):
                self.camera.framerate = 15
                print("FPS changed to: 15")
            else:
                self.camera.framerate = 35
                print("FPS changed to: 35")

        self.camera.resolution = (int(x), int(y)
And I take full FoV in 640x480. The image is clearly different (I see pixelization). For preview I use video port and capture method in order to stream the image.

Thanks a lot!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: New 8MP Camera - Q&A thread

Mon Sep 12, 2016 10:52 am

thanasispap wrote:Ok, I think my question wasn't clear enough.

1) On doc. examples; "If you set the resolution to 1024x768 (a 4:3 aspect ratio), and framerate to anything less than 42fps, the 1296x972 mode will be selected, and the camera will downscale the result to 1024x768.". This example is for V1 camera but the question is the same. What is the implementation to achieve this resolution? The downscale/upscale how its implemented? I ask in order to examine this camera system for its performance capabilities. I always change framerate before making any modification in cameras resolution to be in the correct limits as the doc. says.
A reduction by a factor of 2 or more in each direction will use a trapezoidal downsampler. Less than that will use a bicubic filter. Both implemented in hardware as part of the image processing pipe.
thanasispap wrote:2) I change resolution from 1640x1232 to 640x480 with that piece of code;

Code: Select all

 
def setResolution(self, x, y):
        if(int(x)>1630 and int(y) > 900):
            print("Change framerate")
            if(int(x)> 3200 and int(y) > 2400):
                self.camera.framerate = 15
                print("FPS changed to: 15")
            else:
                self.camera.framerate = 35
                print("FPS changed to: 35")

        self.camera.resolution = (int(x), int(y)
And I take full FoV in 640x480. The image is clearly different (I see pixelization). For preview I use video port and capture method in order to stream the image.
Sorry, I'm still not clear what you're comparing.
As I understand it you've got the sensor producing 1640x1232. You're then comparing the output frames produced with no resize (1640x1232) vs that with a resize down to 640x480. Are you comparing them at the same physical size on screen? In which case your display is upscaling the 640x480 image and it'll look pixelated.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

moritzz06
Posts: 4
Joined: Tue Aug 16, 2016 8:27 pm

Re: New 8MP Camera - Q&A thread

Mon Sep 12, 2016 7:25 pm

How are you determining that it isn't exceeding 90fps? You don't appear to be using the "-pts <filename>" option to save the buffer timestamps out which is the easiest way to confirm the frame rate.
I'd also suggest you drop -ih and -g 5 for initial tests - you'll be crippling the codec by asking for 720P120 in 6MB/s with an I-frame every 5 frames. Do remember that dropping frames totally is a valid rate control approach for extreme bitrate overshoots.
And -fl to force a flush after every write will be crippling the file system.

You also haven't confirmed that this is definitely a V2.1 camera module. OV5647 (V1.3) will never exceed 90fps and would explain your observations.
@6by9:
Sorry for the late response, i'm a bit busy at the moment.
I set the Pi to force trubo=1 in config and voila: 108fps.
So it seems to be a true V2.1 Cam and it's only a performance problem.

The video gets streamed via wifibroadcast (videotransmission specially for FPV with quadrotors, https://befinitiv.wordpress.com/wifibro ... ideo-data/), so I need all the parameters.

Any suggestions for overclocking the Pi3?
Current settings again:
gpu_mem=400
arm_freq=1350
over_voltage=5
sdram_freq=500
core_freq=500
gpu_freq=450
force turbo=1

Thanks you :)

Regards,
Jan

User avatar
jbeale
Posts: 3494
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: New 8MP Camera - Q&A thread

Mon Sep 12, 2016 8:09 pm

"-fl to force a flush after every write will be crippling the file system."
Are you writing to a ramdisk, or to flash? I'd expect the former to allow significantly faster performance, IF that's now the limiting factor.
But if the video is only sent into a pipe that is passed out to the network (eg. wifi) and not saved locally, then filesystem speed wouldn't be an issue.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: New 8MP Camera - Q&A thread

Tue Sep 13, 2016 9:53 am

moritzz06 wrote:Sorry for the late response, i'm a bit busy at the moment.
I set the Pi to force trubo=1 in config and voila: 108fps.
So it seems to be a true V2.1 Cam and it's only a performance problem.

The video gets streamed via wifibroadcast (videotransmission specially for FPV with quadrotors, https://befinitiv.wordpress.com/wifibro ... ideo-data/), so I need all the parameters.
I'm advocating debugging the problem one step at a time. Those are all extra options that add additional overhead. Prove the system works without them first, then add in the bells and whistles.
moritzz06 wrote:Any suggestions for overclocking the Pi3?
Current settings again:
gpu_mem=400
arm_freq=1350
over_voltage=5
sdram_freq=500
core_freq=500
gpu_freq=450
force turbo=1
I thought I'd quoted the overclocking settings that had been used in development, but as with all overclocking they were a bit hap-hazard and guesswork.
I can't remember the full clocking structure, but there is an isp_freq parameter that may benefit from being dialed up a bit (derived from core_freq, so increasing that may have already boosted it).
arm_freq isn't going to do much as all the processing is happening on the GPU or associated hardware blocks.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

thanasispap
Posts: 14
Joined: Thu Jul 28, 2016 2:59 pm

Re: New 8MP Camera - Q&A thread

Wed Sep 14, 2016 11:19 am

Sorry, I'm still not clear what you're comparing.
As I understand it you've got the sensor producing 1640x1232. You're then comparing the output frames produced with no resize (1640x1232) vs that with a resize down to 640x480. Are you comparing them at the same physical size on screen? In which case your display is upscaling the 640x480 image and it'll look pixelated.
This is an example for what I got. I firstly set framerate at the right value and then set resolution (I don't set sensor_mode).

3280x2464:

https://drive.google.com/file/d/0B3WDu1 ... sp=sharing

1640x1232:

https://drive.google.com/file/d/0B3WDu1 ... sp=sharing

640x480:

https://drive.google.com/file/d/0B3WDu1 ... sp=sharing

I use video port for capturing jpeg (quality 100).
As you see I took the same full FoV for all images.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: New 8MP Camera - Q&A thread

Wed Sep 14, 2016 11:47 am

thanasispap wrote:This is an example for what I got. I firstly set framerate at the right value and then set resolution (I don't set sensor_mode).

3280x2464:

https://drive.google.com/file/d/0B3WDu1 ... sp=sharing

1640x1232:

https://drive.google.com/file/d/0B3WDu1 ... sp=sharing

640x480:

https://drive.google.com/file/d/0B3WDu1 ... sp=sharing

I use video port for capturing jpeg (quality 100).
As you see I took the same full FoV for all images.
I'm still failing to see an issue here.
If you've used the code you quoted to drop the frame rate to 15fps when you requested your 3280x2464 image, then it will have used mode 2.
With the 1640x1232 and 640x480 images then again assuming you're using the code you quoted, you've asked for 35fps. That pushes it to mode 4 in both cases.

Viewing each of the images at 1:1 resolution on screen they all look sharp to me with no pixellation. What in particular are you taking issue with?
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

nsbrown93
Posts: 3
Joined: Sun Mar 20, 2016 6:05 pm

Re: New 8MP Camera - Q&A thread

Fri Sep 16, 2016 6:06 am

Does anyone have details on the exact height of the CMOS sensor off of the PCB (i.e. along the optical axis)? We are using the camera without optics and need to know exactly where the sensor is. The datasheet for the sensor does not provide any such detail. Any leads would be great.

Height and thickness of the cover slip for bonus points.

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: New 8MP Camera - Q&A thread

Wed Sep 21, 2016 1:22 pm

Hey all. I purchased this RPi Cam v2.1 8MP from Amazon Germany. I am experiencing strong sharpness issues with that cam. The picture is not sharp, looks horrible. Did I miss anything, is there a way to manually setup the focus on that cam, maybe through software? Is there any trick to fix that on my own or should return it to Amazon ?

any help appreciated

User avatar
jbeale
Posts: 3494
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: New 8MP Camera - Q&A thread

Wed Sep 21, 2016 1:54 pm

It's a nominally fixed, manual focus lens; nothing to be done in software. You can break the glue with a special tool to adjust the focus. See for example http://www.thingiverse.com/thing:1574661

before and after examples from another user:
viewtopic.php?f=43&t=145815&start=200#p971545

Since those pictures were taken, the factory focus point was supposed to have been reset to near infinity (previously, the v2 camera focus had been set at about 2-5 meters).

Or, of course you could just return it.

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: New 8MP Camera - Q&A thread

Wed Sep 21, 2016 6:38 pm

Hi jbeale,

thanks for that information. That means I could manually fit/adjust it. I checked your link but unfortunately I do not own a 3D printer to produce such a tool. Is there any other "cheap" way to do the focus fixing with a step-by-step tutorial or similar?

thanks again and best regards

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5331
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: New 8MP Camera - Q&A thread

Wed Sep 21, 2016 8:00 pm

Pangu wrote: thanks for that information. That means I could manually fit/adjust it. I checked your link but unfortunately I do not own a 3D printer to produce such a tool. Is there any other "cheap" way to do the focus fixing with a step-by-step tutorial or similar?
Before the 3d printed spanner, there was the credit card spanner:
viewtopic.php?f=43&t=145815&start=200#p971545

racer993
Posts: 60
Joined: Mon Feb 18, 2013 7:27 pm

Re: New 8MP Camera - Q&A thread

Fri Sep 23, 2016 9:15 am

Recently RS Components have started to supply a spanner with the v2 camera. I received the cameras with spanner about 2 weeks ago.
spanner-2.jpg
spanner-2.jpg (60.92 KiB) Viewed 5743 times

The spanner only fits the 8MP v2 camera, it doesn't fit on the 5MP v1.3.

ArchieSt
Posts: 6
Joined: Mon Jul 11, 2016 8:02 am

Re: New 8MP Camera - Q&A thread

Thu Sep 29, 2016 12:13 pm

I have just purchased 20 cams, 10 from RS Components and 10 from Element 14, Not 1 of the cams are focused properly. We are integrating the cams into consumer products and this is reflecting badly on us and Raspberry.

On the up side, RS Components are providing us 10 cams with tools to adjust the cams for free and I must commend them for this.

I am still waiting for Element 14 to reply

I am of the opinion that a viscous retaining type compound will be the answer.

Thing also is you do not want the end user to start tinkering with the unit we supply

sudhir_brahma
Posts: 28
Joined: Fri Jun 19, 2015 12:08 pm

Re: New 8MP Camera - Q&A thread

Thu Sep 29, 2016 12:52 pm

I am facing a similar problem too with the 8 MPixel camera. Everything seems to be blurred- both near and far objects.
I am running raspistill and saving the file. Using Pi3 Jessie
Is this a manufacturing defect (like u say- lens positioning)?
How does one go about fixing it?
I bought this from RS components
regards
Sudhir Brahma

sudhir_brahma
Posts: 28
Joined: Fri Jun 19, 2015 12:08 pm

Re: New 8MP Camera - Q&A thread

Thu Sep 29, 2016 1:14 pm

OK- looks like I was able to fix the issue: I used the spanner mentioned above and adjusted the lens - now things are sharp
Many thanks to racer993

Madcap
Posts: 4
Joined: Sun Dec 21, 2014 12:14 pm

Re: New 8MP Camera - Q&A thread

Sat Oct 01, 2016 7:57 pm

I just received the V2 camera from The Pi Hut and I am very disappointed with the image quality. Poor focus at range, which was my intended use for it. My V1 cameras have much better image quality.

I don't understand how they could still be selling these? I guess I need to manually adjust the lens, is there a simple way to do it without the little white tool mentioned in the above posts? It wasn't included in the package.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: New 8MP Camera - Q&A thread

Wed Oct 12, 2016 1:35 pm

Apologies to those struggling to get the highest frame rates that I'd quoted before. One of the patches to improve high frame rate support hadn't actually been merged into the main tree for some reason, so I was running against a slightly different build to all of you.
That patch has now been pushed to the rpi-update branch and should hopefully allow you to extract a few more fps from the pipeline.
(For info, the patch reduces the rate at which all the control loops run so that there is more time and processor available to crunch the pixel data. At high frame rates we'll still be adapting at the same rate overall as normal 30fps operation, so no real change in observed operation).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
Mettauk
Posts: 237
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Re: New 8MP Camera - Q&A thread

Sat Oct 15, 2016 1:02 pm

Madcap wrote:I just received the V2 camera from The Pi Hut and I am very disappointed with the image quality. Poor focus at range, which was my intended use for it. My V1 cameras have much better image quality.

I don't understand how they could still be selling these? I guess I need to manually adjust the lens, is there a simple way to do it without the little white tool mentioned in the above posts? It wasn't included in the package.
Having fed back the poor quality of the newer camera module and returned a number some months ago, I recently ordered some more of the so called corrected ones, they will also be going back as they are a seriously flawed product with very poor focus, colour balance and light range (low light performance) with standard and NoIR versions.
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

campbellx
Posts: 1
Joined: Wed Oct 19, 2016 6:20 pm

Re: New 8MP Camera - Q&A thread

Wed Oct 19, 2016 6:24 pm

Firmware has supported the sensor for a while, but there have been updates in the last couple of days. Raspistill app and V4L2 driver have been updated to ask the GPU what the max sensor resolution is and set default/max resolutions appropriately - source repos are both updated.
I browed through the RaspiStill.c source. How does the GPU know the max sensor resolution? Where does the original max sensor resolution or even the sensor name come from? I would imagine it's somewhere from the camera module and I am curious how GPU would know that info.

Anshul Jain
Posts: 2
Joined: Sat Jan 30, 2016 12:57 pm

Re: New 8MP Camera - Q&A thread

Thu Nov 03, 2016 6:23 am

Hello Raspberry team,

I am wondering if you have come up with a solution for 8MP camera module fucus issue.

I tried manual focussing very precisely for 8MP camera module but the results are not satisfactory when compared to V1 cam module.

Please let us know the solution to capture better image of distant objects.

Regards,
Anshul Jain

Anshul Jain
Posts: 2
Joined: Sat Jan 30, 2016 12:57 pm

Re: New 8MP Camera - Q&A thread

Thu Nov 03, 2016 11:26 am

racer993 wrote:Recently RS Components have started to supply a spanner with the v2 camera. I received the cameras with spanner about 2 weeks ago.
spanner-2.jpg

The spanner only fits the 8MP v2 camera, it doesn't fit on the 5MP v1.3.
Hi.
Could you please share the link to buy the spanner?

Thanks in advance!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23682
Joined: Sat Jul 30, 2011 7:41 pm

Re: New 8MP Camera - Q&A thread

Thu Nov 03, 2016 2:14 pm

campbellx wrote:
Firmware has supported the sensor for a while, but there have been updates in the last couple of days. Raspistill app and V4L2 driver have been updated to ask the GPU what the max sensor resolution is and set default/max resolutions appropriately - source repos are both updated.
I browed through the RaspiStill.c source. How does the GPU know the max sensor resolution? Where does the original max sensor resolution or even the sensor name come from? I would imagine it's somewhere from the camera module and I am curious how GPU would know that info.
All sensors have an ID, unique to that sensor type. This ID is used to identify the camera via the I2C interface. That ID is them used to define the max resolution and name of the camera, as well as a load of other parameters required to set that particular sensor up. All this is done when the camera driver on the GPU starts up.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

swag01
Posts: 1
Joined: Sat May 28, 2016 6:16 am

Re: New 8MP Camera - Q&A thread

Fri Nov 04, 2016 5:14 pm

I use cameras V1.3 and v2.1 for astrophotography; without provided lens as a webcam
with a telescope and with lens for wide field recording (hopefully) of meteorites.

I noted, on this thread, that a kernel update was available to achieve higher frame rates
and did an rpi-update towards the end of October.
4.4.15 50f4bc47fc16c05c657c6f6f15719e57917f9b81

I checked out a V2.1 on a PI2 and a PI3 and all was well - frame rates as predicted.

For wide field imaging I use the following parameters:-

V1.3 raspistill -n -t 120000 -ss 6000000 -tl 6000 -fp -bm -ISO 100 -awb off -awbg 1,1 -o %04d.jpg

this gives the following message:mmal: Skipping frame 2 to restart at frame 5
but the remaining frames appear as expected up to the end of whatever -t is chosen.

V2.1 raspistill -v -n -t 240000 -ss 11500000 -tl 11500 -bm -ISO 640 -awb off -awbg 1.2,1 -o %01d.jpg
This gives: mmal: Skipping frame 2 to restart at frame 9 plus some late frames although there are always enough frames for my purpose.

Note: I found that -ss for V2.1 maxed at 11.74 sec. and chose 11.5secs as my input.
I have noted in another thread that V2.1 ISO max is 588 but I don't think it has
affected the results.

The Problem:-
Since doing the rpi-update I have found that the wide field results have been affected
as follows:-
V1.3 skips from 2 to 4 and then three of every four.
V2.1 skips from 2 to 8 and then three of every four.

To get back to the original results I have had to roll back to 4.4.15 50f4bc47fc16c05c657c6f6f15719e57917f9b81

Where did I go wrong?


Another question:- With V1.3 any attempt to input ISO greater than 800 results in
no change to the image and Exif always registers 800 max. (I know it is possible to
achieve ISO 1600 with the -ex night setting; up to -ss just over 1sec that is)

Using V2.3 increasing ISO over 640 shows no change to the image but exif records the input ISO value. How can this be?

Return to “Camera board”