OV5640 MIPI CSI Camera Register Settings

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OV5640 MIPI CSI Camera Register Settings

4,350 Views
vinothkumars
Senior Contributor IV

Dear All,

I am working on IMX8QM-MEK. I needs to configure the Video preview to different degree.

Is there any register settings to change the OV5640-mipi csi Camera Version 3  Video preview to 0 deg, 90 deg and 180deg etc ?

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos
17 Replies

3,718 Views
nolan_zinn
Contributor IV

vinothkumars if you found an answer, be sure to post it here.  Or mark one of the answers above as correct...

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Working on that Nolan.

VInoth S,

Regards,
Vinothkumar Sekar
0 Kudos

146 Views
deepakbeniya
Contributor II

Hay @vinothkumars did you find any solution for your issue? Because I am also facing the same issue .
I was trying to change the register value by 

i2cget -y 3 0x3c 0x3821

i2cset -y 3 0x3c 0x3821 0x06

but nothing works in my case.
Any solution will be helpfull

Thanks and regards
Deepak Kumar Beniya

0 Kudos

3,718 Views
gary_bisson
Senior Contributor III

Hi,

Oh I see what you mean, well the registers will allow you to do flip and mirror only, so it gives you the ability to do 180 rotation.

However for 90 will require post-processing rotation indeed.

Regards,

Gary

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Hi gary_bisson

Will you please give more information ?

Will you please share your patch ?

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos

3,718 Views
gary_bisson
Senior Contributor III

Hi,

Here is one patch I've done to have vflip/mirror read from device tree and applied during firmware download.

ov5640_mipi: allow to override vflip and mirror values · boundarydevices/linux-imx6@28d169c · GitHub 

This was for an older version of the driver but it's the same, you need to make sure the fw you download when switching resolution doesn't get overwritten.

Regards,

Gary

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Hi gary_bisson

Do you know is there any other hardware register able to rotate OV5640 view ?

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos

3,718 Views
gary_bisson
Senior Contributor III

Hi,

I know there isn't. You can check the whole datasheet.

Regards,

Gary

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Thank you Gary

Regards,

VInoth S,

Regards,
Vinothkumar Sekar
0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Thank you Gary for the quick reply,

From your input I come to know,

for VFLIP:

               0x3820 0x06

for MIRROR:

               0x3821 0x06

Thanks & Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos

3,718 Views
gary_bisson
Senior Contributor III

Hi Vinoth,

You should look at the datasheet of the sensor:

https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf 

You'll see the following section that replies to your question (avoids doing a transform in user-space, hence better):

Screenshot from 2020-04-13 17-12-44.png

Regards,

Gary

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Thank you gary_bisson‌,

I already configured and test with these register but, I am unable rotate this view

0x3820 & 0x3821

Do you know any configuration/ register to rotate the preview ?

Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos

3,718 Views
gary_bisson
Senior Contributor III

Hi,

It means you are overwriting the value at some point. Because I've used those registers before and they work ok.

I suggest you read back those registers during the preview to make sure they are properly set.

Regards,

Gary

0 Kudos

3,718 Views
nolan_zinn
Contributor IV

In my experience, I haven't found a way to change the video rotation in a hardware register.  In software it can be done using gstreamer and the videoflip pipeline element.  If you would like to render the video stream in an app (in my case, a Qt app) you can create a gstreamer pipeline and poll it for an image, store the image buffer into a QImage, and then use the QImage::mirrored or QImage::transformed functions.  This is useful if, for instance, you want to do some sort of compute on the un-flipped video image but want to render the flipped one for users.  Doing this on the i.MX8QXP, we ran into performance issues if the frame rate was too high, but I'm pretty sure the i.MX8QM has better video capabilities.

Hope that helps!

Nolan Z

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Thank You nolan.zinn@bayer.com‌ for the reply.

I am working on Android 9 Automotive with Rear View Camera functionality (SDK_MEK-MIMX8QM). Do you know about flip mechanism ?

This is what observation. If you know any configuration let me the regarding orientation.

pastedImage_1.png

Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos

3,718 Views
nolan_zinn
Contributor IV

With gstreamer you would use a (c++) command like this:

const char* launchCmd = "/dev/video1 " +
        "! video/x-raw,width=1920,height=1080 " +
        "! videoflip method=counterclockwise " +
        "! autovideoconvert " +
        "! video/x-raw,format=RGB16 " +
        "! appsink name=\"mysink\"";‍‍‍‍‍‍‍‍‍
GError *error = null;
GstElement *pipeline = gst_parse_launch(launchCmd, &error);‍‍‍‍‍‍‍‍

The Java api for gstreamer is located at gstreamer-java · GitHub .

Nolan Z

0 Kudos

3,718 Views
vinothkumars
Senior Contributor IV

Thank you Nolan Z for the quick reply,

Regards,

Vinoth S,

Regards,
Vinothkumar Sekar
0 Kudos