2019-08-07 05:40 AM
Hi,
I'm adding camera to my custom board with TouchGFX using DCMI.
I have doubts on how to put video camera in framebuffer used by TouchGFX..
I've created 2 framebufferes in LTDC and the first is used by Touch. I don't know if I use the second framebuffer to camera and show the second in LCD or I use the same framebuffer for both. How I leave TouchGFX using framebuffer...
Thanks.
2019-08-07 06:22 AM
Hi @eng23,
What is the resolution of the camera? What you could do is receive an interrupt every time there's a new frame ready in the camera, read that data into a piece of memory which is configured for a DynamicBitmap. You can then invalidate() this bitmap to show the new camera frame. Notice that you can only show camera frames at the same speed that the application is running.
/Martin
2019-08-07 07:48 AM
Hi @Martin KJELDSEN ,
Welcome back to work!
My cameras have the resolution of 1280x960, the other has 648x488. But my LCD is 480x272, so an adaptation is necessary.
I was thinking doing something like this using DMA:
frame = (uint8_t *)LTDC_Layer1->CFBAR;
HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t)frame, 0x0000FF00);
But it conflicts with TouchGFX framebuffer.
I understand your suggest, I will try this and let you know.
Thanks!
2019-08-09 05:56 AM
Hi @eng23,
Yes, that will conflict. If you're doing a continuous mode, maybe you should just do the following to test:;
Are you looking to have a full screen application showing the camera frames?
/Martin
2019-08-09 06:25 AM
Hi @Martin KJELDSEN ,
Thanks for reply.
I could create a dynamic bitmap and I'm showing properly in LCD. I set an area in external SRAM and this is used in this bitmap.
After I pointed the DCMI_DMA to this area in snapshot mode and the screen shows different images in each update (but abstract images), so this process is working (by TGFX).
My problem now is that this images are comming from camera, but I don't know if the pattern is wrong (PAL, NTSC..), synchronization, resolution... so my effort is in this, but the TouchGFX feature to show video (or snaps) is ok (I hope)!
Yes I'm looking to have a full screen showing camera frames.
Thanks.
2019-08-09 06:39 AM
How does it look? Also consider the bitdepth of the frames generated by the camera. It must match the setting of LTDC/TouchGFX.
/Martin
2019-08-13 06:10 AM
Hi,
At this moment I have this:
This image should show colors bar (a function from video decoder) and we can see a few pixels like it should be.
I'm checking DCMI settings and synchronization. If I move camera position this screen has little changes, but with this beautiful pixels!
Thanks
2019-09-02 04:54 AM
How are you doing on this? Did your checks turn up anything? How many bars did you expect there to be? There may be an offset issue - That's typically indicated by the slanted lines. Maybe your dynamic bitmap is one pixel too wide.
/Martin
2019-09-02 05:32 AM
Hi Martin,
Well about the bars the problem was the synchronization in HSYNC, because I was expecting that DCMI peripheral should do this, but it doesn't.
My camera format is YCbCr, so I needed to implement in code this sync and then convert, in code too, to RGB888 format.
The problem about this is the frame rate, which I could reach only 10 FPS (because the conversion YCbCr > RGB888 done in code).
In TGFX side, I add a Dynamic Bitmap and every VSYNC interrupt I do the conversion and invalidate the image.
Another think is that the camera has more resolution than my TFT, so currently I show only a part of full image, because I think if I downscale I need more processing and could reduce even more the FPS.
Regards
2019-09-02 06:39 AM
Further processing the image would probably slow down things considerably, i agree. So, actually, some ST chips support in-hardware-YCbCr decoding directly into the DynamicBitmap memory area.
/Martin