- 博客(0)
- 资源 (22)
- 收藏
- 关注
自适应模式算术编码代码 C语言
#include
#include
#include
double result,areaBegin,areaEnd;
int cord[1000],cordLength;
char str[1000];
int strLength=0;
double proc[10]; //概率数组
int a[10]; //信源符号个数统计数组
void initialization() //............初始化概率函数..................
{
for(int i=0;i<10;i++)
{
proc[i]= 0.10;
a[i]=1;
}
}
bool readdat()
{
printf("*********** 自适应模式算术编码 ***********\n");
printf("请输入字符串(0--9): \n");
scanf("%s",str);
while(str[strLength]!='\0')
strLength++;
for(int i=0;i'9' || str[i]<'0') return 1;
return 0;
}
2011-06-15
算术编码(固定模式C语言)代码
#include
#include
#include
const double proc[]={0.10,0.10,0.10,0.1,0.1,0.1,0.1,0.1,0.15,0.05};
double result,areaBegin,areaEnd;
int cord[1000],cordLength;
char str[1000];
int strLength=0;
bool readdat(){
printf("*********** 固定模式算术编码 ***********\n");
printf("请输入字符串(0--9): \n");
scanf("%s",str);
while(str[strLength]!='\0')
strLength++;
for(int i=0;i'9' || str[i]<'0') return 1;
return 0;。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。下载吧。。。
2011-06-15
图像处理程序大全 C++
本资源含大量的图像处理代码(C++)
int kind = 0; // 图像类型(8位kind=1,24位kind=3,初始化kind=0)
LONG Bytes = 0; // 图像分配内存的最大值
BOOL Step; // 菜单上一步、下一步启动禁用标志 -> FALSE为下一步禁用
BOOL Step_All = TRUE; // 初始化上一步、下一步 -> TRUE为禁用
BOOL fdj = TRUE; // 可以使用放大镜的标志
int screen_width = GetSystemMetrics(SM_CXSCREEN); // 获取屏幕宽度
int screen_height = GetSystemMetrics(SM_CYSCREEN); // 获取屏幕高度
BOOL DirectDraw_Pause = FALSE; // DirectDraw显示时键盘中断标志
int Match_x = 0; // 模板匹配中左上方坐标 - 行
int Match_y = 0; // 模板匹配中左上方坐标 - 列
CString Match_result = ""; // 模板匹配结果
SOCKET m_socket; // 定义一个套接字
/////////////////////////////////////////////////////////////////////////////
// CMy002App initialization
BOOL CMy002App::InitInstance()
{
// *** 判断程序是否已运行 ***
HANDLE hMutex; // 定义一个句柄
// 创建一个互斥对象,并返回句柄
hMutex = CreateMutex(NULL, TRUE, "7 4 的程序"); // 主线程拥有互斥对象,相当于一次请求互斥对象
// hMutex = CreateMutex(NULL, FALSE, "7 4 的程序"); // 主线程不拥有互斥对象
// WaitForSingleObject(hMutex,INFINITE); // 请求互斥对象
if (hMutex) // 判断句柄是否有值
{
if (ERROR_ALREADY_EXISTS == GetLastError()) // 判断程序是否已运行
{
AfxMessageBox("该应用程序已运行! ", MB_ICONINFORMATION | MB_OK);
ExitProcess(0); // 退出应用程序
}
}
ReleaseMutex(hMutex); // 释放互斥对象
// *** 登陆密码对话框 ***
Password dlg; // 定义对话框对象
dlg.DoModal(); // 显示并运行模态对话框 - 用户登录对话框
// CG: The following block was added by the Splash Screen component.
\
{
\
CCommandLineInfo cmdInfo;
\
ParseCommandLine(cmdInfo);
\
\
C_SplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_MY002TYPE,
RUNTIME_CLASS(CMy002Doc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CMy002View));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 启动时不打开子窗口
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog // *** 关于对话框 ***
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CMy002App::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CMy002App message handlers
BOOL CMy002App::PreTranslateMessage(MSG* pMsg)
{
// CG: The following lines were added by the Splash Screen component.
if (C_SplashWnd::PreTranslateAppMessage(pMsg))
return TRUE;
return CWinApp::PreTranslateMessage(pMsg);
}
2011-03-27
分水岭算法VC++实现
完整的,在VC++6.0上实现的程序
函数名: Watershed
功能: 用标记-分水岭算法对输入图像进行分割
算法实现: 无
输入参数说明: OriginalImage --输入图像(灰度图,0~255)
SeedImage --标记图像(二值图,0-非标记,1-标记)
LabelImage --输出图像(1-第一个分割区域,2-第二个分割区域,...)
row --图像行数
col --图像列数
返回值说明: 无
2011-03-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人