Realization of DM8127 color turn black

Source: Internet
Author: User

Recently in doing DM8127 project, customer requirements with color turn black, black turn color function (DM8127 SDK demo does not have this function), think for a long time do not know where to start, later through the massive data access, finally have a train of thought. Since is the color turn black, then I put the data stream (YUV data) inside the color component (UV component) to get rid, only retains the luminance component (Y component), can realize the color turn black. Not to mention the black-and-round color. With this idea, the rest is how to achieve the problem, of course, there are many ways to implement, my implementation method is as follows:

1. First, define a iss_captresolution global array variable gcaptresolution [Camera_link_max_out_que] in the cameralink_drv.c file. Why do you define this variable? is because we output multi-bar code flow, each bar code stream resolution is not the same, this variable is to save the resolution of each bar code stream, in order to handle. If all are processed according to the same resolution, it will cause the output image to appear horizontal bar, huaping and so on.


2, second, of course, to give gcaptresolution this variable assigned value, where to assign value it. I choose to assign a value to Gcaptresolution in the cameralink_drvsetresolution () function;

Cameralink_drvsetresolution ()

{

..........

memcpy (&gcaptresolution [Streamid], &resolutionparams,sizeof (iss_captresolution)); This gives gcaptresolution a good value.

Status = Fvid2_control (Pinst->cameraviphandle,
Ioctl_iss_capt_set_resolution,
&resolutionparams, NULL);

........

}


3, finally, on how to achieve color turn black function;

Pframe->addr[0][0] contains the Y component, and the pframe->addr[0][1] contains the UV component. As long as the value of pframe->addr[0][1] inside set to 128 can achieve color turn black effect.

I implemented this function in Cameralink_drvprocessdata (), which is implemented as follows:

In this for loop, why? Implemented in this for loop, the stream of each output can be processed.

for (Frameid = 0; Frameid < framelist.numframes; frameid++)

{

..........

if (iris_flage = = TRUE)//I am here when the infrared is turned on, the color turns black

{

memset (Pframe->addr[0][1], Gcaptresolution[queid]. Resolutionwidth*gcaptresolution[queid]. Resolutionheight);

}

Status = Utils_bufputfullframe ();

........

}


This will take care of the color turn black function. I hope this article can give the needy colleagues a little help, write poorly, please understand.


----------------------------------------Reprint Please keep original, thank you. ------------------------------------------



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.