Skip to content

Commit 3fa11eb

Browse files
committed
修正阿尔法滤波和自适应中值滤波
同时增加了用户中心
1 parent 7409b04 commit 3fa11eb

17 files changed

+1028
-16
lines changed

ImageProcess/BmpCommonOp.cpp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,4 +1103,72 @@ void BmpCommonOp::ContraharmonicMeanFilter(BYTE* Image, BYTE* DstImage, int m ,
11031103
}
11041104
}//end the whole image
11051105

1106+
}
1107+
1108+
1109+
1110+
/*************************************************************************
1111+
*
1112+
* Function: FilterEdgeProcess()
1113+
*
1114+
* Description: 滤波的边缘处理
1115+
*
1116+
* Input: Image 图像数据 a宽度边缘大小 b高度边缘大小 ImageWidth ImageHeight 图像宽高 BitCount图像位数 LineByte图像一行所占字节数
1117+
*
1118+
* Returns:
1119+
*
1120+
************************************************************************/
1121+
void BmpCommonOp::FilterEdgeProcess(BYTE* Image, BYTE* DstImage, int a, int b, int ImageWidth, int ImageHeight, int BitCount, int LineByte) {
1122+
//边缘处理 四个边界 直接取附近值一组处理过的像素值
1123+
1124+
1125+
if (BitCount==8) {
1126+
//左右 相同的高度
1127+
for (int j = 0; j < ImageHeight; j++) {//Y
1128+
for (int i = 0; i < a; i++) {//
1129+
*(DstImage + j*LineByte + i) = *(Image + j*LineByte + i + a);
1130+
}
1131+
for (int i = ImageWidth - a; i < ImageWidth; i++) {//
1132+
*(DstImage + j*LineByte + i) = *(Image + j*LineByte + i - a);
1133+
}
1134+
}
1135+
//上下 相同的宽度
1136+
for (int i = 0; i < ImageWidth; i++) {
1137+
for (int j = ImageHeight - b; j < ImageHeight; j++) {//
1138+
*(DstImage + j*LineByte + i) = *(Image + (j - b)*LineByte + i);
1139+
}
1140+
for (int j = 0; j < b; j++) {//
1141+
*(DstImage + j*LineByte + i) = *(Image + (j + b)*LineByte + i);
1142+
}
1143+
}
1144+
}
1145+
1146+
if (BitCount==24) {
1147+
for (int j = 0; j < ImageHeight; j++) {
1148+
for (int i = 0; i < a; i++) {//
1149+
*(DstImage + j*LineByte + i * 3) = *(Image + j*LineByte + i * 3 + a);
1150+
*(DstImage + j*LineByte + i * 3 + 1) = *(Image + j*LineByte + i * 3 + 1 + a);
1151+
*(DstImage + j*LineByte + i * 3 + 2) = *(Image + j*LineByte + i * 3 + 2 + a);
1152+
}
1153+
for (int i = ImageWidth - a; i < ImageWidth; i++) {//
1154+
*(DstImage + j*LineByte + i * 3) = *(Image + j*LineByte + ImageWidth + i * 3 - a);
1155+
*(DstImage + j*LineByte + i * 3 + 1) = *(Image + j*LineByte + ImageWidth + i * 3 + 1 - a);
1156+
*(DstImage + j*LineByte + i * 3 + 2) = *(Image + j*LineByte + ImageWidth + i * 3 + 2 - a);
1157+
}
1158+
}
1159+
//上下 相同的宽度
1160+
for (int i = 0; i < ImageWidth; i++) {
1161+
for (int j = ImageHeight - b; j < ImageHeight; j++) {//
1162+
*(DstImage + j*LineByte + i * 3) = *(Image + (j - b)*LineByte + i * 3);
1163+
*(DstImage + j*LineByte + i * 3 + 1) = *(Image + (j - b)*LineByte + i * 3 + 1);
1164+
*(DstImage + j*LineByte + i * 3 + 2) = *(Image + (j - b)*LineByte + i * 3 + 2);
1165+
}
1166+
for (int j = 0; j < b; j++) {//
1167+
*(DstImage + j*LineByte + i * 3) = *(Image + (j + b)*LineByte + i * 3);
1168+
*(DstImage + j*LineByte + i * 3 + 1) = *(Image + (j + b)*LineByte + i * 3 + 1);
1169+
*(DstImage + j*LineByte + i * 3 + 2) = *(Image + (j + b)*LineByte + i * 3 + 2);
1170+
}
1171+
}
1172+
}
1173+
11061174
}

ImageProcess/BmpCommonOp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,7 @@ class BmpCommonOp :
6464

6565
void ContraharmonicMeanFilter(BYTE* Image, BYTE* DstImage, int m, int n, int q, int ImageSize, int ImageWidth, int ImageHeight, int BitCount, int LineByte);//逆谐波均值滤波器
6666

67+
void FilterEdgeProcess(BYTE* Image,BYTE* DstImage,int a,int b, int ImageWidth, int ImageHeight, int BitCount, int LineByte);//滤波的边缘处理
68+
6769
};
6870

ImageProcess/Common.cpp

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "stdafx.h"
22
#include "Common.h"
3-
3+
#include <afxinet.h> //Http
44

55
Common::Common()
66
{
@@ -37,7 +37,6 @@ void Common::InsertSort(int a[], int n) {
3737

3838

3939

40-
4140
/*************************************************************************
4241
* Function: GetMedian()
4342
*
@@ -85,6 +84,8 @@ void Common::CStringToArray(CString string, float *arr) {
8584

8685
}
8786

87+
88+
8889
/*************************************************************************
8990
* Function: SplitString()
9091
*
@@ -164,4 +165,76 @@ float * Common::SplitString(CString str, CString split)
164165
************************************************************************/
165166
void Common::GetConfig() {
166167

167-
}
168+
}
169+
170+
171+
172+
/*************************************************************************
173+
* Function: SetConfig()
174+
*
175+
* Description: 获取软件配置信息
176+
*
177+
* Input:
178+
*
179+
* Returns:
180+
************************************************************************/
181+
//void Common::SetConfig(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString) {
182+
// CFileFind finder; //查找是否存在ini文件
183+
// BOOL ifFind = finder.FindFile(_T("config.ini"));
184+
// CString configIni = _T("config.ini");
185+
// //
186+
// if (!ifFind) {//不存在,则生成一个新的默认设置的ini文件
187+
// WritePrivateProfileStringW(_T("xwreg"), _T("IP"), _T("10.210.0.9"), configIni);
188+
//
189+
// }
190+
// else {
191+
// CString strObject;
192+
//
193+
// WritePrivateProfileString(_T("xwreg"), _T("IP"), strObject, _T("d:\\qzze.ini"));
194+
// }
195+
//
196+
//
197+
//
198+
//}
199+
200+
201+
202+
/*************************************************************************
203+
* Function: GetHttpBody()
204+
*
205+
* Description: 获取HTTP请求
206+
*
207+
* Input:
208+
*
209+
* Returns:
210+
************************************************************************/
211+
void Common::GetHttpBody(CString requestHost, CString requestUrl, BYTE *Buffer) {
212+
//通过 http GET 协议
213+
CInternetSession session;
214+
session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 1000 * 20);
215+
session.SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 1000);
216+
session.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1);
217+
218+
CHttpConnection* pConnection = session.GetHttpConnection(requestHost, (INTERNET_PORT)80);
219+
CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET, requestUrl);
220+
CString szHeaders = _T("Accept: text/plain, text/html, text/htm\r\n");
221+
pFile->AddRequestHeaders(szHeaders);//请求头
222+
pFile->SendRequest();//发送请求
223+
DWORD dwRet;
224+
pFile->QueryInfoStatusCode(dwRet);
225+
226+
if (dwRet = HTTP_STATUS_OK) {
227+
pFile->Read((void *)Buffer, sizeof(Buffer));
228+
}
229+
else {
230+
CString errText;
231+
errText.Format(L"POST出错,错误码:%d", dwRet);
232+
AfxMessageBox(errText);
233+
}
234+
235+
session.Close();
236+
pFile->Close();
237+
delete pFile;
238+
}
239+
240+

ImageProcess/Common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ class Common
1212
//void NormalDistribution();//正态分布
1313

1414
void GetConfig();//获取软件配置信息
15+
void GetHttpBody(CString Host, CString Url, BYTE *Buffer);
16+
1517
};
1618

ImageProcess/ImageProcess.aps

4.69 KB
Binary file not shown.

ImageProcess/ImageProcess.rc

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,25 @@ BEGIN
192192
MENUITEM "��˹����", ID_GAUSSIAN_NOISE
193193
MENUITEM "��ֵ�˲�", ID_MEDIAN_FILTER
194194
MENUITEM "��г����ֵ�˲���", ID_CONTRAHARMONIC_MEAN_FILTER
195+
MENUITEM "�����İ�������ֵ�˲�", ID_ALPHA_TRIMMED_MEAN_FILTER
196+
MENUITEM "����Ӧ��ֵ�˲�", ID_ADAPTIVE_MEDIAN_FILTER
195197
END
196198
POPUP "����"
197199
BEGIN
198200
MENUITEM "Test", ID_TEST
199201
END
200202
POPUP "����(&H)"
201203
BEGIN
204+
POPUP "���ͷ���"
205+
BEGIN
206+
MENUITEM "�ύ����", ID_POST_ADVICE
207+
MENUITEM "��������", ID_REPOST_ISSUE
208+
MENUITEM "����", ID_IMPROVE_SETTING
209+
END
202210
MENUITEM "ʹ�ð���", ID_HELP
203211
MENUITEM "����֧��", ID_32775
204212
MENUITEM "���� ImageProcess(&A)...", ID_APP_ABOUT
213+
MENUITEM "�û���¼", ID_USER_LOGIN
205214
END
206215
END
207216

@@ -368,6 +377,49 @@ BEGIN
368377
EDITTEXT IDC_EDIT_COMMON_P3,115,74,61,14,ES_AUTOHSCROLL
369378
END
370379

380+
IDD_DIALOG_IMPROVE DIALOGEX 0, 0, 309, 176
381+
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
382+
CAPTION "����������Ƽƻ�"
383+
FONT 10, "Microsoft YaHei UI", 400, 0, 0x86
384+
BEGIN
385+
DEFPUSHBUTTON "ȷ��",IDOK,198,155,50,14
386+
PUSHBUTTON "ȡ��",IDCANCEL,252,155,50,14
387+
LTEXT "�����Ľ������ͷ������������߿ɿ��Ժ����ܡ�\n\n����˼ƻ����ή�����������ܡ�\n\n�������˼ƻ����ǽ��ռ���������ʱ����Ϣ�Ա����Ǹ���ʱ�Ľ����\n",IDC_STATIC,7,7,217,53
388+
CONTROL "��",IDC_RADIO_IMPROVE_YES,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,26,72,23,10
389+
CONTROL "��",IDC_RADIO_IMPROVE_NO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,26,91,23,10
390+
LTEXT "��ͬ��",IDC_STATIC,64,73,21,8
391+
LTEXT "�Ҳ�ͬ��",IDC_STATIC,64,92,27,8
392+
END
393+
394+
IDD_DIALOG_USER_LOGIN DIALOGEX 0, 0, 309, 176
395+
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
396+
CAPTION "Dialog"
397+
FONT 10, "Microsoft YaHei UI", 400, 0, 0x86
398+
BEGIN
399+
PUSHBUTTON "��¼",IDC_BUTTON_LOGIN,88,118,50,14
400+
PUSHBUTTON "ע��",IDC_BUTTON_REGISTER,164,118,50,14
401+
EDITTEXT IDC_EDIT_USER_LOGIIN_EM,129,34,71,14,ES_AUTOHSCROLL
402+
EDITTEXT IDC_EDIT_USER_LOGIIN_PA,128,66,72,14,ES_PASSWORD | ES_AUTOHSCROLL
403+
LTEXT "����",IDC_STATIC,81,69,14,8
404+
LTEXT "����",IDC_STATIC,81,36,14,8
405+
END
406+
407+
IDD_DIALOG_USER_CENTER DIALOGEX 0, 0, 309, 176
408+
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
409+
CAPTION "Dialog"
410+
FONT 10, "Microsoft YaHei UI", 400, 0, 0x0
411+
BEGIN
412+
DEFPUSHBUTTON "ȷ��",IDOK,198,155,50,14
413+
PUSHBUTTON "ȡ��",IDCANCEL,252,155,50,14
414+
CONTROL "",IDC_STATIC_PICUSER,"Static",SS_BLACKFRAME,33,25,40,31
415+
LTEXT "����",IDC_STATIC,100,29,14,8
416+
LTEXT "Static",IDC_STATIC_USER_NAME,140,29,19,8
417+
LTEXT "����",IDC_STATIC,100,48,14,8
418+
LTEXT "Static",IDC_STATIC_USER_EMAIL,140,48,19,8
419+
LTEXT "Ip",IDC_STATIC,102,69,8,8
420+
CONTROL "",IDC_IPADDRESS_USER_LOGIN,"SysIPAddress32",WS_TABSTOP,126,66,100,15
421+
END
422+
371423

372424
/////////////////////////////////////////////////////////////////////////////
373425
//
@@ -389,15 +441,15 @@ VS_VERSION_INFO VERSIONINFO
389441
BEGIN
390442
BLOCK "StringFileInfo"
391443
BEGIN
392-
BLOCK "080404B0"
444+
BLOCK "080404b0"
393445
BEGIN
394-
VALUE "CompanyName", "TODO: <��˾��>"
446+
VALUE "CompanyName", "The Future"
395447
VALUE "FileDescription", "ImageProcess"
396448
VALUE "FileVersion", "1.0.0.1"
397449
VALUE "InternalName", "ImageProcess.exe"
398-
VALUE "LegalCopyright", "TODO: (C) <��˾��>�� ��������Ȩ����"
450+
VALUE "LegalCopyright", "Powered By Naihai"
399451
VALUE "OriginalFilename", "ImageProcess.exe"
400-
VALUE "ProductName", "TODO: <��Ʒ��>"
452+
VALUE "ProductName", "Image Process"
401453
VALUE "ProductVersion", "1.0.0.1"
402454
END
403455
END
@@ -495,6 +547,30 @@ BEGIN
495547
TOPMARGIN, 7
496548
BOTTOMMARGIN, 169
497549
END
550+
551+
IDD_DIALOG_IMPROVE, DIALOG
552+
BEGIN
553+
LEFTMARGIN, 7
554+
RIGHTMARGIN, 302
555+
TOPMARGIN, 7
556+
BOTTOMMARGIN, 169
557+
END
558+
559+
IDD_DIALOG_USER_LOGIN, DIALOG
560+
BEGIN
561+
LEFTMARGIN, 7
562+
RIGHTMARGIN, 302
563+
TOPMARGIN, 7
564+
BOTTOMMARGIN, 169
565+
END
566+
567+
IDD_DIALOG_USER_CENTER, DIALOG
568+
BEGIN
569+
LEFTMARGIN, 7
570+
RIGHTMARGIN, 302
571+
TOPMARGIN, 7
572+
BOTTOMMARGIN, 169
573+
END
498574
END
499575
#endif // APSTUDIO_INVOKED
500576

@@ -554,6 +630,21 @@ BEGIN
554630
0
555631
END
556632

633+
IDD_DIALOG_IMPROVE AFX_DIALOG_LAYOUT
634+
BEGIN
635+
0
636+
END
637+
638+
IDD_DIALOG_USER_LOGIN AFX_DIALOG_LAYOUT
639+
BEGIN
640+
0
641+
END
642+
643+
IDD_DIALOG_USER_CENTER AFX_DIALOG_LAYOUT
644+
BEGIN
645+
0
646+
END
647+
557648

558649
/////////////////////////////////////////////////////////////////////////////
559650
//

ImageProcess/ImageProcess.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,14 @@
198198
<ClInclude Include="ImageProcess.h" />
199199
<ClInclude Include="ImageProcessDoc.h" />
200200
<ClInclude Include="ImageProcessView.h" />
201+
<ClInclude Include="ImproveDlg.h" />
201202
<ClInclude Include="InterpolationDlg.h" />
202203
<ClInclude Include="MainFrm.h" />
203204
<ClInclude Include="Resource.h" />
204205
<ClInclude Include="RotateDlg.h" />
205206
<ClInclude Include="stdafx.h" />
206207
<ClInclude Include="targetver.h" />
208+
<ClInclude Include="UserDlg.h" />
207209
<ClInclude Include="WriteCharDlg.h" />
208210
</ItemGroup>
209211
<ItemGroup>
@@ -219,6 +221,7 @@
219221
<ClCompile Include="ImageProcess.cpp" />
220222
<ClCompile Include="ImageProcessDoc.cpp" />
221223
<ClCompile Include="ImageProcessView.cpp" />
224+
<ClCompile Include="ImproveDlg.cpp" />
222225
<ClCompile Include="InterpolationDlg.cpp" />
223226
<ClCompile Include="MainFrm.cpp" />
224227
<ClCompile Include="RotateDlg.cpp" />
@@ -228,6 +231,7 @@
228231
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
229232
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
230233
</ClCompile>
234+
<ClCompile Include="UserDlg.cpp" />
231235
<ClCompile Include="WriteCharDlg.cpp" />
232236
</ItemGroup>
233237
<ItemGroup>

0 commit comments

Comments
 (0)