| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 691 人关注过本帖
标题:哪位大侠帮我做个题目
只看楼主 加入收藏
虾米1号
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-2-29
收藏
 问题点数:0 回复次数:3 
哪位大侠帮我做个题目
Energy Minimization

Many of the problems that arise in early computer vision can be naturally expressed in terms of minimization of an energy function. Typically, researchers need to rely on general-purpose optimization techniques such as simulated annealing, which is extremely slow in practice. Some functions that have a restricted form can be solved efficiently using subtle algorithms. In this problem your task is to write a program to find the minimal value of a special class of energy functions widely used in image processing.

Suppose an image has R rows and C columns. We can assign each of the pixel a number ranging from 1 to R * C depending on its scan-line order. We define n = R * C and the energy function is in the form of

 where
?    j ? N(i) means that the pixel j is in the left, right, top or bottom neighbor of pixel i;
?    the integer pi (0 <= pi <= 255) is the gray level of the pixel i;
?    xi (xi ? {0, 1}) is the assigned label to the pixel i; and
?    the integers v0 and v1 (0 <= v0, v1 <= 255) are the prior estimation of the gray level of the pixels labeled 0 and 1 respectively.

Input Description

Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 10) which is the number of test cases. T test cases follow, each preceded by a single blank line.

The first line of each test case contains four integers R, C (2 <= R, C <= 20), v0 and v1. The following R lines contain C integers each, which are the gray level of the pixels. The proper ranges are shown in the problem description.

Output Description

Results should be directed to standard output. Start each case with “Case #:” on a single line, where # is the case number starting from 1. Two consecutive cases should be separated by a single blank line. No blank line should be produced after the last test case.

For each case, output the minimized energy value in a single line.

Sample Input

3

2 2 24 91
236 224
250 248

3 3 144 194
44 33 24
92 4 227
47 63 35

2 4 111 19
65 86 109 153
115 186 146 112

Sample Output

Case 1:
594

Case 2:
893

Case 3:
230
搜索更多相关主题的帖子: computer restricted techniques expressed naturally 
2008-02-29 19:02
虾米1号
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-2-29
收藏
得分:0 
这个题目少了很多东西,不好意思啊!

Nothing can stop me!
2008-02-29 19:12
xianshizhe111
Rank: 1
等 级:新手上路
帖 子:1451
专家分:0
注 册:2007-12-8
收藏
得分:0 
哇 呀 呀!
2008-02-29 20:01
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
题目也不容易看懂啊,呵呵
2008-02-29 20:04
快速回复:哪位大侠帮我做个题目
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011277 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved