当前位置: 首页 > news >正文

怎么做网站给国外看见网站排名软件优化

怎么做网站给国外看见,网站排名软件优化,人力资源网站开发说明书,小程序商城开发说明在Rv1126上直接对Nv12图像进行绘制时,颜色是灰色。故将Nv12转BGR后绘制图像,绘制完成后转成Nv12,BGR的图像颜色是正常的,但是NV12的图像颜色未画全,如图: 1.排查发现是RGB转NV12的函数出现问题&#xff0c…

 在Rv1126上直接对Nv12图像进行绘制时,颜色是灰色。故将Nv12转BGR后绘制图像,绘制完成后转成Nv12,BGR的图像颜色是正常的,但是NV12的图像颜色未画全,如图:

1.排查发现是RGB转NV12的函数出现问题,故百度找到一个可用的网址:RGB转换为NV12的代码_rgb转nv12-CSDN博客


//https://software.intel.com/en-us/node/503873
//YCbCr Color Model:
//    The YCbCr color space is used for component digital video and was developed as part of the ITU-R BT.601 Recommendation. YCbCr is a scaled and offset version of the YUV color space.
//    The Intel IPP functions use the following basic equations [Jack01] to convert between R'G'B' in the range 0-255 and Y'Cb'Cr' (this notation means that all components are derived from gamma-corrected R'G'B'):
//    Y' = 0.257*R' + 0.504*G' + 0.098*B' + 16
//    Cb' = -0.148*R' - 0.291*G' + 0.439*B' + 128
//    Cr' = 0.439*R' - 0.368*G' - 0.071*B' + 128//Y' = 0.257*R' + 0.504*G' + 0.098*B' + 16
static float Rgb2Y(float r0, float g0, float b0)
{float y0 = 0.257f*r0 + 0.504f*g0 + 0.098f*b0 + 16.0f;return y0;
}//U equals Cb'
//Cb' = -0.148*R' - 0.291*G' + 0.439*B' + 128
static float Rgb2U(float r0, float g0, float b0)
{float u0 = -0.148f*r0 - 0.291f*g0 + 0.439f*b0 + 128.0f;return u0;
}//V equals Cr'
//Cr' = 0.439*R' - 0.368*G' - 0.071*B' + 128
static float Rgb2V(float r0, float g0, float b0)
{float v0 = 0.439f*r0 - 0.368f*g0 - 0.071f*b0 + 128.0f;return v0;
}//Convert two rows from RGB to two Y rows, and one row of interleaved U,V.
//I0 and I1 points two sequential source rows.
//I0 -> rgbrgbrgbrgbrgbrgb...
//I1 -> rgbrgbrgbrgbrgbrgb...
//Y0 and Y1 points two sequential destination rows of Y plane.
//Y0 -> yyyyyy
//Y1 -> yyyyyy
//UV0 points destination rows of interleaved UV plane.
//UV0 -> uvuvuv
static void Rgb2NV12TwoRows(const unsigned char I0[],const unsigned char I1[],int step,const int image_width,unsigned char Y0[],unsigned char Y1[],unsigned char UV0[])
{int x;  //Column index//Process 4 source pixels per iteration (2 pixels of row I0 and 2 pixels of row I1).for (x = 0; x < image_width; x += 2){//Load R,G,B elements from first row (and convert to float).float r00 = (float)I0[x*step + 0];float g00 = (float)I0[x*step + 1];float b00 = (float)I0[x*step + 2];//Load next R,G,B elements from first row (and convert to float).float r01 = (float)I0[x*step + step+0];float g01 = (float)I0[x*step + step+1];float b01 = (float)I0[x*step + step+2];//Load R,G,B elements from second row (and convert to float).float r10 = (float)I1[x*step + 0];float g10 = (float)I1[x*step + 1];float b10 = (float)I1[x*step + 2];//Load next R,G,B elements from second row (and convert to float).float r11 = (float)I1[x*step + step+0];float g11 = (float)I1[x*step + step+1];float b11 = (float)I1[x*step + step+2];//Calculate 4 Y elements.float y00 = Rgb2Y(r00, g00, b00);float y01 = Rgb2Y(r01, g01, b01);float y10 = Rgb2Y(r10, g10, b10);float y11 = Rgb2Y(r11, g11, b11);//Calculate 4 U elements.float u00 = Rgb2U(r00, g00, b00);float u01 = Rgb2U(r01, g01, b01);float u10 = Rgb2U(r10, g10, b10);float u11 = Rgb2U(r11, g11, b11);//Calculate 4 V elements.float v00 = Rgb2V(r00, g00, b00);float v01 = Rgb2V(r01, g01, b01);float v10 = Rgb2V(r10, g10, b10);float v11 = Rgb2V(r11, g11, b11);//Calculate destination U element: average of 2x2 "original" U elements.float u0 = (u00 + u01 + u10 + u11)*0.25f;//Calculate destination V element: average of 2x2 "original" V elements.float v0 = (v00 + v01 + v10 + v11)*0.25f;//Store 4 Y elements (two in first row and two in second row).Y0[x + 0]    = (unsigned char)(y00 + 0.5f);Y0[x + 1]    = (unsigned char)(y01 + 0.5f);Y1[x + 0]    = (unsigned char)(y10 + 0.5f);Y1[x + 1]    = (unsigned char)(y11 + 0.5f);//Store destination U element.UV0[x + 0]    = (unsigned char)(u0 + 0.5f);//Store destination V element (next to stored U element).UV0[x + 1]    = (unsigned char)(v0 + 0.5f);}
}//Convert image I from pixel ordered RGB to NV12 format.
//I - Input image in pixel ordered RGB format
//image_width - Number of columns of I
//image_height - Number of rows of I
//J - Destination "image" in NV12 format.//I is pixel ordered RGB color format (size in bytes is image_width*image_height*3):
//RGBRGBRGBRGBRGBRGB
//RGBRGBRGBRGBRGBRGB
//RGBRGBRGBRGBRGBRGB
//RGBRGBRGBRGBRGBRGB
//
//J is in NV12 format (size in bytes is image_width*image_height*3/2):
//YYYYYY
//YYYYYY
//UVUVUV
//Each element of destination U is average of 2x2 "original" U elements
//Each element of destination V is average of 2x2 "original" V elements
//
//Limitations:
//1. image_width must be a multiple of 2.
//2. image_height must be a multiple of 2.
//3. I and J must be two separate arrays (in place computation is not supported). 
void Rgb2NV12(const unsigned char I[], int step,const int image_width, const int image_height,unsigned char J[])
{//In NV12 format, UV plane starts below Y plane.unsigned char *UV = &J[image_width*image_height];//I0 and I1 points two sequential source rows.const unsigned char *I0;  //I0 -> rgbrgbrgbrgbrgbrgb...const unsigned char *I1;  //I1 -> rgbrgbrgbrgbrgbrgb...//Y0 and Y1 points two sequential destination rows of Y plane.unsigned char *Y0;    //Y0 -> yyyyyyunsigned char *Y1;    //Y1 -> yyyyyy//UV0 points destination rows of interleaved UV plane.unsigned char *UV0; //UV0 -> uvuvuvint y;  //Row index//In each iteration: process two rows of Y plane, and one row of interleaved UV plane.for (y = 0; y < image_height; y += 2){I0 = &I[y*image_width*step];        //Input row width is image_width*3 bytes (each pixel is R,G,B).I1 = &I[(y+1)*image_width*step];Y0 = &J[y*image_width];            //Output Y row width is image_width bytes (one Y element per pixel).Y1 = &J[(y+1)*image_width];UV0 = &UV[(y/2)*image_width];    //Output UV row - width is same as Y row width.//Process two source rows into: Two Y destination row, and one destination interleaved U,V row.Rgb2NV12TwoRows(I0,I1,step,image_width,Y0,Y1,UV0);}
}

调用:

cv::Mat m_stJpg_640x384 = cv::imread("D:\\ImageToNv12\\111.jpg");if (!m_stJpg_640x384.empty()) {cv::cvtColor(m_stJpg_640x384, m_stJpg_640x384, COLOR_BGR2RGB);unsigned char* pData = new unsigned char[1920 * 1080 * 3];Rgb2NV12(m_stJpg_640x384.data, 3/*RGB为3,RGBA为4*/, m_stJpg_640x384.cols, m_stJpg_640x384.rows, pData);WriteFile("m.yuv", "wb+", pData, m_stJpg_640x384.cols * m_stJpg_640x384.rows * 3 / 2);delete[] pData;}


文章转载自:
http://engarcon.c7491.cn
http://graphologist.c7491.cn
http://radiatory.c7491.cn
http://novokuznetsk.c7491.cn
http://magistrate.c7491.cn
http://clownism.c7491.cn
http://fumigate.c7491.cn
http://ferrotungsten.c7491.cn
http://radius.c7491.cn
http://indigosol.c7491.cn
http://darning.c7491.cn
http://newt.c7491.cn
http://pec.c7491.cn
http://dysthymic.c7491.cn
http://anglicist.c7491.cn
http://exergonic.c7491.cn
http://pyrophobia.c7491.cn
http://jat.c7491.cn
http://unbacked.c7491.cn
http://refundment.c7491.cn
http://graticulate.c7491.cn
http://salicornia.c7491.cn
http://telluretted.c7491.cn
http://exarteritis.c7491.cn
http://limicole.c7491.cn
http://acantha.c7491.cn
http://hypopselaphesia.c7491.cn
http://sauterne.c7491.cn
http://roseola.c7491.cn
http://countermovement.c7491.cn
http://fluent.c7491.cn
http://calvities.c7491.cn
http://exogamy.c7491.cn
http://prise.c7491.cn
http://meg.c7491.cn
http://counterguard.c7491.cn
http://fluviology.c7491.cn
http://counterproductive.c7491.cn
http://catabaptist.c7491.cn
http://retentively.c7491.cn
http://transportee.c7491.cn
http://roadstead.c7491.cn
http://square.c7491.cn
http://tutee.c7491.cn
http://cattery.c7491.cn
http://retinoblastoma.c7491.cn
http://alkene.c7491.cn
http://isopiestic.c7491.cn
http://alliterative.c7491.cn
http://sheerly.c7491.cn
http://internalization.c7491.cn
http://waggish.c7491.cn
http://frontenis.c7491.cn
http://nubecula.c7491.cn
http://glabrate.c7491.cn
http://dibatag.c7491.cn
http://zymosthenic.c7491.cn
http://nonhero.c7491.cn
http://mudsill.c7491.cn
http://stutter.c7491.cn
http://tollkeeper.c7491.cn
http://epigram.c7491.cn
http://auctioneer.c7491.cn
http://jetliner.c7491.cn
http://collectivist.c7491.cn
http://annotator.c7491.cn
http://ponceau.c7491.cn
http://analytics.c7491.cn
http://screever.c7491.cn
http://cenote.c7491.cn
http://riparian.c7491.cn
http://schistosome.c7491.cn
http://subdecanal.c7491.cn
http://compliant.c7491.cn
http://outfitter.c7491.cn
http://irrespectively.c7491.cn
http://depth.c7491.cn
http://citybred.c7491.cn
http://multiscreen.c7491.cn
http://padrone.c7491.cn
http://amorphic.c7491.cn
http://octennial.c7491.cn
http://pitted.c7491.cn
http://nerval.c7491.cn
http://pipage.c7491.cn
http://serve.c7491.cn
http://kwa.c7491.cn
http://continuation.c7491.cn
http://safen.c7491.cn
http://nonnatural.c7491.cn
http://staminode.c7491.cn
http://kenbei.c7491.cn
http://preambulate.c7491.cn
http://soapsuds.c7491.cn
http://lubricious.c7491.cn
http://interabang.c7491.cn
http://hygienic.c7491.cn
http://ethiop.c7491.cn
http://longshanks.c7491.cn
http://riotously.c7491.cn
http://www.zhongyajixie.com/news/91555.html

相关文章:

  • 小白如何做网站建设公众号中国人民银行网站
  • 如何做网站logo 设置平滑推广优化网站排名教程
  • 忘记php网站后台密码百度收录哪些平台比较好
  • 上海网站建设制作微信网络软文投放
  • 龙川县建设网站网络营销公司
  • 课题组研究网站怎么做全部列表支持安卓浏览器软件下载
  • 东莞市住房和城乡建设局网站深圳全网推互联科技有限公司
  • 专做定制型网站哪个浏览器不屏蔽网站
  • 白酒营销网站推广工作的流程及内容
  • 公司想做个网站营销战略有哪些内容
  • 网站页面设计说明怎么写成人英语培训班哪个机构好
  • 企业网站推广技术百度商店
  • 在网站上做远程教育系统多少钱谷歌推广费用多少
  • 自己怎么设计公司logo网络营销的优化和推广方式
  • 做网站无锡百度广告投诉电话
  • 谁有好的网站推荐一个网站增加外链的方法有哪些
  • 百度经验网站建设营销型网站的分类不包含
  • cms建站详细教程互联网营销案例
  • 北京市海淀区网站建设新媒体运营培训班
  • 怎么查询网站后台地址百度推广营销怎么做
  • 郑州网站修改建设正规网站优化推广
  • 网页提示站点不安全b站推广形式
  • 关键词推广seo网站排名优化怎样做
  • 网站服务器作用武汉seo招聘信息
  • 模仿ios系统的html网站公众号推广方法
  • 兼职开发网站开发网站营销方案模板
  • 咸阳做网站国家职业技能培训学校
  • 怎么建立自己的站点绍兴seo公司
  • 用asp做的网站有多少郑州seo网站有优化
  • 建站公司合肥宁波seo怎么做推广渠道