i.MX8M Plus适配OV4689获取图像异常

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

i.MX8M Plus适配OV4689获取图像异常

1,744 Views
GreatForest
Contributor I

Dear all:

本人在米尔的i.MX8M Plus开发板上适配OV4689,内核版本为5.10.9,sensor配置为8bit raw,4 lanes,1280x720,60fps

获取raw数据

~# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=1280,height=720,frmaerate=60/1 ! filesink location=frame.raw
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 40.551814] bypass csc
[ 40.554196] input fmt BA81
[ 40.556902] output fmt YUYV
Got EOS from element "pipeline0".
Execution ended after 0:00:00.579271375
Setting pipeline to NULL ...
Freeing pipeline ...

GreatForest_0-1665201192168.png

获取jpg图片

~# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=1280,height=720 ! jpegenc ! filesink location=frame.jpg
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 79.694597] bypass csc
[ 79.696956] input fmt BA81
[ 79.699688] output fmt YUYV
Got EOS from element "pipeline0".
Execution ended after 0:00:00.761583375
Setting pipeline to NULL ...
Freeing pipeline ...

GreatForest_1-1665201441958.png

将imx8-isi-cap.c的mxc_isi_out_formats结构体中YUV-16的值改为YUV32 (X-Y-U-V)

struct mxc_isi_fmt mxc_isi_out_formats[] = {
{
.name = "RGB565",
.fourcc = V4L2_PIX_FMT_RGB565,
.depth = { 16 },
.color = MXC_ISI_OUT_FMT_RGB565,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_RGB565_1X16,
}, {
.name = "RGB24",
.fourcc = V4L2_PIX_FMT_RGB24,
.depth = { 24 },
.color = MXC_ISI_OUT_FMT_RGB32P,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24,
}, {
.name = "BGR24",
.fourcc = V4L2_PIX_FMT_BGR24,
.depth = { 24 },
.color = MXC_ISI_OUT_FMT_BGR32P,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_BGR888_1X24,
}, {
.name = "YUYV-16",
 .fourcc = V4L2_PIX_FMT_YUV32,                         // V4L2_PIX_FMT_YUYV,
.depth = { 32 },                                                         // { 16 },
.color = MXC_ISI_OUT_FMT_YUV444_1P8,          // MXC_ISI_OUT_FMT_YUV422_1P8P,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_AYUV8_1X32, // MEDIA_BUS_FMT_YUYV8_1X16,
}, {
.name = "YUV32 (X-Y-U-V)",
.fourcc = V4L2_PIX_FMT_YUV32,
.depth = { 32 },
.color = MXC_ISI_OUT_FMT_YUV444_1P8,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_AYUV8_1X32,
}, {
.name = "NV12 (YUYV)",
.fourcc = V4L2_PIX_FMT_NV12,
.depth = { 8, 8 },
.color = MXC_ISI_OUT_FMT_YUV420_2P8P,
.memplanes = 2,
.colplanes = 2,
.mbus_code = MEDIA_BUS_FMT_YUYV8_1X16,
}, {
.name = "YUV444M (Y-U-V)",
.fourcc = V4L2_PIX_FMT_YUV444M,
.depth = { 8, 8, 8 },
.color = MXC_ISI_OUT_FMT_YUV444_3P8P,
.memplanes = 3,
.colplanes = 3,
.mbus_code = MEDIA_BUS_FMT_YUV8_1X24,
}, {
.name = "xBGR32",
.fourcc = V4L2_PIX_FMT_XBGR32,
.depth = { 32 },
.color = MXC_ISI_OUT_FMT_XRGB32,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24,
}, {
.name = "ABGR32",
.fourcc = V4L2_PIX_FMT_ABGR32,
.depth = { 32 },
.color = MXC_ISI_OUT_FMT_ARGB32,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24,
}, {
.name = "BG10 (SBGGR10)",
.fourcc = V4L2_PIX_FMT_SBGGR10,
.depth = { 16 },
.color = MXC_ISI_OUT_FMT_RAW10,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
}, {
.name = "BA81 (SBGGR8)",
.fourcc = V4L2_PIX_FMT_SBGGR8,
.depth = { 8 },
.color = MXC_ISI_OUT_FMT_RAW8,
.memplanes = 1,
.colplanes = 1,
.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8,
}
};

重新抓raw,输出格式变为AR24

~# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=1280,height=720,frmaerate=60/1 ! filesink location=frame.raw
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 625.994408] bypass csc
[ 625.996768] input fmt BA81
[ 625.999498] output fmt AR24
Got EOS from element "pipeline0".
Execution ended after 0:00:00.598934000
Setting pipeline to NULL ...
Freeing pipeline ...

GreatForest_0-1665209639285.png

重新抓jpg图片,输出格式变为XR24

~# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,width=1280,height=720 ! jpegenc ! filesink location=frame.jpg
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 635.599196] bypass csc
[ 635.601565] input fmt BA81
[ 635.604271] output fmt XR24
Got EOS from element "pipeline0".
Execution ended after 0:00:00.845696875
Setting pipeline to NULL ...
Freeing pipeline ...

GreatForest_1-1665209758010.png

最后是获取到图片都是异常,请大伙帮忙看下是哪里的问题。

另外这里还有个问题,imx8mp平台默认不支持10bit raw,所以我把sensor配置成8bit raw,但如果要支持10bit raw,在上面的mxc_isi_out_formats结构体中添加10bit raw相关数据也不能正常获取raw数据,网上搜到都是在4.几的内核上修改的,不知道还修改哪里的驱动文件,望告知,谢谢!

Labels (1)
0 Kudos
Reply
5 Replies

843 Views
rumozhizheng
Contributor I

你好请问你最后解决RAW10的问题了不?

0 Kudos
Reply

1,719 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport
0 Kudos
Reply

1,713 Views
GreatForest
Contributor I

我查看了 i.MX 8M Plus Camera Sensor Porting User Guide.pdf 中的 Chapter 6 Camera Sensor Driver in V4L2 Mode,这一章中提到的sensor驱动文件,我这边内核目录没有找到该路径,甚至连vvcam文件夹都没有,好像这文档没有太大的参考作用。

GreatForest_0-1665470684708.png

我这边适配OV4689是在 drivers/media/i2c/ov5640.c 上修改过来的,目前sensor是有数据,但最终出图有异常。

0 Kudos
Reply

1,708 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport
0 Kudos
Reply

1,669 Views
GreatForest
Contributor I

你好!

我在运行isp_media_server的时候出现如下错误

第一个终端

GreatForest_2-1666689659921.png

第二个终端

GreatForest_3-1666689696822.png

我在这里[IMX8MP][ISP] isp_media_server crashes at camdev::SensorOps::queryCaps() 看到一样的问题,但没看懂是怎么解决的,请问这个问题是要怎么解决的?

Regards

0 Kudos
Reply