当用cout 或者 printf()对char 或者 unsigned char类型数据进行输出的时候,默认输出的都是字符,而不是字符对应的数值。如果要输出数值,必须做int 类型数据的强制转换。

例如:

cout<< imgInput.at<uchar>(i,j)<<",";

其中imgInput为Mat类型的图像数据。其输出为:

当输出语句改为:

cout<<(int) imgInput.at<uchar>(i,j)<<",";

输出为:

 

关于Char类型数据做cout输出的更多相关文章

  1. 整型变量修饰符,char类型数据存储原理,字节数,

    //------------------整型变量修饰符 修饰符(int short long longlong signed unsigned)所有修饰符都是用来修整形 int 4short %hd ...

  2. hbase中double类型数据做累加

    public static Result incr(String tableFullName, String rowKey, String family, String qualifier, long ...

  3. oracle问题:char类型数据查询不到

    select distinct id,name from test_table b where b.ID='001' ; id为char字段类型,使用该语句查询不出数据. 解决方法:加trim().改 ...

  4. 实验五:任意输入10个int类型数据,排序输出,并找出素数

    源代码: package 数组;import java.util.*;public class vvv { public static void main(String[] args) { Scann ...

  5. 在C语言中,double、long、unsigned、int、char类型数据所占字节数

    和机器字长及编译器有关系: 所以,int,long int,short int的宽度都可能随编译器而异.但有几条铁定的原则(ANSI/ISO制订的): 1 sizeof(short int)<= ...

  6. 实验五:任意输入10个int类型数据,排序输出,再找出素数

    一.程序编写 import java.util.*;public class Port {  public static void main(String[] args) {  // TODO 自动生 ...

  7. 1.1两个char类型数据相加后,转化为int类型

    #include<stdio.h> main() { char a = 127; char i=0; char ai=0; ai= a+i; printf("size short ...

  8. 【c++基础】二进制格式输出char类型

    前言 使用CAN通信时将信号转换为char类型进行传输,要查看传输的信息是否正确需要将char类型数据以二进制格式输出: code #include <iostream> int main ...

  9. char类型输出地址

    问题描述: 当输出char的地址时,发现输出的是一个字符: char ch = 'a'; cout<<&ch<<endl;//a @ 因为cout得到一个char类型的 ...

随机推荐

  1. 关闭window 8.1 的skydrive

    gpedit.msc-->计算机配置-->管理模板-->windows组件 -->skydrive-->阻止使用skydrive执行文件存储

  2. 4.kvm克隆虚拟机

    virt-clone 作用简介 virt-clone 主要是用来克隆kvm虚拟机,并且通过 Options.General Option.Storage Configuration.Networkin ...

  3. 【linux】linux下运行java程序

    参考了http://www.cnblogs.com/howard-queen/archive/2012/01/30/2331795.html 第一步:用vim先写一个java程序  first.jav ...

  4. NIS 报错No such map passwd.byname. Reason: Can't bind to server which serves this domain

    在NIS—client端使用命令:ypcat passwd ,把错如上题, 原因:client端ypbind服务未启动解决方法:当然是启动ypbind了,命令:service ypbind start ...

  5. rsync使用

    1)拷贝本地文件.当SRC和DES路径信息都不包含有单个冒号":"分隔符时就启动这种工作模式.     如:rsync -a  ./test.c  /backup 2)使用一个远程 ...

  6. UISearchController Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior

    Attempting to load the view of a view controller while it is deallocating is not allowed and may res ...

  7. [Android Pro] adb 进入 recovery, adb 进入 bootloader

    reference to : http://blog.csdn.net/mldxs/article/details/18699965 重启到Recovery界面 adb reboot recovery ...

  8. 安装Birt方法

    安装BIRT 方法: 博客地址:http://www.mamicode.com/info-detail-850588.html 注意:在 Install new Software 中输入地址:http ...

  9. hdu 5653 Bomber Man wants to bomb an Array

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5653 题意:已知炸弹可以炸掉左边L个位置,右边R个位置,那么炸点炸掉的总数是L+R+1.给定每个炸弹的 ...

  10. Maven+druid+MyBatis+Spring+Oracle+Dubbo开发环境搭建

    1.开发工具使用: MyEclipse或Eclipse,数据库使用Oracle.需要用到的软件有Zookeeper(注册中心),Tomcat(Web容器)和Maven(包管理). 2.初始环境配置: ...