您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uchar函数代码示例

51自学网 2021-06-03 09:05:13
  C++
这篇教程C++ uchar函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中uchar函数的典型用法代码示例。如果您正苦于以下问题:C++ uchar函数的具体用法?C++ uchar怎么用?C++ uchar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了uchar函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: add_s

static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,                                                   const char *e) {  size_t l, i;  const char *news = lua_tolstring(ms->L, 3, &l);  for (i = 0; i < l; i++) {    if (news[i] != L_ESC)      luaL_addchar(b, news[i]);    else {      i++;  /* skip ESC */      if (news[i] == '/0')        luaL_error(ms->L, "malformed replacement string (ends with " LUA_QL("%%") ")");      if (!isdigit(uchar(news[i])))        luaL_addchar(b, news[i]);      else if (news[i] == '0')          luaL_addlstring(b, s, e - s);      else {        push_onecapture(ms, news[i] - '1', s, e);        luaL_addvalue(b);  /* add capture to accumulated result */      }    }  }}
开发者ID:whoopdedo,项目名称:lgscript,代码行数:22,


示例2: qDebug

void QLCInputSource::run(){    qDebug() << Q_FUNC_INFO << "Thread started for universe" << m_universe << "channel" << m_channel;    uchar inputValueCopy = m_inputValue;    double dValue = m_outputValue;    uchar lastOutputValue = m_outputValue;    bool movementOn = false;    while (m_running == true)    {        msleep(50);        QMutexLocker locker(&m_mutex);        if (lastOutputValue != m_outputValue)            dValue = m_outputValue;        if (inputValueCopy != m_inputValue || movementOn == true)        {            movementOn = false;            inputValueCopy = m_inputValue;            double moveAmount = 127 - inputValueCopy;            if (moveAmount != 0)            {                dValue -= (moveAmount / m_sensitivity);                dValue = CLAMP(dValue, 0, 255);                uchar newDmxValue = uchar(dValue);                qDebug() << "double value:" << dValue << "uchar val:" << newDmxValue;                if (newDmxValue != m_outputValue)                    emit inputValueChanged(m_universe, m_channel, newDmxValue);                movementOn = true;            }            lastOutputValue = m_outputValue;        }    }}
开发者ID:mattharris,项目名称:qlcplus,代码行数:39,


示例3: it

void MonitorFixture::updateValues(const QByteArray& ua){    QLabel* label;    uchar value;    Fixture* fxi;    QString str;    int i = 0;    /* Check that this MonitorFixture represents a fixture */    if (m_fixture == Fixture::invalidId())        return;    /* Check that this MonitorFixture's fixture really exists */    fxi = m_doc->fixture(m_fixture);    if (fxi == NULL)        return;    QListIterator <QLabel*> it(m_valueLabels);    while (it.hasNext() == true)    {        label = it.next();        Q_ASSERT(label != NULL);        value = uchar(ua.at(fxi->universeAddress() + i));        i++;        /* Set the label's text to reflect the changed value */        if (m_valueStyle == Monitor::DMXValues)        {            label->setText(str.sprintf("%.3d", value));        }        else        {            label->setText(str.sprintf("%.3d", int(ceil(SCALE(qreal(value),                                                              qreal(0), qreal(UCHAR_MAX),                                                              qreal(0), qreal(100))))));        }    }}
开发者ID:OnceBe,项目名称:qlcplus,代码行数:39,


示例4: samples

cv::Mat CMyImageProc::GenColorTexton_kmeans(cv::Mat &img, int clusterCount ){	if(img.channels() != 3) {		cout<<"Only color images are supported!"<<endl;		return cv::Mat();	}	cv::Mat samples(img.rows*img.cols, 3, CV_32F);	cv::Mat centers, labels;	int p = 0;	for(int i=0; i<img.rows; i++) {		for(int j=0; j<img.cols; j++, p++) {			cv::Vec3b &pf = img.at<cv::Vec3b>(i, j);			// You can now access the pixel value with cv::Vec3b			float b = (float)pf[0];			float g = (float)pf[1];			float r = (float)pf[2];			samples.at<float>(p, 0) = r;			samples.at<float>(p, 1) = g;			samples.at<float>(p, 2) = b;		}	}	int attempts = 5;	cv::kmeans(samples, clusterCount, labels, TermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 10, 1.0), attempts, KMEANS_PP_CENTERS, centers);	cv:: Mat textonImg(img.rows, img.cols, CV_8UC1, Scalar(uchar(0)));	for(int k=0, i=0; i<img.rows; i++) {		for(int j=0; j<img.cols; j++, k++) {			int l = labels.at<int>(k,0);			double f_l = l / (double)clusterCount;			textonImg.at<uchar>(i,j) = (uchar) (int (f_l*255.0+0.5));		}	}	return textonImg;}
开发者ID:netbeen,项目名称:UncleZhou_UI,代码行数:38,


示例5: split

//----------------------------------------------------------------------// change value of virtual register "BANK" and switch to another bankstatic void split(int reg, sel_t v){    if ( reg == -1 )    {        flow = 0;        if ( v != BADSEL )        {            sel_t pclath = getSR(cmd.ea, PCLATH) & 0x1F;            ea_t ea = calc_code_mem(uchar(v) | (pclath<<8));            ua_add_cref(0, ea, fl_JN);        }    }    else    {        if ( v == BADSEL ) v = 0;     // assume bank0 if bank is unknown        if ( reg == BANK )        {            if ( ptype != PIC16 ) v &= 3;            else v &= 0xF;        }        splitSRarea1(get_item_end(cmd.ea), reg, v, SR_auto);    }}
开发者ID:nealey,项目名称:vera,代码行数:25,


示例6: uchar

QString andrq::getString(QDataStream &in, int key){	qint32 len;	in >> len;	char *data = (char *)qMalloc(len);	in.readRawData(data, len);	int dh = 0, dl = 0;	int temp = key;	dl |= temp & 0x000000FF;	temp >>= 20;	dh |= temp & 0x000000FF;/*	if (!ans)		return false;*/	int ah = 184; //10111000b;	for (int i = 0; i < len; ++i)	{		int al = uchar(data[i]);		al ^= ah;		al=(al%32)*8+al/32;	//циклический сдвиг al на 3 бита влево		al ^= dh;		al -= dl;		data[i] = char(al);		ah=(ah%8)*32+ah/8;	//циклический сдвиг ah вправо на 3 бита	}	static QTextCodec *ansii_codec = QTextCodec::codecForName("cp1251");	static QTextCodec *utf8_codec = QTextCodec::codecForName("utf-8");	QTextCodec *codec = isValidUtf8(QByteArray::fromRawData(data, len)) ? utf8_codec : ansii_codec;	QString result = codec->toUnicode(data, len);	qFree(data);	return result;}
开发者ID:veksha,项目名称:vekshas-qutim-plugins,代码行数:37,


示例7: qt_prettyDebug

/*    Returns a human readable representation of the first /a len    characters in /a data.*/static QByteArray qt_prettyDebug(const char *data, int len, int maxLength){    if (!data) return "(null)";    QByteArray out;    for (int i = 0; i < len; ++i) {        char c = data[i];        if (isprint(int(uchar(c)))) {            out += c;        } else switch (c) {        case '/n': out += "//n"; break;        case '/r': out += "//r"; break;        case '/t': out += "//t"; break;        default:            QString tmp;            tmp.sprintf("//%o", c);            out += tmp.toLatin1().constData();        }    }    if (len < maxLength)        out += "...";    return out;}
开发者ID:13W,项目名称:phantomjs,代码行数:28,


示例8: mac_arg

// Implements /newcolumntype{C}[opt]{body}// as /newcommand/cmd[opt]{body}// Here /cmd is some internal name, stored in nct_tok[C]void Parser::T_newcolumn_type(){  TokenList L = mac_arg();  uint c = 0;   if(L.empty()) parse_error("Empty argument to //newcolumntype");  else if(L.size() != 1)    parse_error("More than one token in argument to //newcolumntype");  else {    if(L.front().is_a_char())      c = L.front().char_val().get_value();    if(!(c>0 && c<nb_newcolumn)) {      parse_error("Argument to //newcolumntype is not a 7bit character");      c= 0;    }  }  Buffer& B = hash_table.my_buffer();  B.reset();  B.push_back("[email
C++ uclass_get_device函数代码示例
C++ ucb1400_reg_write函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。