C#,图像二值化(08)——全局阈值优化算法及其源代码

news2024/9/29 23:24:42

1、全局阈值算法

基于灰度直方图的优化迭代算法之一。

Iterative Scheduler and Modified Iterative Water-Filling
In the downlink, the inter-cell interference is only function of the power levels and is independent of the user scheduling decisions. This suggests that the user scheduling and the power allocation can be carried out separately. An iterative scheduler can be derived so that the best user to schedule are first found assuming a fixed power allocation, then the best power allocation are computed for the fixed scheduled users [VPW09, YKS10]. If the iteration always increases the objective function monotonically, one can guarantee the convergence of the scheduler to at least a local optimum.

2、全局阈值算法的源程序

using System;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;

namespace Legalsoft.Truffer.ImageTools
{
    public static partial class BinarizationHelper
    {

        #region 灰度图像二值化 全局算法 全局阈值算法

        /// <summary>
        /// 基本全局阈值法
        /// https://blog.csdn.net/xw20084898/article/details/17564957
        /// </summary>
        /// <param name="histogram"></param>
        /// <returns></returns>
        private static int Basic_Global_Threshold(int[] histogram)
        {
            double t = Histogram_Sum(histogram);
            double u = Histogram_Sum(histogram, 1);
            int k2 = (int)(u / t);

            int k1;
            do
            {
                k1 = k2;
                double t1 = 0;
                double u1 = 0;
                for (int i = 0; i <= k1; i++)
                {
                    t1 += histogram[i];
                    u1 += i * histogram[i];
                }
                int t2 = (int)(t - t1);
                double u2 = u - u1;
                if (t1 != 0)
                {
                    u1 = u1 / t1;
                }
                else
                {
                    u1 = 0;
                }
                if (t2 != 0)
                {
                    u2 = u2 / t2;
                }
                else
                {
                    u2 = 0;
                }
                k2 = (int)((u1 + u2) / 2);
            } while (k1 != k2);

            return (k1);
        }

        public static void Global_Threshold_Algorithm(byte[,] data)
        {
            int[] histogram = Gray_Histogram(data);
            int threshold = Basic_Global_Threshold(histogram);
            Threshold_Algorithm(data, threshold);
        }

        #endregion

    }
}

3、全局阈值算法的计算效果

The thematic series Iterative Methods and Optimization Algorithms is devoted to the latest achievements in the field of iterative methods and optimization theory for single-valued and multi-valued mappings. The series is related to the significant contributions in these fields of Professor Hong-Kun Xu, as well as to some important recent advances in theory, computation, and applications.

In this chapter we focus on general approach to optimization for multivariate functions. In the previous chapter, we have seen three different variants of gradient descent methods, namely, batch gradient descent, stochastic gradient descent, and mini-batch gradient descent. One of these methods is chosen depending on the amount of data and a trade-off between the accuracy of the parameter estimation and the amount time it takes to perform the estimation. We have noted earlier that the mini-batch gradient descent strikes a balance between the other two methods and hence commonly used in practice. However, this method comes with few challenges that need to be addressed. We also focus on these issues in this chapter.

Learning outcomes from this chapter:
Several first-order optimization methods
Basic second-order optimization methods

This chapter closely follows chapters 4 and 5 of (Kochenderfer and Wheeler 2019). There are many interesting textbooks on optimization, including (Boyd and Vandenberghe 2004), (Sundaram 1996), and (Nesterov 2004),

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/128788.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【全网最细PAT题解】【PAT乙】1005 继续(3n+1)猜想(map和vector的运用)

题目链接 1005 继续(3n1)猜想 题目描述 1005 继续(3n1)猜想 分数 25 作者 CHEN, Yue 单位 浙江大学 卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里&#xff0c;情况稍微有些复杂。当我们验证卡拉兹猜想的时候&#xff0c;为了避免重复计算&#xff0c;可以记录下递…

Linux网络收包过程

一、Linux 网络收包总览 在 TCP / IP 网络分层模型里&#xff0c;整个协议栈被分成了物理层、链路层、网络层&#xff0c;传输层和应用层。物理层对应的是网卡和网线&#xff0c;应用层对应的是我们常见的 Nginx&#xff0c;FTP 等等各种应用。Linux 实现的是链路层、网络层和…

scaner从外网到内网域渗透笔记

scaner 从外网到内网域渗透 1.环境配置 1.1靶场信息 用到的虚拟机共有三个 分别是 12server-db 、12-dc 、web1 12server-db、web1 这两个可以使用桥接或者nat模式根据需求可以设置 网卡1 12-dc用的是VMnet 19 这台机子已经绑定ip 主机名ip账号和密码web1192.168.0.160we…

工具(三):Jmeter压测数据在Grafana展示

Docker 安装 InfluxDBJMeter 配置 InfluxDB数据源Grafana 配置influxdb数据源 Docker 安装 InfluxDB docker pull influxdb:1.8.6 # 拉取influxdb镜像docker run -d -p 8086:8086 --namejmeterdb influxdb:1.8.6 # 启动influxdb&#xff0c;并命名为jmeterdbdocker exec -it …

使用Canvas实现封装路径,添加颜色,实现渐变,3d特效

目录 1.封装路径 2.添加颜色 3.渐变特效 3.1线性渐变 3.2径向渐变 3.3径向渐变模拟3d球 图形我们已经会绘制了&#xff0c;但是单一的图形肯定不好看&#xff0c;就像html没了css一样&#xff0c;所以今天我们要把图形上色。 1.封装路径 new Path2D()进行封装&#x…

NAPI简介

NAPI简介 它的核心概念就是不采用中断的方式读取数据&#xff0c;而代之以首先采用中断唤醒数据接收的服务程序&#xff0c;然后 POLL 的方法来轮询数据。NAPI是综合中断方式与轮询方式的技术。 中断的好处是响应及时&#xff0c;如果数据量较小&#xff0c;则不会占用太多的…

百度发布Apollo 8.0,架构、能力双双升级

12月28日&#xff0c;百度举行了Apollo开放平台8.0线上发布会。会上&#xff0c;百度正式推出Apollo开放平台8.0&#xff0c;进一步夯实了平台的易用性&#xff0c;让开发者操作更简单易上手。同时&#xff0c;百度Apollo也面向外界分享了在自动驾驶教育、生态合作伙伴等方面的…

SuperMap GIS基础软件中数据库使用指南

作者&#xff1a;Carlo 一、支持的主流数据库类型 1、主流数据库介绍 数据库名称版本不支持的数据集类型需要配置 客户端支持工作空间支持集群模式SQLPlus2008/2012/2016/2018&#xff08;仅 Windows 平台支持&#xff09;视频、复合点、复合线、复合面、复合文本数据集是是是…

球王贝利去世终年 82 岁,其是世界上唯一三次夺取世界杯冠军的足球运动员,如何评价他的传奇一生?

当地时间12月29日&#xff0c;巴西圣保罗市阿尔伯特爱因斯坦医院发布公告称&#xff0c;巴西知名运动员、“球王”贝利因结肠癌引发多器官衰竭&#xff0c;于当天15时27分去世&#xff0c;终年82岁。贝利女儿凯丽纳西门托在社交媒体发文&#xff1a;“我们的一切都归功于你&…

VR餐厅全新思路,可以为餐饮行业带来哪些好处?

餐饮行业的寒冬即将过去&#xff0c;逐渐迎来了发展的好机会&#xff0c;趁此机遇你会怎么做呢&#xff1f;餐饮行业的竞争依旧激烈&#xff0c;也许你的餐厅占据了很好的地理位置&#xff0c;或者是拥有时尚有品位的装修风格&#xff0c;亦或者拥有美味可口的菜品&#xff0c;…

报表开发工具FastReport.NET的五大常见问题及解决方法

Fastreport是目前世界上主流的图表控件&#xff0c;具有超高性价比&#xff0c;以更具成本优势的价格&#xff0c;便能提供功能齐全的报表解决方案&#xff0c;连续三年蝉联全球文档创建组件和库的“ Top 50 Publishers”奖。 FastReport.NET官方版下载&#xff08;qun&#x…

黑马Hive+Spark离线数仓工业项目--数仓主题应用层ST层构建(1)

数仓主题应用层ST层构建 1. 构建ST层&#xff1a;数据应用层 掌握每个主题的聚合指标和聚合的维度 - 工单主题 - 油站主题 - 回访主题 - 安装主题 - 费用主题2. DM层的设计 - 运营部门需要的数据抽取 数仓分层回顾 目标&#xff1a;回顾一站制造项目分层设…

使用命令设置Windows音量和音频输出设备

前言 Windows似乎并没有音量设置的命令&#xff0c;也没有输出设备的设置命令。如果你知道&#xff0c;请告诉我一下~ 因此&#xff0c;这里使用了一个神级小工具&#xff1a;nircmd 官网下载地址&#xff1a; 32位&#xff1a;http://www.nirsoft.net/utils/nircmd.zip 64…

2023年网络安全工程师面试题合集【首发】

以下为信息安全各个方向涉及的面试题&#xff0c;星数越多代表问题出现的几率越大&#xff0c;祝各位都能找到满意的工作~ 【一一帮助安全学习【点我】一一】①网络安全学习路线②20 份渗透测试电子书③安全攻防 357 页笔记④50 份安全攻防面试指南⑤安全红队渗透工具包⑥网络安…

Mathorcup数学建模竞赛第五届-【妈妈杯】D题:图像去噪中几类稀疏变换的矩阵表示(附一等奖获奖论文和matlab代码实现)

赛题描述 假设一幅二维灰度图像 X 受到加性噪声的干扰:Y=X+N ,Y 为观察到的噪声图像, N 为噪声。通过对于图像 Y 进行稀疏表示可以达到去除噪声的目的。任务: 2. 利用 Cameraman 图像中的一个小图像块(见图 1)进行验证。 3. 分析稀疏系数矩阵,比较四种方法的硬阈值稀…

类和对象(中)

原文再续&#xff0c;书接上回&#xff01;&#xff01; 继续类和对象的学习。 目录 构造函数 析构函数 拷贝构造 赋值重载 运算符重载 const成员 取地址及const取地址操作符重载 当我们没有向类中写入任何成员的时候&#xff08;也就是空类&#xff09;&#xff0c;类中…

【每日一题Day72】LC855考场就座 | 构造数据结构 动态数组+二分查找

考场就座【LC855】 There is an exam room with n seats in a single row labeled from 0 to n - 1. When a student enters the room, they must sit in the seat that maximizes the distance to the closest person. If there are multiple such seats, they sit in the sea…

宝藏又小众的东方行走rpg制作大师素材网站分享

看到大家都在问东方行走rpg制作大师素材&#xff0c;既要免费又要质量好&#xff0c;数量还要多&#xff0c;小编好不容易挖到了宝藏素材网站哦&#xff0c;资源优质数量庞大&#xff0c;使用体验也很好&#xff0c;要是需要的话&#xff0c;赶紧看一看&#xff0c;小编会给大家…

深潜价值互联网蓝海,2022中国区块链产业发展报告发布|陀螺研究院年终献礼...

2022年&#xff0c;是全球发展史上重要的一年&#xff0c;在俄乌冲突以及全球通胀的大背景下&#xff0c;全球经济环境风高浪急、风云诡谲&#xff0c;数字经济正以前所未有的速度冲击着世界固有格局&#xff0c;并成为撬动全球经济复苏和快速增长的新杠杆。围绕数字经济的科技…

软考在哪可以报名?

软考每年有两次考试&#xff0c;分别安排在上半年和下半年&#xff0c;上半年考试时间为5月下旬&#xff0c;下半年考试时间为11月上旬&#xff0c;每年考试时间并不是固定的。 2023年软考考试时间 根据往年软考时间安排来看&#xff0c;预计2023年软考考试时间上半年在5月中…