Hi,team:
Right now i am working on FPDLink camera. My camera is 1280 719 and they are in sync mode. If I connected four cameras, the frames size will be 5120719. So any way can crop them to four 1280*719 frames easily?
And any way can transfer yuv422 to rgb without using cuda? Like VIC or something?
Hi,JerryChang,
I am try to use NvBufferTransform to transfer yuv422 to yuv420. And i refer tegra_multimedia_api/samples/12_camera_v4l2_cuda/camera_v4l2_cuda.cpp.But when i view the yuv420 file,the picture looks missing some plane. Can you help me ?
NvBufferMemSyncForDevice(ctx->g_buff[v4l2_buf.index].dmabuff_fd, 0,
(void **)&ctx->g_buff[v4l2_buf.index].start);
// Convert the camera buffer from YUV422 to YUV420P
if (-1 == NvBufferTransform(ctx->g_buff[v4l2_buf.index].dmabuff_fd, ctx->render_dmabuf_fd,
&transParams))
ERROR_RETURN("Failed to convert the buffer");
ctx->renderer->render(ctx->render_dmabuf_fd);
NvBufferMemMap(ctx->render_dmabuf_fd, 0, NvBufferMem_Write, &psrc_data);
NvBufferMemSyncForCpu(ctx->render_dmabuf_fd, 0, &psrc_data);
yuv420_ofstream->write((char *)psrc_data, 719 * 1280 * 3 / 2);
Hi,
Yes, you need to call NvBufferMemMap(), NvBufferMemSyncForCpu(), NvBufferMemUnMap() for each plane. For V4L2_PIX_FMT_YUV420M, there are three separate planes( Y, U, V planes ).
Hi,DaneLLL,
Right now i can transfer yuv422 → yuv420 → jpeg.But i still can not crop the frames.
I found two ways to crop frames, one is NvBufferTransform, and i can not understand how to config
/**
* Holds parameters for buffer transform functions.
*/
typedef struct _NvBufferTransformParams
{
/** flag to indicate which of the transform parameters are valid. */
uint32_t transform_flag;
/** flip method. */
NvBufferTransform_Flip transform_flip;
/** transform filter. */
NvBufferTransform_Filter transform_filter;
/** source rectangle coordinates for crop opeartion. */
NvBufferRect src_rect;
/** destination rectangle coordinates for crop opeartion. */
NvBufferRect dst_rect;
/** NvBufferSession to be used for transform. If NULL, the default session
* is used. */
NvBufferSession session;
}NvBufferTransformParams;
transform_filter = NVBUFFER_TRANSFORM_CROP_DST looks can not work.
Hi,Danel,thanks, thats can help me. Sorry i have another question. Can jpeg encodec generate gray scale image?
I tried change JCS_YCbCr to JCS_GRAYSCALE, its return error. Any help?
if (ctx->jpegenc->encodeFromFd(buffer->planes[0].fd, JCS_YCbCr, &out_buf,
out_buf_size, ctx->quality) < 0)
{
cerr << "Error while encoding from fd" << endl;
ctx->got_error = true;
}
Hi, DaneLLL
I tried to save the frame which after crop to yuv420_I420 format. but when i preview the frame looks missing some infomation.BTW, i use the dump_dmabuf for three planes.
I have checked the frame, the U looks have V’s infomation. The green bar at the bottom is form V. If only show Y and U looks good.But the yuv420m sould be three plane ,right?