Author Archives: fli10
FLTK is fantastic
FLTK has many very cool demos under the /test directory. I realy like it.
Dynamic Storage
http://www.cs.jcu.edu.au/Subjects/cp2003/1997/foils/heapAndStack/heapAndStack.html
These lecture notes are based on chapter 3 in “Programming Language Concepts and Paradigms” by David Watt.
…..
difference between stack & heap (general, for a newbie)
Sean Cook wrote:
>
> Andrey (and others),
>
> What I should’ve asked is "what is the scope of data when allocated
> from the heap, and what is the scope of data when allocated from the
> stack (where “heap” and “stack” are not standards, but are merely
> common terms.)
Now we are getting somewhere
The scope of memory allocated on the ‘stack’ is the scope
of the enclosing block. They get destroyed when the enclosing
block is finished. Thats why they are called ‘auto’ objects.
Example:
{
int i;
} // block ends, i gets destroyed
The scope of memory allocated on the ‘heap’ is different. Objects
get allocated with new (or malloc) and get destroyed when a corresponding
delete (or free) is executed. Blocks do no longer influence the scope of
these objects.
Example:
int* pJ;
{
int* pI = new int [20];
// Note that 2 things are happening here:
// 1.) An int array is allocated on the free store (aka heap).
// This array will be there until a corresponding delete [] is
// executed
// 2.) A variable pI is created. Since pI was not dynamically created
// with new or malloc, it is an auto object (created on the stack)
// Thus the enclosing block determines its lifetime
pJ = pI;
} // block ends. pI gets destroyed, but not so the int array. It
// will stay there in memory until a delete is done.
delete [] pJ; // now the memory in the free store (aka heap) gets
// released.
>
> And also, is there a performance difference, in general, of objects
> allocated on the stack versus those allocated on the heap, or is this
> a completely meaningless question?
Free store allocation usually takes more time
—
Karl Heinz Buchegger
FLTK
看了一天的KDE+QT还是找不到北,虽然也尝试了一个例子,Qt designer 和 KDevelop也都还很好用,但还是觉得比较难上手,进展比较慢。中午终于第2次放弃了Qt,下午开始看FLTK。希望以后的程序都用fltk来写,下面是FLTK的简单配置。
1. C/C++
a. code generation, change runtime library to Multi-threaded DLL
b. Command Line. /Ic:\fltk-1.1.4
c. precompiled header, turn off.
2. Linker
a. Command Line. c:\fltk-1.1.4\lib\fltk.lib wsock32.lib comctl32.lib
很不错的FLTK tutorial;
FLTK Video Tutorials—-http://seriss.com/people/erco/fltk-videos/
Beginner FLTK Tutorial — http://www3.telus.net/public/robark/
一个样本程序:
#include <FL/fl.h>
#include <FL/fl_window.h>
int main()
{
Fl_Window win(720, 486);
win.show();
return Fl::run();
}
Vision的project
vision的最后一个project做的是marc pollefyes的polar rectification. 做的时候比一开始想象的要稍微复杂一些,花了挺长时间的,但效果还是挺好的。
float与double的精度
发现float与double的精度是依赖于平台的,与具体的硬件有关。在laptop算一个float数是34.xx,在workstation上就只是0.02xxx,正确的值应该是0。看来转成double还是保险些,不过郁闷的是输入数据都是float型的。
float: 4字节 6-7位有效数字 -3.4E-38 到 3.4E38
double: 8字节 15~16位有效数字 -1.7E-308 到 1.7E308
Solving for null space
•to solve Ax = 0:
1.compute SVD of A = U D V^t
2.if null space is 1d, x = last column of V (called null vector)
3.in general, last d columns of V span the d-dimensional null space
http://www.cis.uab.edu/jj/sfm/lecture5-conic+thedualconic+metricRectification.ppt
LEGO® MINDSTORMS® NXT
http://shop.lego.com/product/?p=8527&LangId=2057&ShipTo=US
以前见到过Lego这个名字,但没有在意过。今天神奇的发现别人做的vision的作业是在lego robot上做得。他们自己搭了个lego robot,然后在这个robot装载了两个web camera。然后自己写code,通过stereo image来计算depth map提供给这个robot做导航信息,效果还是很神奇的。这一个vision的project应该是融合了AI、Vision等学科,很有意思。所以说,老美也不只是会玩,玩也能玩出奇特的东西。