分享我自己用C++写的GVF snake

crond123 2009-03-20 08:03:06
使用VC++和OpenCV写的GVF snake程序,大部分代码与chengyang xu 的matlab代码等价,不同之处在于轮廓点插值和力场插值,我实现得比较精简,希望对搞Snake的朋友有所帮助.

下载地址:http://download.csdn.net/source/1099993
...全文
681 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
dianwei_wang 2011-07-29
  • 打赏
  • 举报
回复
下载下来看看!
fishndsc 2011-07-20
  • 打赏
  • 举报
回复
下下来看看
xjqhdx 2011-03-29
  • 打赏
  • 举报
回复
先下载下来看看哈。。
wmyming01 2010-12-08
  • 打赏
  • 举报
回复
这些库怎么不一起发?cv.h什么的
burningneutron 2009-06-16
  • 打赏
  • 举报
回复
感谢分享.
请问有没有跟matlab的结果做过定量的对比?
谢谢
libin009 2009-05-26
  • 打赏
  • 举报
回复
好东西!|
liukaihua_168 2009-05-25
  • 打赏
  • 举报
回复
本人确实是初学者,下下来看看啦
实达诚实 2009-04-14
  • 打赏
  • 举报
回复
mark
crond123 2009-03-20
  • 打赏
  • 举报
回复
#include <windows.h>

LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM); //窗口消息处理函数声明
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
char szClassName[]="MainWClass";
WNDCLASSEX wndclass;
//填充WNDCLASSEX结构
wndclass.cbSize =sizeof(wndclass); //be sure to set this member
wndclass.style =CS_HREDRAW|CS_VREDRAW; //Redraws the entire window if width or height is changed.
wndclass.lpfnWndProc =MainWndProc;
wndclass.cbClsExtra =0; //
wndclass.cbWndExtra =0;
wndclass.hInstance =hInstance; //object handle
wndclass.hIcon =::LoadIcon (NULL,IDI_APPLICATION); //使用预定义的图标和光标
wndclass.hCursor =::LoadCursor (NULL,IDC_ARROW);
wndclass.hbrBackground =(HBRUSH)::GetStockObject (WHITE_BRUSH); //white background
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName =szClassName; //窗口类的名称
wndclass.hIconSm =NULL;
//注册这个窗口类
::RegisterClassEx (&wndclass); //失败则返回0
//创建主窗口
HWND hwnd=::CreateWindowEx (0,szClassName,"My first Window!",WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,
NULL); //函数调用成功则返回窗口句柄
if(hwnd==NULL)
{
::MessageBox (NULL,"创建窗口出错!","error",MB_OK);
return -1;
}

//在桌面显示窗口
::ShowWindow (hwnd,nCmdShow );
::UpdateWindow (hwnd);
//从消息队列中取出消息,交给窗口函数处理
MSG msg;
while(::GetMessage (&msg,NULL,0,0))
{
//
::TranslateMessage (&msg);
//
::DispatchMessage (&msg);

return msg.wParam ;
}
return 0;
}

LRESULT CALLBACK MainWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
char szText[]="最简单的窗口程序!";
switch(message)
{
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
hdc=::BeginPaint (hwnd,&ps); //返回设备环境句柄
//
::TextOut (hdc,10,10,szText,strlen(szText));
::EndPaint (hwnd,&ps);
return 0;
}
case WM_DESTROY:
{
::PostQuitMessage (0);
return 0;
}
}


return ::DefWindowProc (hwnd,message,wParam,lParam);
}


MainWndProc 要定义在MainWndProc 外面
catherine_maomao 2009-03-20
  • 打赏
  • 举报
回复

能不能帮忙看下这段代码问题出在哪里呢??谢谢

#include "stdafx.h"
#include<windows.h>

LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM); //窗口消息处理函数声明
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
char szClassName[]="MainWClass";
WNDCLASSEX wndclass;
//填充WNDCLASSEX结构
wndclass.cbSize =sizeof(wndclass); //be sure to set this member
wndclass.style =CS_HREDRAW|CS_VREDRAW; //Redraws the entire window if width or height is changed.
wndclass.lpfnWndProc =MainWndProc;
wndclass.cbClsExtra =0; //
wndclass.cbWndExtra =0;
wndclass.hInstance =hInstance; //object handle
wndclass.hIcon =::LoadIcon (NULL,IDI_APPLICATION); //使用预定义的图标和光标
wndclass.hCursor =::LoadCursor (NULL,IDC_ARROW);
wndclass.hbrBackground =(HBRUSH)::GetStockObject (WHITE_BRUSH); //white background
wndclass.lpszMenuName =NULL;
wndclass.lpszClassName =szClassName; //窗口类的名称
wndclass.hIconSm =NULL;
//注册这个窗口类
::RegisterClassEx (&wndclass); //失败则返回0
//创建主窗口
HWND hwnd=::CreateWindowEx (0,szClassName,"My first Window!",WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,
NULL); //函数调用成功则返回窗口句柄
if(hwnd==NULL)
{
::MessageBox (NULL,"创建窗口出错!","error",MB_OK);
return -1;
}

//在桌面显示窗口
::ShowWindow (hwnd,nCmdShow );
::UpdateWindow (hwnd);
//从消息队列中取出消息,交给窗口函数处理
MSG msg;
while(::GetMessage (&msg,NULL,0,0))
{
//
::TranslateMessage (&msg);
//
::DispatchMessage (&msg);

return msg.wParam ;
}

LRESULT CALLBACK MainWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
char szText[]="最简单的窗口程序!";
switch(message)
{
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
hdc=::BeginPaint (hwnd,&ps); //返回设备环境句柄
//
::TextOut (hdc,10,10,szText,strlen(szText));
::EndPaint (hwnd,&ps);
return 0;
}
case WM_DESTROY:
{
::PostQuitMessage (0);
return 0;
}
}


return ::DefWindowProc (hwnd,message,wParam,lParam);
}


return 0;
}


error C2601: 'MainWndProc' : local function definitions are illegal

4,445

社区成员

发帖
与我相关
我的任务
社区描述
图形图像/机器视觉
社区管理员
  • 机器视觉
  • 迪菲赫尔曼
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧