How do I get the lowest value of all the non zero value pixels?

问题就是题目:如何从图像中获得非零的最小值。

优质解答:

You can use mask :

You can use mask :
 
    Mat im ;
    ], maxc[];

    minMaxLoc(im, minc, maxc,NULL,NULL,mask);
    cout];

要点:

1、Mat mask = im>0;
这段代码的含义是所有im中大于0的地方在mask中为255,其他地方为0,很精炼;
2、 minMaxLoc(im, minc, maxc,NULL,NULL,mask);
最后一个参数的意思是过滤掉那些不需要的地方(mask中为255的地方)
 
所以合起来以后,代码就很好理解:
1、首先获得所有>0地方;
2、然后除去这些地方进行过滤。
HICEWORK!

How do I get the lowest value of all the non zero value pixels?的更多相关文章

  1. http://www.gasi.ch/blog/inside-deep-zoom-2/

    Inside Deep Zoom – Part II: Mathematical Analysis Welcome to part two of Inside Deep Zoom. In part o ...

  2. [LeetCode] Lowest Common Ancestor of a Binary Tree 二叉树的最小共同父节点

    Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According ...

  3. [LeetCode] Lowest Common Ancestor of a Binary Search Tree 二叉搜索树的最小共同父节点

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

  4. 48. 二叉树两结点的最低共同父结点(3种变种情况)[Get lowest common ancestor of binary tree]

    [题目] 输入二叉树中的两个结点,输出这两个结点在数中最低的共同父结点. 二叉树的结点定义如下:  C++ Code  123456   struct BinaryTreeNode {     int ...

  5. [LeetCode]Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

  6. 数据结构与算法(1)支线任务4——Lowest Common Ancestor of a Binary Tree

    题目如下:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ Given a binary tree, fin ...

  7. Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

  8. Lowest Common Ancestor of a Binary Tree

    Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According ...

  9. leetcode 235. Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

随机推荐

  1. IOS开发-OC学习-kvc,kvo

    kvc是用来方便的设置实例的属性值的,比如person类的实例p1有一个name的属性,那么我们可以通过kvc去设置p1的name,语法是: [ 对象 setValue:@"xiaming& ...

  2. 键盘上下键时间 js

    ocument.onkeydown=function(event){ var e = event || window.event || arguments.callee.caller.argument ...

  3. SpringMVC拦截器和过滤器

  4. UVa 10551 - Basic Remains

    题目大意:关于大数的mod和进制转换,直接使用Java的BigInteger类,正在copy式学习中... import java.io.*; import java.util.*; import j ...

  5. setTimeout,setInterval 最短触发时间

    <!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...

  6. jQuery仿淘宝图片无缝滚动轮播

    自己前天,也就是1月8日的时候早上自己写了一个图片滚动轮播(基于jQuery). 其实几个月以前就有朋友问过我怎么做出和淘宝上面一样的滚动轮播,一直到现在也没有真正的写好,这次写得差不多了. 但是还有 ...

  7. osgEarth学习笔记(转载)

    osgEarth学习笔记1.        通过earth文件创建图层时,可以指定多个影像数据源和多个高程数据源,数据源的顺序决定渲染顺序,在earth文件中处于最前的在渲染时处于最底层渲染:所以如果 ...

  8. 关于网页显示乱码问题的一些个人见解(PHP、JSP...)

    最近做项目,遇到了一些网页显示乱码的情况,在网上查了很多资料都没有给一个全面的准确的答案,自己摸索了一下经过对比开发环境(我使用的是Myeclipse)编辑器的编码和浏览器默认显示的编码发现,在字符编 ...

  9. LVS 负载均衡解决方案 (windows IIS)

    LVS 负载均衡解决方案 因为我们的产品运行的主流平台是WINDOWS+IIS+SQLSERVER(2000以上版本),而LVS+KEEPALIVED是LINUX下的四层负载均衡软件.其有如下特点: ...

  10. Sql server2014 内存优化表 本地编译存储过程

    参考文献:http://www.infoq.com/cn/news/2013/09/Compiled-Queries http://www.bianceng.cn/database/SQLServer ...