最新评论
Re:SAD匹配产生致密的深度图 梦乍醒 2012-02-11 10:59
谁能解释下这几行代码?谢谢了
[val,id]=sort(imgDiff(y,x,:));
if abs(val(1)-val(2))>10
dispMap(y,x)=id(1);
Re:erlang 入门(1) cutepig 2012-01-19 00:26
- 列表的匹配
15> [A|B]=[1,2,3,4].
[1,2,3,4]
16> A.
1
17> B.
[2,3,4]
18> f().
ok
19> [A,B|C]=[1,2,3,4].
[1,2,3,4]
20> A.
1
21> B.
2
22> C.
[3,4]
23>
-模块
cutepig@ubuntu:~$ cat geometry.erl
-module(geometry).
-export([area/1]).
area({rectangle,Width,Hit}) -> Width*Hit;
area({circle,R}) -> 3.14159*R*R.
cutepig@ubuntu:~$ erl
Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [kernel-poll:false]
Eshell V5.7.2 (abort with ^G)
1> c(geometry).
{ok,geometry}
2> geometry:area({rectangle,10,5}).
50
3> geometry:area({circle,1.4}).
6.157516399999999
- 另一个例子
cutepig@ubuntu:~$ cat shop.erl
-module(shop).
-export([cost/1]).
cost(oranges) -> 5;
cost(newspaper) -> 8;
cost(apples) -> 6.
cutepig@ubuntu:~$ cat shop1.erl
-module(shop1).
-export([total/1]).
total([{What,N}|T]) -> shop:cost(What)*N+total(T);
total([]) -> 0.
cutepig@ubuntu:~$ erl
Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [kernel-poll:false]
Eshell V5.7.2 (abort with ^G)
1> c(shop).
{ok,shop}
2> c(shop1).
{ok,shop1}
3> shop:cost(oranges).
5
4> shop:cost(orangesX).
** exception error: no function clause matching shop:cost(orangesX)
5> shop1:total([{oranges,2},{newspaper,3}]).
34
6>
- 匿名函数
1> Z=fun(X) -> 2*X end.
#Fun<erl_eval.6.13229925>
2> Z(2).
4
3> Double=Z.
#Fun<erl_eval.6.13229925>
4> Double(3).
6
5> Hypot=fun(X,Y) -> math:sqrt(X*X+Y*Y) end.
#Fun<erl_eval.12.113037538>
6> Hypot(3,4).
5.0
7> Hypot(3).
** exception error: interpreted function with arity 2 called with one argument
8> lists:map(Double,[1,2,3,4]).
[2,4,6,8]
9> Even=fun(X) -> (X rem 2)==0 end.
#Fun<erl_eval.6.13229925>
10> Even(2).
true
11> Even(7).
false
12> lists:map(Even,[1,2,3,4,5,6,7,8]).
[false,true,false,true,false,true,false,true]
13> lists:filter(Even,[1,2,3,4,5,6,7,8]).
[2,4,6,8]
多次定义的函数
14> TempConv=fun({c,C}) -> {f, 32+C*9/5};
14> ({f,F}) -> {c, (F-32)*5/9}
14> end.
#Fun<erl_eval.6.13229925>
15> TempConv({c,100}).
{f,212.0}
16> TempConv({f,212}).
{c,100.0}
高阶函数
17> MakeTest=fun(L) -> (fun(X) -> lists:member(X,L) end) end.
#Fun<erl_eval.6.13229925>
18> IsFruit=MakeTest([apple,pear,orange]).
#Fun<erl_eval.6.13229925>
19> IsFruit(apple).
true
20> IsFruit(appleX).
false
自己的for
cutepig@ubuntu:~$ cat lib_misc.
cat: lib_misc.: No such file or directory
cutepig@ubuntu:~$ cat lib_misc.erl
-module(lib_misc).
-export([for/3]).
for(Max,Max,F) -> [F(Max)];
for(I,Max,F) -> [F(I) | for(I+1,Max,F)].
1> c(lib_misc).
{ok,lib_misc}
2> lib_misc:for(1,10,fun(I) -> I end).
[1,2,3,4,5,6,7,8,9,10]
3> lib_misc:for(1,10,fun(I) -> I*I end).
[1,4,9,16,25,36,49,64,81,100]
自己的map和sum
cutepig@ubuntu:~$ cat mylists.erl
-module(mylists).
-export([sum/1]).
-export([map/2]).
sum([H|T]) -> H + sum(T);
sum([]) -> 0.
map(_,[]) -> [];
map(F,[H|T]) -> [F(H) | map(F,T)].
1> c(mylists).
{ok,mylists}
2> mylists:map(fun(X)->2*X end, [1,2,3]).
[2,4,6]
3>
列表解析
1> L=[1,2,3,4].
[1,2,3,4]
2> [2*X || X <- L].
[2,4,6,8]
cutepig@ubuntu:~$ cat mylists.erl
-module(mylists).
-export([sum/1]).
-export([map/2]).
-export([map2/2]).
sum([H|T]) -> H + sum(T);
sum([]) -> 0.
map(_,[]) -> [];
map(F,[H|T]) -> [F(H) | map(F,T)].
map2(F,L) -> [F(X) || X <- L].
1> c(mylists).
{ok,mylists}
2> mylists:map(fun(X) -> X*2 end, [1,2,3]).
[2,4,6]
快速排序
cutepig@ubuntu:~$ cat lib_misc.erl
-module(lib_misc).
-export([for/3]).
-export([qsort/1]).
for(Max,Max,F) -> [F(Max)];
for(I,Max,F) -> [F(I) | for(I+1,Max,F)].
qsort([]) -> [];
qsort([Pivot|T]) -> qsort([X || X <- T, X < Pivot]) ++ [Pivot] ++ qsort([X || X <- T, X >= Pivot]).
1> c(lib_misc).
{ok,lib_misc}
2> lib_misc:qsort([3,2,4,1]).
[1,2,3,4]
http://stackoverflow.com/questions/2544430/python-mechanize-browser-submit-related-problem
mechanize doesn't support Javascript at all. If you absolutely have to run that Javascript, look into Selenium. It offers python bindings to control a real, running browser like Firefox or IE.
example:
http://stackoverflow.com/questions/6369097/http-error-405-500-in-python-mechanize-using-mechanize-auto-login-one-website
username = 'staryin'
password = 'zxy1985'
login_url = 'http://www.autohome.com.cn/tools/hometoplogin.html'
br = Browser()
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open(login_url)
br.select_form(nr = 0)
br['name'] = username
br['pwd'] = password
br.form.action = login_url
br.submit().read()
Re:经典电影list(辛辛苦苦整理的) 寂寞高手. 2011-11-15 17:32
我就搜一下list的用法,
居然搞到电影list。。。
囧啊。。。
Re:WTL教程 xiulin 2011-10-19 09:43
网上关于WTL的文章好像不多,非常感谢您能发布这些资料,但是为什么会在全文打包下载时无法下载并产生404错误呢?
Re:windows7默认字体变回XP经典宋体 lin961022 2011-08-20 00:16
萨达是发生的水电费圣代
Re:windows7默认字体变回XP经典宋体 lin961022 2011-08-20 00:16
阿双方的身份的说法舒服点
Re:经典电影list(辛辛苦苦整理的) 澍可 2011-07-15 14:09
happy accident,想不到搜list竟然搜到了电影
Re:从今开始,好好学习一下算法! 邀月 2011-05-18 10:31
感谢分享!
Re:alg: 首尾相连的珠子 westfly 2011-05-17 09:07
没有明白代码Select的思想,求详细些的解释。
Re: ACM题目推荐(刘汝佳书上出现的一些题目) take it and go 2011-04-23 12:33
黑书上的题目都很经典啊!这么多年也不会忘记
Re:google全程面试题目,顺求安慰。。 编程小学徒 2011-04-02 14:06
这个有难度啊
Re:WTL教程 daxialht 2011-03-27 23:39
不错
Re:windbg cutepig 2011-03-23 20:35
http://www.debuginfo.com/articles/easywindbg.html
# Solving real life problems
* Debugging deadlocks
!locks
~*kpn
* Debugging high CPU utilization
!runaway
~*kpn
* Debugging stack overflow
~*kf;
* Saving dumps
.dump /m c:\myapp.dmp
* Crash dump analysis
cdb -z c:\myapp.dmp -logo out.txt -lines -c "!analyze -v;q"
* Virtual memory analysis
!vadump -v;
!address;
* Searching for symbols
x Module!Symbol
ln 0x77d491c8
* Displaying data structures
dt -b CSymbolInfoPackage
请问你有A Fast Area-Based Stereo Matching Algorithm这篇文章的中文翻译吗
Re:分析vczh的东东(未完成) cutepig 2011-01-06 20:05
@陈梓瀚(vczh)
呀,大名鼎鼎的vczh拜访了呀,还没怎么看呢
MAC 地址: 00-23-CD-8B-D0-97
IP地址: 116.48.50.150 PPPoE
子网掩码: 255.255.255.255
网关: 116.48.50.150
DNS 服务器: 219.76.98.66, 218.102.32.208
上网时间: 0 day 08:23:32
Re:分析vczh的东东(未完成) 陈梓瀚(vczh) 2011-01-01 02:02
我很想知道你分析成什么样子了……
准确的说着不是用CPropertySheet, CPropertyPage实现的标签对话框
Re:C++ Q16: dereferencing fangzhzh 2010-09-16 14:14
[code=cpp]
struct X {
int foo() { return 0; }
} x;
struct Y { static int (X::*p)(); };
int (X::*Y::p)()=&X::foo;
[/code]
codes compiled error.
Re:test boost::fusion cutepig 2010-09-16 12:00
// testBoost.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/fusion/sequence.hpp>
#include <boost/fusion/include/sequence.hpp>
#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/include/map.hpp>
#include <string>
#include <iostream>
#include <boost/fusion/algorithm.hpp>
#include <boost/fusion/include/algorithm.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/include/is_sequence.hpp>
struct print_xml
{
template< typename T > void operator()(T const& x) const
{
print_(x, boost::fusion::traits::is_sequence<T>() );
}
private:
// x is not sequence
template <typename T>
void print_(T const& x, const boost::mpl::false_&) const
{
std::cout
<< '<' << typeid(x).name() << '>'
<< x
<< "\n"
;
}
// x is sequence
template <typename T>
void print_(T const& x, const boost::mpl::true_&) const
{
boost::fusion::for_each(x, print_xml());
}
};
int _tmain(int argc, _TCHAR* argv[])
{
typedef boost::fusion::vector<int, char, std::string> Stuff;
Stuff stuff(1, 'x', "howdy");
boost::fusion::vector<int, char, Stuff> stuff2(2, 'y', stuff);
int i = boost::fusion::at_c<0>(stuff);
char ch = boost::fusion::at_c<1>(stuff);
std::string s = boost::fusion::at_c<2>(stuff);
//boost::fusion::for_each(stuff, print_xml());
print_xml()(stuff2);
return 0;
}
Re:视觉(13)基于SIFT立体匹配的移动机器人自定位 darrylhsiao 2010-07-08 16:51
請問先進,
我看您說明您的思路是
---------------
.找特征:
对上一帧拍摄的左右图像分别计算SIFT特征,保存为L1.key,R1.key。
对当前帧拍摄的左右图像分别计算SIFT特征,保存为L2.key,R2.key。
---------------
但是怎麼會下四次找keypoint? 如果在單張影像中就可以找keypoint, 那思路是? 另外, 你這些程式(命令), 除了siftWin32.exe外, match就是自己寫的啊? 還是在matlab內執行? 可以說明一下keypoint的格式嗎? 也可以說看看*.match的格式嗎?
---------------
>siftWin32.exe 0<L1.pgm 1>L1.key
Finding keypoints
2473 keypoints found.
>siftWin32.exe 0<R1.pgm 1>R1.key
Finding keypoints
2945 keypoints found.
>siftWin32.exe 0<L2.pgm 1>L2.key
Finding keypoints
2712 keypoints found.
>siftWin32.exe 0<R2.pgm 1>R2.key
Finding keypoints
3536 keypoints found.
tolua
http://www.codenix.com/~tolua/#documentation
Re:use bjam cutepig 2010-02-05 18:41
http://67.223.234.84/boost_doc/doc/html/bbv2.html
vs2008编译不了driverStudio里面的代码, 而我下载的winddk又不支持vc6?
VS2008可以支持DDK的。
或者VC+DDK
終於明白code footprint是什麽意思了,還是谷哥信得過。
你计算出来的dc根本就不是dark channel吧?!
我觉得不是,效果根本就不一样,与原文计算出来的dark channel。因为,你没有采用window来做。
期待你的回答。
期待跟你交流。
ddd后者kde界面的kdbg
DDD 或者 insight
都很小巧,ddd就是gdb的图形版
Re:视觉(15)SFM的一个例子 simbaforrest 2009-11-17 19:07
楼主有Yi Ma , Stefano Soatto. An Invitation to 3-D Vision , From Images to Geometric Models
这本书的电子版吗?能否发我一份:
simba.forrest@gmail.com
谢谢啦!
Lets take an example:
Class B {
...
int iMem1;
int iMem2;
}
Class D: public B {
...
int iMem;
}
In this case, sizeof(D) is will also include the size of B. So it will be 12 bytes.
The existence of virtual function(s)
Existence of virtual function(s) will add 4 bytes of virtual table pointer in the class, which will be added to size of class. Again, in this case, if the base class of the class already has virtual function(s) either directly or through its base class, then this additional virtual function won't add anything to the size of the class. Virtual table pointer will be common across the class hierarchy. That is
class Base {
public:
...
virtual void SomeFunction(...);
private:
int iAMem
};
class Derived : public Base {
...
virtual void SomeOtherFunction(...);
private:
int iBMem
};
In the example above, sizeof(Base) will be 8 bytes--that is sizeof(int iAMem) + sizeof(vptr). sizeof(Derived) will be 12 bytes, that is sizeof(int iBMem) + sizeof(Derived). Notice that the existence of virtual functions in class Derived won't add anything more. Now Derived will set the vptr to its own virtual function table.
Compiler being used
In some scenarios, the size of a class object can be compiler specific. Lets take one example:
class BaseClass {
int a;
char c;
};
class DerivedClass : public BaseClass {
char d;
int i;
};
If compiled with the Microsoft C++ compiler, the size of DerivedClass is 16 bytes. If compiled with gcc (either c++ or g++), size of DerivedClass is 12 bytes.
The reason for sizeof(DerivedClass) being 16 bytes in MC++ is that it starts each class with a 4 byte aligned address so that accessing the member of that class will be easy (again, the memory read/write cycle).
Mode of inheritance (virtual inheritance)
In C++, sometimes we have to use virtual inheritance for some reasons. (One classic example is the implementation of final class in C++.) When we use virtual inheritance, there will be the overhead of 4 bytes for a virtual base class pointer in that class.
class ABase{
int iMem;
};
class BBase : public virtual ABase {
int iMem;
};
class CBase : public virtual ABase {
int iMem;
};
class ABCDerived : public BBase, public CBase {
int iMem;
};
And if you check the size of these classes, it will be:
* Size of ABase : 4
* Size of BBase : 12
* Size of CBase : 12
* Size of ABCDerived : 24
Because BBase and CBase are dervied from ABase virtually, they will also have an virtual base pointer. So, 4 bytes will be added to the size of the class (BBase and CBase). That is sizeof ABase + size of int + sizeof Virtual Base pointer.
Size of ABCDerived will be 24 (not 28 = sizeof (BBase + CBase + int member)) because it will maintain only one Virtual Base pointer (Same way of maintaining virtual table pointer).
Determining the Size of a Class Object
By Girish Shetty
There are many factors that decide the size of an object of a class in C++. These factors are:
1. Size of all non-static data members
2. Order of data members
3. Byte alignment or byte padding
4. Size of its immediate base class
5. The existence of virtual function(s) (Dynamic polymorphism using virtual functions).
6. Compiler being used
7. Mode of inheritance (virtual inheritance)
Size of all non-static data members
Only non-static data members will be counted for calculating sizeof class/object.
class A {
private:
float iMem1;
const int iMem2;
static int iMem3;
char iMem4;
};
For an object of class A, the size will be the size of float iMem1 + size of int iMem2 + size of char iMem3. Static members are really not part of the class object. They won't be included in object's layout. <2>Order of data members The order in which one specifies data members also alters the size of the class.
class C {
char c;
int int1;
int int2;
int i;
long l;
short s;
};
The size of this class is 24 bytes. Even though char c will consume only 1 byte, 4 bytes will be allocated for it, and the remaining 3 bytes will be wasted (holes). This is because the next member is an int, which takes 4 bytes. If we don't go to the next (4th) byte for storing this integer member, the memory access/modify cycle for this integer will be 2 read cycles. So the compiler will do this for us, unless we specify some byte padding/packing.
If I re-write the above class in different order, keeping all my data members like below:
class C {
int int1;
int int2;
int i;
long l;
short s;
char c;
};
Now the size of this class is 20 bytes.
In this case, it is storing c, the char, in one of the slots in the hole in the extra four bytes.
Byte alignment or byte padding
As mentioned above, if we specify 1 byte alignment, the size of the class above (class C) will be 19 in both cases.
Size of its immediate base class
The size of a class also includes size of its immediate base class.
Re:编译原理三剑客 cutepig 2009-09-27 00:50
概念:
词法分析 lexical analysis
正则表达式 regular expression
非确定有限自动机 NFA (non-deterministic Finite Automata)
确定有限自动机 DFA
语法分析 syntax analysis, 利用LR等分析方法检查语法是否有问题
上下文无关文法 Context-free grammar
产生式 production
符号symbol
终结符 terminal
非终结符nonterminal
开始符号 start symbol
推导 derivation
最左推导 leftmost derivation
最右推导 rightmost derivation
语法分析树parse tree
二义性的ambiguous
左结合Left binding
递归下降 recursive descending
first集合, follow集合
左递归 Left recursion
LR分析
移近shift (转换goto)
规约reduce
接受 accept
closure(I), goto(I,X) , 项集合
SLR
LALR
语义分析 Semantic Analysis, 检查变量类型/函数参数/返回值
yacc文件结构
%{
...
%}
定义token的不同数据类型
%union {
int iValue; /* integer value */
char sIndex; /* symbol table index */
nodeType *nPtr; /* node pointer */
};
%token <iValue> INTEGER
%token <sIndex> VARIABLE
%token WHILE IF PRINT FOR TO FUNCTION FUNCTION_DECL FUNCTION_CALL FUNCTION_IMPL ARGUMENT_LIST RETURN
下面这个用来通过修改优先级,避免冲突
%nonassoc IFX
%nonassoc ELSE
左结合
%left GE LE EQ NE '>' '<'
%left '+' '-'
%left '*' '/'
%nonassoc UMINUS
文法中项$x的类型
%type <nPtr> stmt expr stmt_list function_call function_impl function_decl argument_list
%%
program:
stmt_list { ex($1); }
| xx
;
错误恢复
Re:Windows上的最佳自由免费软件 oldrev 2009-09-15 09:01
paint.net 不开源了
Re:关于cvpr2009的best paper cutepig 2009-09-10 21:36
[quote]smilingcat:博主如果窗口大小调整一下,效果应该会好一些,论文使用的大小是15*15,博主的可能有点小了,但是我试验了一下,论文方法的确对于这张图片的效果不是很好。另外有一点想请教博主,关于image matting这一步骤,能讲解一下吗?我没有看明白。[/quote]
image matting我没看, 所以也不懂, 囧~~~
Re:关于cvpr2009的best paper cutepig 2009-09-10 21:36
[quote]westlifegc:minfilt2函数的内容呢。[/quote]
@westlifegc
minfilt2在这里
http://www.mathworks.com/matlabcentral/fileexchange/1358
Re:关于cvpr2009的best paper smilingcat 2009-09-10 10:10
博主如果窗口大小调整一下,效果应该会好一些,论文使用的大小是15*15,博主的可能有点小了,但是我试验了一下,论文方法的确对于这张图片的效果不是很好。另外有一点想请教博主,关于image matting这一步骤,能讲解一下吗?我没有看明白。
Re:关于cvpr2009的best paper westlifegc 2009-09-10 10:01
minfilt2函数的内容呢。
Re:一个vc的watch窗口的实现代码 cutepig 2009-08-22 08:36
分析
画每一行,包括画左边那个可以点的+号, 中间那个垂直分割线
LONG CPropTreeItem::DrawItem(CDC* pDC, const RECT& rc, LONG x, LONG y)
点击+号变鼠标光标 (那个垂直分割线地实现也是这样)
BOOL CPropTreeList::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
点击+号可以expand列表 (那个垂直分割线地实现也是这样)
void CPropTreeList::OnLButtonDown(UINT, CPoint point)
这里根据点击的位置,有几种可能
HTCOLUMN 拖动垂直分割线
HTCHECKBOX点击左边column的check box
HTEXPAND点击左边的那个+号
HTATTRIBUTE: 一般是点击右边的自定义控件区域
HTLABEL ??
HTCLIENT
几个类的关系
实现自己的自定义类
Re:把接口和实现分开的方法 稻草人 2009-08-21 14:45
C++啊,以为是C#呢!
Re:围城 jivi 2009-08-06 22:57
博客园里也谈文学?不过说的是不错的
Re:javascript画图函数库jsgraphics 温景良(Jason) 2009-08-06 21:41
up
Re:终于成功仿了一次Kalman滤波器 cutepig 2009-08-06 20:51
@阿熊
仔细看了看,是我写的错了~
Re:终于成功仿了一次Kalman滤波器 阿熊 2009-08-06 16:35
你好, 我认为你程序for循环中的:[Xp,P]=Correct(P,H,R,X,z_m);
应该改为:[Xp,P]=Correct(P,H,R,Xp,z_m);
改了后效果不如你的贴图。根据相关文献以及上面的程序实例,修改后的才是正确的吧。请大家讨论讨论我说的是否正确!
Re:百度笔试面试 永永 2009-07-29 01:11
Java 程序员面试论坛
http://www.222345.net
Arnodi可能是比较合适的..但是没有挖掘稀疏性
@SmartPtr
那该怎样在文件开始定义泛化版本呢?
请明士,3ks。