初始化提交,导入现有项目源码:
- 包含 BVisionPro(视觉处理相关模块)
- 包含 SDK/Controls(控件库、缓冲区等)
- 当前无功能变更,仅用于初始化版本控制
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "Version": 1, |
| | | "WorkspaceRootPath": "D:\\WorkCode\\MiniLED_ADM\\", |
| | | "Documents": [ |
| | | { |
| | | "AbsoluteMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", |
| | | "RelativeMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|solutionrelative:Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" |
| | | }, |
| | | { |
| | | "AbsoluteMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", |
| | | "RelativeMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|solutionrelative:Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" |
| | | } |
| | | ], |
| | | "DocumentGroupContainers": [ |
| | | { |
| | | "Orientation": 0, |
| | | "VerticalTabListWidth": 256, |
| | | "DocumentGroups": [ |
| | | { |
| | | "DockedWidth": 200, |
| | | "SelectedChildIndex": 3, |
| | | "Children": [ |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" |
| | | }, |
| | | { |
| | | "$type": "Document", |
| | | "DocumentIndex": 0, |
| | | "Title": "AutoFileCleanupToolDlg.cpp", |
| | | "DocumentMoniker": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "RelativeDocumentMoniker": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "ToolTip": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "RelativeToolTip": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "ViewState": "AgIAAAMAAAAAAAAAAAAYwOkAAAACAAAAAAAAAA==", |
| | | "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", |
| | | "WhenOpened": "2025-07-08T06:41:23.053Z", |
| | | "EditorCaption": "" |
| | | }, |
| | | { |
| | | "$type": "Document", |
| | | "DocumentIndex": 1, |
| | | "Title": "AutoFileCleanupToolDlg.h", |
| | | "DocumentMoniker": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "RelativeDocumentMoniker": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "ToolTip": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "RelativeToolTip": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "ViewState": "AgIAADMAAAAAAAAAAAAiwD8AAAApAAAAAAAAAA==", |
| | | "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", |
| | | "WhenOpened": "2025-07-08T06:40:44.208Z", |
| | | "EditorCaption": "" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "DockedWidth": 200, |
| | | "SelectedChildIndex": -1, |
| | | "Children": [ |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{28836128-fc2c-11d2-a433-00c04f72d18a}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{68487888-204a-11d3-87eb-00c04f7971a5}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}" |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "Version": 1, |
| | | "WorkspaceRootPath": "D:\\WorkCode\\MiniLED_ADM\\", |
| | | "Documents": [ |
| | | { |
| | | "AbsoluteMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", |
| | | "RelativeMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|solutionrelative:Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" |
| | | }, |
| | | { |
| | | "AbsoluteMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", |
| | | "RelativeMoniker": "D:0:0:{015D4585-C7BA-EB4D-4ED7-59D258F4FED4}|Common_Class\\AutoFileCleanupTool\\AutoFileCleanupTool.vcxproj|solutionrelative:Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" |
| | | } |
| | | ], |
| | | "DocumentGroupContainers": [ |
| | | { |
| | | "Orientation": 0, |
| | | "VerticalTabListWidth": 256, |
| | | "DocumentGroups": [ |
| | | { |
| | | "DockedWidth": 200, |
| | | "SelectedChildIndex": 3, |
| | | "Children": [ |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" |
| | | }, |
| | | { |
| | | "$type": "Document", |
| | | "DocumentIndex": 0, |
| | | "Title": "AutoFileCleanupToolDlg.cpp", |
| | | "DocumentMoniker": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "RelativeDocumentMoniker": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "ToolTip": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "RelativeToolTip": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.cpp", |
| | | "ViewState": "AgIAAFIAAAAAAAAAAAAgwOkAAAACAAAAAAAAAA==", |
| | | "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", |
| | | "WhenOpened": "2025-07-08T06:41:23.053Z", |
| | | "EditorCaption": "" |
| | | }, |
| | | { |
| | | "$type": "Document", |
| | | "DocumentIndex": 1, |
| | | "Title": "AutoFileCleanupToolDlg.h", |
| | | "DocumentMoniker": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "RelativeDocumentMoniker": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "ToolTip": "D:\\WorkCode\\MiniLED_ADM\\Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "RelativeToolTip": "Common_Class\\AutoFileCleanupTool\\AutoFileCleanupToolDlg.h", |
| | | "ViewState": "AgIAADMAAAAAAAAAAAAiwD8AAAApAAAAAAAAAA==", |
| | | "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", |
| | | "WhenOpened": "2025-07-08T06:40:44.208Z", |
| | | "EditorCaption": "" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "DockedWidth": 200, |
| | | "SelectedChildIndex": -1, |
| | | "Children": [ |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{28836128-fc2c-11d2-a433-00c04f72d18a}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{68487888-204a-11d3-87eb-00c04f7971a5}" |
| | | }, |
| | | { |
| | | "$type": "Bookmark", |
| | | "Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}" |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // BlVisionPro.cpp : å®ä¹ DLL çåå§åä¾ç¨ã |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | | #endif |
| | | |
| | | // |
| | | //TODO: å¦ææ¤ DLL ç¸å¯¹äº MFC DLL æ¯å¨æé¾æ¥çï¼ |
| | | // å仿¤ DLL 导åºçä»»ä½è°å
¥ |
| | | // MFC ç彿°å¿
é¡»å° AFX_MANAGE_STATE 宿·»å å° |
| | | // è¯¥å½æ°çæåé¢ã |
| | | // |
| | | // ä¾å¦: |
| | | // |
| | | // extern "C" BOOL PASCAL EXPORT ExportedFunction() |
| | | // { |
| | | // AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | // // æ¤å¤ä¸ºæ®é彿°ä½ |
| | | // } |
| | | // |
| | | // æ¤å®å
äºä»»ä½ MFC è°ç¨ |
| | | // åºç°å¨æ¯ä¸ªå½æ°ä¸ååéè¦ã è¿æå³ç |
| | | // å®å¿
é¡»ä½ä¸ºå½æ°ä¸ç第ä¸ä¸ªè¯å¥ |
| | | // åºç°ï¼çè³å
äºææå¯¹è±¡åé声æï¼ |
| | | // è¿æ¯å 为å®ä»¬çæé 彿°å¯è½çæ MFC |
| | | // DLL è°ç¨ã |
| | | // |
| | | // æå
³å
¶ä»è¯¦ç»ä¿¡æ¯ï¼ |
| | | // 请åé
MFC ææ¯è¯´æ 33 å 58ã |
| | | // |
| | | |
| | | // CBlVisionProApp |
| | | |
| | | BEGIN_MESSAGE_MAP(CBlVisionProApp, CWinApp) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CBlVisionProApp æé |
| | | |
| | | CBlVisionProApp::CBlVisionProApp() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æé 代ç ï¼ |
| | | // å°ææéè¦çåå§åæ¾ç½®å¨ InitInstance ä¸ |
| | | } |
| | | |
| | | |
| | | // å¯ä¸çä¸ä¸ª CBlVisionProApp 对象 |
| | | |
| | | CBlVisionProApp theApp; |
| | | |
| | | |
| | | // CBlVisionProApp åå§å |
| | | |
| | | BOOL CBlVisionProApp::InitInstance() |
| | | { |
| | | CWinApp::InitInstance(); |
| | | |
| | | AfxEnableControlContainer(); //æ·»å OCX |
| | | |
| | | return TRUE; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | ; BlVisionPro.def : 声æ DLL çæ¨¡ååæ°ã |
| | | |
| | | LIBRARY |
| | | |
| | | EXPORTS |
| | | ; æ¤å¤å¯ä»¥æ¯æ¾å¼å¯¼åº |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // BlVisionPro.h : BlVisionPro DLL ç主头æä»¶ |
| | | // |
| | | |
| | | #pragma once |
| | | |
| | | #ifndef __AFXWIN_H__ |
| | | #error "å¨å
嫿¤æä»¶ä¹åå
å«âstdafx.hâä»¥çæ PCH æä»¶" |
| | | #endif |
| | | |
| | | #include "resource.h" // ä¸»ç¬¦å· |
| | | |
| | | |
| | | // CBlVisionProApp |
| | | // æå
³æ¤ç±»å®ç°çä¿¡æ¯ï¼è¯·åé
BlVisionPro.cpp |
| | | // |
| | | |
| | | class CBlVisionProApp : public CWinApp |
| | | { |
| | | public: |
| | | CBlVisionProApp(); |
| | | |
| | | // éå |
| | | public: |
| | | virtual BOOL InitInstance(); |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <ItemGroup Label="ProjectConfigurations"> |
| | | <ProjectConfiguration Include="Debug|Win32"> |
| | | <Configuration>Debug</Configuration> |
| | | <Platform>Win32</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Release|Win32"> |
| | | <Configuration>Release</Configuration> |
| | | <Platform>Win32</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Debug|x64"> |
| | | <Configuration>Debug</Configuration> |
| | | <Platform>x64</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Release|x64"> |
| | | <Configuration>Release</Configuration> |
| | | <Platform>x64</Platform> |
| | | </ProjectConfiguration> |
| | | </ItemGroup> |
| | | <PropertyGroup Label="Globals"> |
| | | <ProjectGuid>{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}</ProjectGuid> |
| | | <RootNamespace>BlVisionPro</RootNamespace> |
| | | <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> |
| | | <Keyword>MFCDLLProj</Keyword> |
| | | </PropertyGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
| | | <ConfigurationType>DynamicLibrary</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
| | | <ConfigurationType>DynamicLibrary</ConfigurationType> |
| | | <UseDebugLibraries>false</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <WholeProgramOptimization>true</WholeProgramOptimization> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
| | | <ConfigurationType>DynamicLibrary</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
| | | <ConfigurationType>DynamicLibrary</ConfigurationType> |
| | | <UseDebugLibraries>false</UseDebugLibraries> |
| | | <PlatformToolset>v140</PlatformToolset> |
| | | <WholeProgramOptimization>true</WholeProgramOptimization> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
| | | <ImportGroup Label="ExtensionSettings"> |
| | | </ImportGroup> |
| | | <ImportGroup Label="Shared"> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <PropertyGroup Label="UserMacros" /> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <LinkIncremental>true</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <LinkIncremental>true</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <LinkIncremental>false</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <LinkIncremental>false</LinkIncremental> |
| | | <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |
| | | </PropertyGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <Optimization>Disabled</Optimization> |
| | | <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <Optimization>Disabled</Optimization> |
| | | <PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <ClCompile> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <Optimization>MaxSpeed</Optimization> |
| | | <FunctionLevelLinking>true</FunctionLevelLinking> |
| | | <IntrinsicFunctions>true</IntrinsicFunctions> |
| | | <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
| | | <OptimizeReferences>true</OptimizeReferences> |
| | | <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <ClCompile> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <Optimization>MaxSpeed</Optimization> |
| | | <FunctionLevelLinking>true</FunctionLevelLinking> |
| | | <IntrinsicFunctions>true</IntrinsicFunctions> |
| | | <PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;EXPORT_BLVISION_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <SDLCheck>true</SDLCheck> |
| | | <AdditionalIncludeDirectories>./;./Vision;./View;./Header;$(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <GenerateDebugInformation>true</GenerateDebugInformation> |
| | | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
| | | <OptimizeReferences>true</OptimizeReferences> |
| | | <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile> |
| | | <AdditionalLibraryDirectories>$(HALCONROOT)\lib\$(HALCONARCH)</AdditionalLibraryDirectories> |
| | | <AdditionalDependencies>halconcpp.lib</AdditionalDependencies> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0412</Culture> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | <PostBuildEvent> |
| | | <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)SDK\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).lib" |
| | | copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)SDK\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb" |
| | | copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)SDK\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).dll" |
| | | copy "$(SolutionDir)$(ProjectName)\Header\BlVisionLib.h" "$(SolutionDir)SDK\BlVisionPro\include\BlVisionLib.h" |
| | | copy "$(SolutionDir)$(ProjectName)\Header\IVisionRecipe.h" "$(SolutionDir)SDK\BlVisionPro\include\IVisionRecipe.h" |
| | | copy "$(SolutionDir)$(ProjectName)\Header\ISoftVisionApp.h" "$(SolutionDir)SDK\BlVisionPro\include\ISoftVisionApp.h" |
| | | copy "$(SolutionDir)$(ProjectName)\Header\BlSideData.h" "$(SolutionDir)SDK\BlVisionPro\include\BlSideData.h"</Command> |
| | | </PostBuildEvent> |
| | | </ItemDefinitionGroup> |
| | | <ItemGroup> |
| | | <Text Include="ReadMe.txt" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="BlVisionPro.cpp" /> |
| | | <ClCompile Include="stdafx.cpp"> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> |
| | | </ClCompile> |
| | | <ClCompile Include="View\ChipInspectDlg.cpp" /> |
| | | <ClCompile Include="View\CornerDistSetDlg.cpp" /> |
| | | <ClCompile Include="View\CutSetDlg.cpp" /> |
| | | <ClCompile Include="View\GrindSetDlg.cpp" /> |
| | | <ClCompile Include="View\HoleSetDlg.cpp" /> |
| | | <ClCompile Include="View\KDistSetDlg.cpp" /> |
| | | <ClCompile Include="View\KeyVisionSetDlg.cpp" /> |
| | | <ClCompile Include="View\LockSetDlg.cpp" /> |
| | | <ClCompile Include="View\LocSetDlg.cpp" /> |
| | | <ClCompile Include="View\MeasureSetDlg.cpp" /> |
| | | <ClCompile Include="View\OpRoiDlg.cpp" /> |
| | | <ClCompile Include="View\RcutSetDLg.cpp" /> |
| | | <ClCompile Include="View\ScanSetDlg.cpp" /> |
| | | <ClCompile Include="View\ThresSetDlg.cpp" /> |
| | | <ClCompile Include="View\VisionSetDlg.cpp" /> |
| | | <ClCompile Include="Vision\BlSideData.cpp" /> |
| | | <ClCompile Include="Vision\BlVisionLib.cpp" /> |
| | | <ClCompile Include="Vision\Bspline.cpp" /> |
| | | <ClCompile Include="Vision\ConfigVision.cpp" /> |
| | | <ClCompile Include="Vision\CornerDistProcess.cpp" /> |
| | | <ClCompile Include="Vision\CornerRcutProcess.cpp" /> |
| | | <ClCompile Include="Vision\CutDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\CutProcess.cpp" /> |
| | | <ClCompile Include="Vision\DistDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\FileRecipe.cpp" /> |
| | | <ClCompile Include="Vision\GrindDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\GrindProcess.cpp" /> |
| | | <ClCompile Include="Vision\HoleDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\HoleProcess.cpp" /> |
| | | <ClCompile Include="Vision\InChipDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\KDistProcess.cpp" /> |
| | | <ClCompile Include="Vision\KeyDistDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\LocProcess.cpp" /> |
| | | <ClCompile Include="Vision\NccDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\RcutDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\SoftVisionApp.cpp" /> |
| | | <ClCompile Include="Vision\ThresDotProcess.cpp" /> |
| | | <ClCompile Include="Vision\ThresProcess.cpp" /> |
| | | <ClCompile Include="Vision\TranformCoordinate.cpp" /> |
| | | <ClCompile Include="Vision\VisionBufferPro.cpp" /> |
| | | <ClCompile Include="Vision\VisionRecipe.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="BlVisionPro.h" /> |
| | | <ClInclude Include="Header\BlSideData.h" /> |
| | | <ClInclude Include="Header\BlVisionLib.h" /> |
| | | <ClInclude Include="Header\ISoftVisionApp.h" /> |
| | | <ClInclude Include="Header\IVisionRecipe.h" /> |
| | | <ClInclude Include="IncludeVision.h" /> |
| | | <ClInclude Include="Resource.h" /> |
| | | <ClInclude Include="stdafx.h" /> |
| | | <ClInclude Include="targetver.h" /> |
| | | <ClInclude Include="View\ChipInspectDlg.h" /> |
| | | <ClInclude Include="View\CornerDistSetDlg.h" /> |
| | | <ClInclude Include="View\CutSetDlg.h" /> |
| | | <ClInclude Include="View\GrindSetDlg.h" /> |
| | | <ClInclude Include="View\HoleSetDlg.h" /> |
| | | <ClInclude Include="View\KDistSetDlg.h" /> |
| | | <ClInclude Include="View\KeyVisionSetDlg.h" /> |
| | | <ClInclude Include="View\LockSetDlg.h" /> |
| | | <ClInclude Include="View\LocSetDlg.h" /> |
| | | <ClInclude Include="View\MeasureSetDlg.h" /> |
| | | <ClInclude Include="View\OpRoiDlg.h" /> |
| | | <ClInclude Include="View\RcutSetDLg.h" /> |
| | | <ClInclude Include="View\ScanSetDlg.h" /> |
| | | <ClInclude Include="View\ThresSetDlg.h" /> |
| | | <ClInclude Include="View\VisionSetDlg.h" /> |
| | | <ClInclude Include="Vision\Bspline.h" /> |
| | | <ClInclude Include="Vision\ConfigVision.h" /> |
| | | <ClInclude Include="Vision\CornerDistProcess.h" /> |
| | | <ClInclude Include="Vision\CornerRcutProcess.h" /> |
| | | <ClInclude Include="Vision\CutDotProcess.h" /> |
| | | <ClInclude Include="Vision\CutProcess.h" /> |
| | | <ClInclude Include="Vision\DistDotProcess.h" /> |
| | | <ClInclude Include="Vision\EiVisionType.h" /> |
| | | <ClInclude Include="Vision\FileRecipe.h" /> |
| | | <ClInclude Include="Vision\GrindDotProcess.h" /> |
| | | <ClInclude Include="Vision\GrindProcess.h" /> |
| | | <ClInclude Include="Vision\HoleDotProcess.h" /> |
| | | <ClInclude Include="Vision\HoleProcess.h" /> |
| | | <ClInclude Include="Vision\InChipDotProcess.h" /> |
| | | <ClInclude Include="Vision\KDistProcess.h" /> |
| | | <ClInclude Include="Vision\KeyDistDotProcess.h" /> |
| | | <ClInclude Include="Vision\LocProcess.h" /> |
| | | <ClInclude Include="Vision\NccDotProcess.h" /> |
| | | <ClInclude Include="Vision\RcutDotProcess.h" /> |
| | | <ClInclude Include="Vision\SoftVisionApp.h" /> |
| | | <ClInclude Include="Vision\ThresDotProcess.h" /> |
| | | <ClInclude Include="Vision\ThresProcess.h" /> |
| | | <ClInclude Include="Vision\TranformCoordinate.h" /> |
| | | <ClInclude Include="Vision\Vec.h" /> |
| | | <ClInclude Include="Vision\VisionBufferPro.h" /> |
| | | <ClInclude Include="Vision\VisionRecipe.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="BlVisionPro.def" /> |
| | | <None Include="res\BlVisionPro.rc2" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="BlVisionPro.rc" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\navigate_down.ico" /> |
| | | <Image Include="res\navigate_left.ico" /> |
| | | <Image Include="res\navigate_right.ico" /> |
| | | <Image Include="res\navigate_up.ico" /> |
| | | </ItemGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
| | | <ImportGroup Label="ExtensionTargets"> |
| | | </ImportGroup> |
| | | <ProjectExtensions> |
| | | <VisualStudio> |
| | | <UserProperties RESOURCE_FILE="BlVisionPro.rc" /> |
| | | </VisualStudio> |
| | | </ProjectExtensions> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <ItemGroup> |
| | | <Filter Include="æºæä»¶"> |
| | | <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
| | | <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
| | | </Filter> |
| | | <Filter Include="头æä»¶"> |
| | | <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |
| | | <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> |
| | | </Filter> |
| | | <Filter Include="èµæºæä»¶"> |
| | | <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
| | | <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
| | | </Filter> |
| | | <Filter Include="Header"> |
| | | <UniqueIdentifier>{6b9df6fc-c6e1-4fc4-bac7-12afe3d62fe2}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="View"> |
| | | <UniqueIdentifier>{fa7ebfd5-c76a-4a48-abdc-2341ef5425fd}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="Vision"> |
| | | <UniqueIdentifier>{a50739ac-00f3-4d43-bb12-9c59ab37dc44}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="func"> |
| | | <UniqueIdentifier>{b15b5c28-2ffd-4b93-9787-55d0c57ccbe2}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="Vision\Vision Model"> |
| | | <UniqueIdentifier>{406a47d3-0b5d-4946-a872-5fa6c87fd860}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="Vision\Vision Dot"> |
| | | <UniqueIdentifier>{f2bdadec-a287-4bdd-8634-801d9c7d9261}</UniqueIdentifier> |
| | | </Filter> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Text Include="ReadMe.txt" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="stdafx.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="BlVisionPro.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\CornerDistSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\VisionSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\KeyVisionSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\RcutSetDLg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\ScanSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\VisionRecipe.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\SoftVisionApp.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\ConfigVision.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\BlVisionLib.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\BlSideData.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\VisionBufferPro.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\TranformCoordinate.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\OpRoiDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\LocSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\MeasureSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\CutSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\CornerRcutProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\CutDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\DistDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\GrindDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\GrindProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\LocProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\NccDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\RcutDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\CutProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\KDistProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\KDistSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\GrindSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\KeyDistDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\CornerDistProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\FileRecipe.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\LockSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\Bspline.cpp"> |
| | | <Filter>func</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\ChipInspectDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\InChipDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\ThresDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\ThresProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\ThresSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="View\HoleSetDlg.cpp"> |
| | | <Filter>View</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\HoleDotProcess.cpp"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Vision\HoleProcess.cpp"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="stdafx.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="targetver.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Resource.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Header\IVisionRecipe.h"> |
| | | <Filter>Header</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="IncludeVision.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="BlVisionPro.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Header\ISoftVisionApp.h"> |
| | | <Filter>Header</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Header\BlVisionLib.h"> |
| | | <Filter>Header</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\CornerDistSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\VisionSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Header\BlSideData.h"> |
| | | <Filter>Header</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\KeyVisionSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\RcutSetDLg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\ScanSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\VisionRecipe.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\SoftVisionApp.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\ConfigVision.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\VisionBufferPro.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\TranformCoordinate.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\OpRoiDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\LocSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\MeasureSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\CutSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\CornerRcutProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\CutDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\DistDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\EiVisionType.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\GrindDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\GrindProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\LocProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\NccDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\RcutDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\CutProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\KDistProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\KDistSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\GrindSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\KeyDistDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\CornerDistProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\FileRecipe.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\LockSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\Vec.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\Bspline.h"> |
| | | <Filter>func</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\ChipInspectDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\InChipDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\ThresDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\ThresProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\ThresSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="View\HoleSetDlg.h"> |
| | | <Filter>View</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\HoleDotProcess.h"> |
| | | <Filter>Vision\Vision Dot</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Vision\HoleProcess.h"> |
| | | <Filter>Vision\Vision Model</Filter> |
| | | </ClInclude> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="BlVisionPro.def"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </None> |
| | | <None Include="res\BlVisionPro.rc2"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="BlVisionPro.rc"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </ResourceCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\navigate_down.ico"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </Image> |
| | | <Image Include="res\navigate_left.ico"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </Image> |
| | | <Image Include="res\navigate_right.ico"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </Image> |
| | | <Image Include="res\navigate_up.ico"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </Image> |
| | | </ItemGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef BL_SIDE_DATA |
| | | #define BL_SIDE_DATA |
| | | |
| | | #ifdef EXPORT_BLVISION_DLL |
| | | #include "../SDK/BaseDisplaySDK/include/typesdef.h" |
| | | #define EXPORTED_BLVISION _declspec(dllexport) |
| | | #else |
| | | #define EXPORTED_BLVISION _declspec(dllimport) |
| | | #endif |
| | | |
| | | |
| | | typedef struct _SideLineInf |
| | | { |
| | | int nSideLine; |
| | | int nThres; |
| | | int left; |
| | | int top; |
| | | int width; |
| | | int height; |
| | | }SideLineInf; |
| | | |
| | | //æ£æµç»æ |
| | | typedef struct _DispVisionResult { |
| | | int eDir; //é¢åæ° |
| | | int nType; //0,Point; 1;表示Rect; 2,表示å; 3ï¼ ç´çº¿; 4ï¼ææ¬ |
| | | int eVision; //è§è§ç±»å |
| | | int rectX1; //ç©å½¢åæ° |
| | | int rectY1; //ç©å½¢åæ° |
| | | int rectX2; //ç©å½¢åæ° |
| | | int rectY2; //ç©å½¢åæ° |
| | | int pointX; //ç¹åæ° |
| | | int pointY; //ç¹åæ° |
| | | int circleX; //ååæ° |
| | | int circleY; //ååæ° |
| | | int circleRadius; //ååæ° |
| | | CString strName; //åç§° |
| | | }DispVisionResult; |
| | | |
| | | |
| | | class EXPORTED_BLVISION CBlSideData |
| | | { |
| | | public: |
| | | CBlSideData(); |
| | | ~CBlSideData(); |
| | | |
| | | public: |
| | | //1. éç½® |
| | | void Reset(void); |
| | | |
| | | //2. è·åä½ç½® |
| | | Point2I getPose(int nType); |
| | | |
| | | public: |
| | | //1. å辨ç |
| | | double m_dPixelSizeX; //Xæ¹åçå辨ç |
| | | double m_dPixelSizeY; //Yæ¹åçå辨ç |
| | | |
| | | //2. æ£æµç»æ |
| | | BOOL m_bInspection_Complete; //æ¯å¦æ£æµç»é |
| | | |
| | | //3.Top Mark Info |
| | | BOOL m_bTopMark_Find; //æ¯å¦æ¥æ¾TopMark |
| | | Point2I m_mTopMark; //TopMarkçä½ç½® |
| | | |
| | | //4. Bottom Mark Info |
| | | BOOL m_bBotMark_Find; //æ¯å¦æ¥æ¾BotMark |
| | | Point2I m_mBotMark; //BotMarkçä½ç½® |
| | | |
| | | //5. æ¥æ¾Top Point |
| | | BOOL m_bTopPoint_Find; |
| | | Point2I m_mTopPoint; |
| | | |
| | | //6. æ¥æ¾Bot Point |
| | | BOOL m_bBotPoint_Find; |
| | | Point2I m_mBotPoint; |
| | | |
| | | //7. Edge |
| | | int m_nStartLine; |
| | | int m_nEndLine; |
| | | |
| | | //8. æ£æµç»æ |
| | | std::map<int, SideLineInf> m_mapSideLineInf; |
| | | std::vector<DispVisionResult> m_vDispVisionResult; |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef BL_VISION_H |
| | | #define BL_VISION_H |
| | | |
| | | #include "IVisionRecipe.h" |
| | | #include "ISoftVisionApp.h" |
| | | |
| | | #ifdef EXPORT_BLVISION_DLL |
| | | #define EXPORTED_BLVISION _declspec(dllexport) |
| | | #else |
| | | #define EXPORTED_BLVISION _declspec(dllimport) |
| | | #endif |
| | | |
| | | extern "C" EXPORTED_BLVISION int BlVision_GetVersion(char *pszVersion, int nBufferSize); |
| | | extern "C" EXPORTED_BLVISION IVisionRecipe* BlVision_GetVisionRecipe(void); |
| | | extern "C" EXPORTED_BLVISION ISoftVisionApp* BlVision_GetSoftVisionApp(void); |
| | | |
| | | |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef ISOFT_VISION_APP_H |
| | | #define ISOFT_VISION_APP_H |
| | | |
| | | #include <functional> |
| | | #include <iostream> |
| | | |
| | | enum DefectNgType { |
| | | DefectNg_OK = 0, //OK |
| | | DefectNg_Chip, //Chip |
| | | DefectNg_Broken, //ç ´æ |
| | | DefectNg_Grind, //ç 磨 |
| | | DefectNg_Dist_Cut, //åå²ç²¾åº¦ |
| | | DefectNg_Corner_Dist, //è§ç²¾åº¦ |
| | | DefectNg_Unknown //æé误 |
| | | }; |
| | | |
| | | #define NG_INF_TOTAL 1000 |
| | | typedef struct _NgInfo |
| | | { |
| | | int eDir; //æ£æµé¢ |
| | | int id; //æ£æµID |
| | | CString strName; //åç§° |
| | | int xPosPxl; //Xä½ç½® |
| | | int yPosPxl; //Yä½ç½® |
| | | double result; //ç»æ Measure |
| | | double xResult; //ç»æ Chip |
| | | double yResult; //ç»æ Chip |
| | | double minValue; //ä¸é |
| | | double maxValue; //éå¶ |
| | | int ngType; //缺é·ç±»å |
| | | bool isRes; //æ£æµç»æ |
| | | int x1; //缺é·çæå°ç©å½¢ |
| | | int y1; //缺é·çæå°ç©å½¢ |
| | | int x2; //缺é·çæå°ç©å½¢ |
| | | int y2; //缺é·çæå°ç©å½¢ |
| | | int eVision; //è§è§ç®æ³ |
| | | }NgInfo; |
| | | |
| | | |
| | | //typedef std::function<void(int msgEvent, int x, int y, double rate, int pixel)> ImageVisionEvent; |
| | | //typedef std::function<void(int code, int eDir)> ImageVisionEvent; |
| | | |
| | | class IVisionEvent |
| | | { |
| | | public: |
| | | //1. æ¥æ¶å°æ°æ®äºä»¶ |
| | | using MsgReceivedEvent = void(*)(int code, int eDir); |
| | | |
| | | //2. æ¥å¿ä¿¡æ¯ |
| | | using MsgLogEvent = void(*)(int level, std::string strText); |
| | | |
| | | |
| | | public: |
| | | IVisionEvent(MsgReceivedEvent msgRcvCb = nullptr, MsgLogEvent msgLogEvent = nullptr) { |
| | | /* code */ |
| | | m_msgRcvCb = msgRcvCb; |
| | | m_msgLogCb = msgLogEvent; |
| | | }; |
| | | |
| | | void clear() { |
| | | /* code */ |
| | | m_msgRcvCb = NULL; |
| | | m_msgLogCb = NULL; |
| | | } |
| | | public: |
| | | MsgReceivedEvent m_msgRcvCb = NULL; |
| | | MsgLogEvent m_msgLogCb = NULL; |
| | | }; |
| | | |
| | | class ISoftVisionApp |
| | | { |
| | | public: |
| | | virtual ~ISoftVisionApp() {}; |
| | | |
| | | public: |
| | | //1. æå¼è§è§çªä½ |
| | | virtual int OpenVisionWindow(void) = 0; |
| | | virtual CDialogEx* CreateVisionWindow(void) = 0; |
| | | virtual int ReleaseWindow(CDialogEx *pDlg) = 0; |
| | | virtual void ChangeDimension(CDialogEx *pDlg, int nDir) = 0; |
| | | virtual void SetVisionOpen(BOOL isOpen) = 0; |
| | | |
| | | //2. 设置å±è½ |
| | | virtual void OpenKeySetWindow(void) = 0; |
| | | |
| | | //3. åæ è½¬æ¢ |
| | | virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl) = 0; |
| | | |
| | | //4. æ§è¡è§è§å¤ç |
| | | virtual int Execute(int eDir, NgInfo *ngArray) = 0; |
| | | |
| | | //5. 设置åè°æ¶é´ |
| | | virtual void setImageEventSignal(IVisionEvent *pEvent) = 0; |
| | | |
| | | //6. åæ è½¬æ¢ï¼ç»ä¸åæ ç³»ç» |
| | | virtual bool transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult) = 0; |
| | | |
| | | //7. æ£æµCut线 |
| | | virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I &result) = 0; |
| | | virtual double DistancePL(Point2D pose, Line2D line) = 0; |
| | | |
| | | //8. æ£æµNorchç¼ºé· |
| | | virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, |
| | | int szType, int xFzSize, int yFzSize, CRect* aryResult) = 0; |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef IVISION_RECIPE_H |
| | | #define IVISION_RECIPE_H |
| | | |
| | | #define EI_VISION_RECIPE 0 |
| | | #define RCUT_VISION_RECIPE 1 |
| | | #define NI_VISION_RECIPE 2 |
| | | |
| | | #include "BlSideData.h" |
| | | |
| | | //é
æ¹æ°æ®ç®¡ç |
| | | class IVisionRecipe |
| | | { |
| | | public: |
| | | virtual ~IVisionRecipe() {}; |
| | | |
| | | public: |
| | | //1. 设置é
æ¹è·¯å¾ |
| | | virtual int setWorkDir(const char *pszPath) = 0; |
| | | |
| | | //2. ä¿å |
| | | virtual int save(void) = 0; |
| | | |
| | | //3. æå¼ |
| | | virtual int open(void) = 0; |
| | | |
| | | //4. è·åééå¡ |
| | | virtual CGrabberControl* getGrabberControl(int iCam) = 0; |
| | | |
| | | //5. 设置ééå¼ |
| | | virtual int setGrabberControl(CGrabberControl *pGrabberControl, int iCam) = 0; |
| | | |
| | | //6. ç¸æºç¸æºä¿¡æ¯ |
| | | virtual int setCameraSetting(DimensionDir eDir, int iCam, int iScan) = 0; |
| | | |
| | | //7. åå§å |
| | | virtual int init(void) = 0; |
| | | |
| | | //8. è·åSideData |
| | | virtual CBlSideData* getSideData(DimensionDir eDir) = 0; |
| | | |
| | | //9. 设置é
æ¹ç±»å |
| | | virtual int setRecipeType(int nType) = 0; |
| | | |
| | | //10. è·åé
æ¹ç±»å |
| | | virtual int getRecipeType(void) = 0; |
| | | |
| | | //11. è·åä¿¡æ¯ |
| | | virtual bool getVisionUse(void) = 0; |
| | | |
| | | //12. 设置åºå |
| | | virtual void setFrame(int x1, int y1, int x2, int y2) = 0; |
| | | |
| | | //13. 设置é
æ¹åç§° |
| | | virtual int setVisionName(const char* pszPath) = 0; |
| | | virtual int setProductNo(const char* pszNo) = 0; |
| | | |
| | | //14. è·åé
æ¹åç§° |
| | | virtual std::string getVisionName(void) = 0; |
| | | |
| | | //15. 设置å±å¹å°ºå¯¸ |
| | | virtual void setGlassSize(int x, int y) = 0; |
| | | |
| | | //16. çªä½æ¯å¦æå¼ |
| | | virtual BOOL getVisionSetOpen(void) = 0; |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef INCLUDE_VISION_H |
| | | #define INCLUDE_VISION_H |
| | | |
| | | #define KEY_EI_SOFT 1 |
| | | |
| | | #if KEY_EI_SOFT |
| | | #include "../../EdgeInspector_App/Define/Global_Define.h" |
| | | #else |
| | | #include "../../ENRIT/Define/Global_Define.h" |
| | | #endif |
| | | |
| | | #include <HalconCpp.h> |
| | | #include "EiVisionType.h" |
| | | |
| | | //1. æ¥å¿æ¨¡å |
| | | #include "../SDK/LogSDK/include/ILogger.h" |
| | | #include "../SDK/LogSDK/include/LogLib.h" |
| | | #if _DEBUG |
| | | #pragma comment(lib,"../SDK/LogSDK/lib/x64/Release/Log.lib") |
| | | #else |
| | | #pragma comment(lib,"../SDK/LogSDK/lib/x64/Release/Log.lib") |
| | | #endif |
| | | |
| | | //2. æ¾ç¤ºæ¨¡å |
| | | #include "../SDK/BaseDisplaySDK/include/typesdef.h" |
| | | #include "../SDK/BaseDisplaySDK/include/BaseVision.h" |
| | | #include "../SDK/BaseDisplaySDK/include/IClsShape.h" |
| | | #include "../SDK/BaseDisplaySDK/include/IImageDisplay.h" |
| | | #include "../SDK/BaseDisplaySDK/include/BaseDisplayLib.h" |
| | | #if _DEBUG |
| | | #pragma comment(lib,"../SDK/BaseDisplaySDK/lib/x64/Debug/BaseDisplay.lib") |
| | | #else |
| | | #pragma comment(lib,"../SDK/BaseDisplaySDK/lib/x64/Release/BaseDisplay.lib") |
| | | #endif |
| | | |
| | | //3. Halcon æ¾ç¤ºæ¨¡å |
| | | #include "../SDK/ApiVisionSDK/include/ClsVision.h" |
| | | #include "../SDK/ApiVisionSDK/include/IClsDisplay.h" |
| | | #include "../SDK/ApiVisionSDK/include/VisionLib.h" |
| | | #if _DEBUG |
| | | #pragma comment(lib,"../SDK/ApiVisionSDK/lib/x64/Debug/ApiVisionLibrary.lib") |
| | | #else |
| | | #pragma comment(lib,"../SDK/ApiVisionSDK/lib/x64/Release/ApiVisionLibrary.lib") |
| | | #endif |
| | | |
| | | //4. ééå¡ä¿¡æ¯ |
| | | //11. é鿍¡å |
| | | #include "../SDK/BlGrabber/include/FrameBufferController.h" |
| | | #include "../SDK/BlGrabber/include/GrabberControl.h" |
| | | #if _DEBUG |
| | | #pragma comment (lib, "../SDK/BlGrabber/lib/x64/Debug/BlGrabberD.lib") |
| | | #else |
| | | #pragma comment (lib, "../SDK/BlGrabber/lib/x64/Release/BlGrabber.lib") |
| | | #endif |
| | | |
| | | //9. SISControl |
| | | #include "../SDK/SISControls/include/CellCtrl.h" |
| | | #include "../SDK/SISControls/include/ColorButton.h" |
| | | #include "../SDK/SISControls/include/DefectMap.h" |
| | | #include "../SDK/SISControls/include/FontStatic.h" |
| | | #include "../SDK/SISControls/include/GradientStatic.h" |
| | | #include "../SDK/SISControls/include/HeadCtrl.h" |
| | | #include "../SDK/SISControls/include/InPlaceComboBox.h" |
| | | #include "../SDK/SISControls/include/InPlaceEdit.h" |
| | | #include "../SDK/SISControls/include/LogCtrl.h" |
| | | #include "../SDK/SISControls/include/SISButton.h" |
| | | #include "../SDK/SISControls/include/SISFolderScheduling.h" |
| | | #include "../SDK/SISControls/include/SISJogBtn2Parent.h" |
| | | #include "../SDK/SISControls/include/SISJogButton.h" |
| | | #include "../SDK/SISControls/include/SISLabel.h" |
| | | #include "../SDK/SISControls/include/SISListBoxLog.h" |
| | | #include "../SDK/SISControls/include/SISListCtrlExt.h" |
| | | #include "../SDK/SISControls/include/SortClass.h" |
| | | #include "../SDK/SISControls/include/StaticMap.h" |
| | | #include "../SDK/SISControls/include/WKButton.h" |
| | | #include "../SDK/SISControls/include/XTabCtrl.h" |
| | | #include "../SDK/SISControls/GridControl/CellRange.h" |
| | | #include "../SDK/SISControls/GridControl/GridCell.h" |
| | | #include "../SDK/SISControls/GridControl/GridCellBase.h" |
| | | #include "../SDK/SISControls/GridControl/GridCellButton.h" |
| | | #include "../SDK/SISControls/GridControl/GridCtrl.h" |
| | | #include "../SDK/SISControls/GridControl/GridDropTarget.h" |
| | | #include "../SDK/SISControls/GridControl/GridInPlaceEdit.h" |
| | | #include "../SDK/SISControls/GridControl/GridMemDC.h" |
| | | #include "../SDK/SISControls/GridControl/TitleTip.h" |
| | | #include "../SDK/SISControls/GridControl/NewCellTypes/GridCellCheck.h" |
| | | #include "../SDK/SISControls/GridControl/NewCellTypes/GridCellCombo.h" |
| | | #include "../SDK/SISControls/GridControl/NewCellTypes/GridCellDateTime.h" |
| | | #include "../SDK/SISControls/GridControl/NewCellTypes/GridCellNumeric.h" |
| | | #include "../SDK/SISControls/GridControl/NewCellTypes/GridURLCell.h" |
| | | #if _DEBUG |
| | | #pragma comment (lib, "../SDK/SISControls/lib/x64/Debug/SISControlsD.lib") |
| | | #else |
| | | #pragma comment (lib, "../SDK/SISControls/lib/x64/Release/SISControls.lib") |
| | | #endif |
| | | |
| | | #include "../SDK/JsoncppSDK/include/json.h" |
| | | #include "../SDK/JsoncppSDK/include/config.h" |
| | | #include "../SDK/JsoncppSDK/include/reader.h" |
| | | #include "../SDK/JsoncppSDK/include/value.h" |
| | | #include "../SDK/JsoncppSDK/include/writer.h" |
| | | #if _DEBUG |
| | | #pragma comment (lib, "../SDK/JsoncppSDK/lib/x64/Debug/jsoncpp.lib") |
| | | #else |
| | | #pragma comment (lib, "../SDK/JsoncppSDK/lib/x64/Release/jsoncpp.lib") |
| | | #endif |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | ======================================================================== |
| | | MICROSOFT åºç¡ç±»åº : BlVisionPro é¡¹ç®æ¦è¿° |
| | | ======================================================================== |
| | | |
| | | |
| | | åºç¨ç¨åºå导已为æ¨åå»ºäºæ¤ BlVisionPro DLLãæ¤ DLL ä¸ä»
æ¼ç¤º Microsoft åºç¡ç±»çåºæ¬ä½¿ç¨æ¹æ³ï¼è¿å¯ä½ä¸ºæ¨ç¼å DLL çèµ·ç¹ã |
| | | |
| | | æ¬æä»¶æ¦è¦ä»ç»ç»æ BlVisionPro DLL çæ¯ä¸ªæä»¶çå
容ã |
| | | |
| | | BlVisionPro.vcxproj |
| | | è¿æ¯ä½¿ç¨åºç¨ç¨åºå导çæç VC++ 项ç®çä¸»é¡¹ç®æä»¶ï¼å
¶ä¸å
å«çæè¯¥æä»¶ç Visual C++ ççæ¬ä¿¡æ¯ï¼ä»¥åæå
³ä½¿ç¨åºç¨ç¨åºå坼鿩çå¹³å°ãé
ç½®å项ç®åè½çä¿¡æ¯ã |
| | | |
| | | BlVisionPro.vcxproj.filters |
| | | è¿æ¯ä½¿ç¨âåºç¨ç¨åºå导âçæç VC++ 项ç®çé卿件ãå®å
嫿å
³é¡¹ç®æä»¶ä¸çéå¨ä¹é´çå
³èä¿¡æ¯ãå¨ IDE ä¸ï¼éè¿è¿ç§å
³èï¼å¨ç¹å®èç¹ä¸ä»¥åç»å½¢å¼æ¾ç¤ºå
·æç¸ä¼¼æ©å±åçæä»¶ãä¾å¦ï¼â.cppâæä»¶ä¸âæºæä»¶âçéå¨å
³èã |
| | | |
| | | BlVisionPro.h |
| | | è¿æ¯ DLL ç主头æä»¶ãå®å£°æäº CBlVisionProApp ç±»ã |
| | | |
| | | BlVisionPro.cpp |
| | | è¿æ¯ä¸» DLL æºæä»¶ãå®å
å« CBlVisionProApp ç±»ã |
| | | |
| | | BlVisionPro.rc |
| | | è¿æ¯ç¨åºä½¿ç¨çææ Microsoft Windows èµæºçå表ãå®å
æ¬ RES åç®å½ä¸åå¨ç徿 ãä½å¾åå
æ ãæ¤æä»¶å¯ä»¥ç´æ¥å¨ Microsoft Visual C++ ä¸è¿è¡ç¼è¾ã |
| | | |
| | | res\BlVisionPro.rc2 |
| | | æ¤æä»¶å
å«ä¸å¨ Microsoft Visual C++ ä¸è¿è¡ç¼è¾çèµæºãæ¨åºè¯¥å°ä¸å¯ç±èµæºç¼è¾å¨ç¼è¾çææèµæºæ¾å¨æ¤æä»¶ä¸ã |
| | | |
| | | BlVisionPro.def |
| | | æ¤æä»¶å
å«å¨ Microsoft Windows ä¸è¿è¡æå¿
éç DLL çæå
³ä¿¡æ¯ãå®å®ä¹äº DLL çåç§°å说æçåæ°ï¼èä¸è¿ä» DLL 导åºå½æ°ã |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | å
¶ä»æ åæä»¶: |
| | | |
| | | StdAfx.h, StdAfx.cpp |
| | | è¿äºæä»¶ç¨äºçæå为 BlVisionPro.pch çé¢ç¼è¯å¤´ (PCH) æä»¶åå为 StdAfx.obj çé¢ç¼è¯ç±»åæä»¶ã |
| | | |
| | | Resource.h |
| | | è¿æ¯æ å头æä»¶ï¼å¯ç¨äºå®ä¹æ°çèµæº IDãMicrosoft Visual C++ å°è¯»åå¹¶æ´æ°æ¤æä»¶ã |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | å
¶ä»æ³¨é: |
| | | |
| | | åºç¨ç¨åºå导使ç¨âTODO:âæ¥æç¤ºåºæ·»å æèªå®ä¹çæºä»£ç é¨åã |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ChipInspectDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "ChipInspectDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | #include "InChipDotProcess.h" |
| | | |
| | | // CChipInspectDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CChipInspectDlg, CDialogEx) |
| | | |
| | | CChipInspectDlg::CChipInspectDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_CHIP_INSPECT, pParent) |
| | | , m_imageIndex(1) |
| | | , m_nMinX(0) |
| | | , m_nMaxX(0) |
| | | , m_nEdgeChipThres(20) |
| | | { |
| | | m_display = NULL; |
| | | m_ptMouseUp.x = 0; |
| | | m_ptMouseUp.y = 0; |
| | | } |
| | | |
| | | CChipInspectDlg::~CChipInspectDlg() |
| | | { |
| | | if (NULL != m_display) { |
| | | ClsDisplay_Free(m_display); |
| | | m_display = NULL; |
| | | } |
| | | } |
| | | |
| | | void CChipInspectDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_COMBO_SIDE_INDEX_INCHIP, m_combSide); |
| | | DDX_Text(pDX, IDC_EDIT_IMAGE_INDEX_INCHIP, m_imageIndex); |
| | | DDX_Text(pDX, IDC_EDIT_INCHIP_MINX, m_nMinX); |
| | | DDX_Text(pDX, IDC_EDIT_INCHIP_MAXX, m_nMaxX); |
| | | DDX_Text(pDX, IDC_EDIT_EDGE_THRES_INCHIP, m_nEdgeChipThres); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CChipInspectDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_GET_IMAGE_INCHIP, &CChipInspectDlg::OnBnClickedButtonGetImageInchip) |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCESS_INCHIP, &CChipInspectDlg::OnBnClickedButtonProcessInchip) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CChipInspectDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CChipInspectDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | BOOL CChipInspectDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitDisplay(); |
| | | |
| | | InitUiParam(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | void CChipInspectDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | void CChipInspectDlg::InitDisplay(void) { |
| | | /* code */ |
| | | m_display = ClsDisplay_Create(); |
| | | if (nullptr != m_display) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_IMAGE_INCHIP); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_display->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_display->SetOperFlag(SELECT_OPER_FLAG); |
| | | m_display->SetDraw("fill", DISP_OBJECT); |
| | | m_display->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_display->SetDraw("fill", DISP_REGION); |
| | | m_display->SetColor("red", DISP_REGION); |
| | | |
| | | m_display->SetDraw("fill", DISP_CROSS); |
| | | m_display->SetColor("green", DISP_CROSS); |
| | | |
| | | m_display->SetDraw("fill", DISP_SELECT); |
| | | m_display->SetColor("red", DISP_SELECT); |
| | | |
| | | std::string color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_display->SetBackgroundColor(color); |
| | | m_display->SetOperatorCallback([&](int msgEvent, int x, int y, double rate, int pixel) ->void { |
| | | MouseEventProc(msgEvent, x, y); //1. è¡¨ç¤ºæ«æ |
| | | }); |
| | | } |
| | | } |
| | | |
| | | void CChipInspectDlg::MouseEventProc(int msgEvent, int x, int y) { |
| | | /* code */ |
| | | BOOL isChange = FALSE; |
| | | if (LEFT_MOUSE_BUTTON_UP == msgEvent) { |
| | | m_ptMouseUp.x = x; |
| | | m_ptMouseUp.y = y; |
| | | isChange = TRUE; |
| | | } |
| | | |
| | | CString msg; |
| | | msg.Format(_T("Pose: (%d, %d)"), m_ptMouseUp.x, m_ptMouseUp.y); |
| | | std::string str = CFileRecipe::toString(msg); |
| | | if (isChange) { |
| | | m_display->ClearWindow(); |
| | | m_display->DispImage(); |
| | | } |
| | | m_display->DispMessage(30, 30, str, "blue", "false"); |
| | | } |
| | | |
| | | void CChipInspectDlg::OnBnClickedButtonGetImageInchip() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | UpdateData(TRUE); |
| | | |
| | | int nSide = m_combSide.GetCurSel(); |
| | | DimensionDir eDir = (DimensionDir)nSide; |
| | | if (!CVisionBufferPro::getIndexImage(eDir, &m_display->GetImage(), m_imageIndex)) return; |
| | | |
| | | m_display->ClearWindow(); |
| | | m_display->DispImage(); |
| | | } |
| | | |
| | | void CChipInspectDlg::InitUiParam(void) { |
| | | /* code */ |
| | | m_combSide.InsertString(0, _T("TopA")); |
| | | m_combSide.InsertString(1, _T("TopB")); |
| | | m_combSide.InsertString(2, _T("TopC")); |
| | | m_combSide.InsertString(3, _T("TopD")); |
| | | m_combSide.InsertString(4, _T("DotA")); |
| | | m_combSide.InsertString(5, _T("DotB")); |
| | | m_combSide.InsertString(6, _T("DotC")); |
| | | m_combSide.InsertString(7, _T("DotD")); |
| | | m_combSide.SetCurSel(0); |
| | | } |
| | | |
| | | |
| | | void CChipInspectDlg::OnBnClickedButtonProcessInchip() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | UpdateData(TRUE); |
| | | |
| | | int nSide = m_combSide.GetCurSel(); |
| | | DimensionDir eDir = (DimensionDir)nSide; |
| | | CInChipDotProcess *dot = new CInChipDotProcess(eDir); |
| | | |
| | | Point2I ptStart, ptEnd; |
| | | ptStart.x = m_nMinX; |
| | | ptStart.y = 0; |
| | | ptEnd.x = m_nMaxX; |
| | | ptEnd.y = 1023; |
| | | dot->m_threshold = m_nEdgeChipThres; |
| | | dot->Execute(eDir, m_imageIndex, ptStart, ptEnd); |
| | | |
| | | delete dot; |
| | | dot = NULL; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxwin.h" |
| | | |
| | | |
| | | // CChipInspectDlg å¯¹è¯æ¡ |
| | | |
| | | class CChipInspectDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CChipInspectDlg) |
| | | |
| | | public: |
| | | CChipInspectDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CChipInspectDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_CHIP_INSPECT }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnClose(); |
| | | afx_msg void OnBnClickedButtonGetImageInchip(); |
| | | |
| | | private: |
| | | IClsDisplay *m_display; |
| | | CComboBox m_combSide; |
| | | int m_imageIndex; |
| | | Point2I m_ptMouseUp; |
| | | |
| | | int m_nMinX; |
| | | int m_nMaxX; |
| | | int m_nEdgeChipThres; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | void InitDisplay(void); |
| | | |
| | | //2. çé¢åå§å |
| | | void InitUiParam(void); |
| | | |
| | | //3. æ§è¡ |
| | | void MouseEventProc(int msgEvent, int x, int y); |
| | | |
| | | public: |
| | | afx_msg void OnBnClickedButtonProcessInchip(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CornerDistSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "CornerDistSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "MeasureSetDlg.h" |
| | | |
| | | // CCornerDistSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CCornerDistSetDlg, CDialogEx) |
| | | |
| | | CCornerDistSetDlg::CCornerDistSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DLG_DIST_CORNER, pParent) |
| | | , m_id(0) |
| | | , m_strName(_T("NULL")) |
| | | , m_refer(100) |
| | | , m_refer_(100) |
| | | , m_minValue(0) |
| | | , m_maxValue(0) |
| | | , m_minValue2(0) |
| | | , m_maxValue2(0) |
| | | , m_incValue(0) |
| | | , m_incValue2(0) |
| | | { |
| | | m_topMark.x = 0; |
| | | m_topMark.y = 0; |
| | | m_botMark.x = 0; |
| | | m_botMark.y = 0; |
| | | m_topPoint.x = 0; |
| | | m_topPoint.y = 0; |
| | | m_botPoint.x = 0; |
| | | m_botPoint.y = 0; |
| | | |
| | | m_pos.x = 0; |
| | | m_pos.y = 0; |
| | | |
| | | m_eDir = DIMENSION_NONE; |
| | | |
| | | m_dotDist = NULL; |
| | | m_dot = NULL; |
| | | } |
| | | |
| | | CCornerDistSetDlg::~CCornerDistSetDlg() |
| | | { |
| | | SaveDistCorner(); |
| | | SaveDistDotProcess(); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST_DIST_DOT, m_listCornerPoint); |
| | | DDX_Control(pDX, IDC_COMBOMK_FIRST_REFER_TYPE_DIST, m_combFrirtRefer); //First Refer |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_TOP_MARK_X_DIST, m_topMark.x); //Top Mark |
| | | DDX_Text(pDX, IDC_EDIT_TOP_MARK_Y_DIST, m_topMark.y); |
| | | DDX_Text(pDX, IDC_EDIT_BOT_MARK_X_DIST, m_botMark.x); //Bot Mark |
| | | DDX_Text(pDX, IDC_EDIT_BOT_MARK_Y_DIST, m_botMark.y); |
| | | DDX_Text(pDX, IDC_EDIT_TOP_POINT_X_DIST, m_topPoint.x); //Top Point |
| | | DDX_Text(pDX, IDC_EDIT_TOP_POINT_Y_DIST, m_topPoint.y); |
| | | DDX_Text(pDX, IDC_EDIT_BOT_POINT_X_DIST, m_botPoint.x); //Bot Point |
| | | DDX_Text(pDX, IDC_EDIT_BOT_POINT_Y_DIST, m_botPoint.y); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_ID_DIST, m_id); |
| | | DDX_Text(pDX, IDC_EDIT_NAME_DIST, m_strName); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_POS_X_DIST, m_pos.x); |
| | | DDX_Text(pDX, IDC_EDIT_POS_Y_DIST, m_pos.y); |
| | | DDX_Text(pDX, IDC_EDIT_INC_REFER_DIST, m_refer); |
| | | DDX_Text(pDX, IDC_EDIT_DEC_REFER_DIST, m_refer_); |
| | | |
| | | DDX_Control(pDX, IDC_COMBO_DIST_MODE_DIST, m_combDistMode); //DIST Mode |
| | | DDX_Text(pDX, IDC_EDIT_MIN_VAL_DIST, m_minValue); |
| | | DDX_Text(pDX, IDC_EDIT_MAX_VAL_DIST, m_maxValue); |
| | | |
| | | DDX_Control(pDX, IDC_COMBO_DIST_MODE_DIST2, m_combDistMode2); //DIST Mode |
| | | DDX_Text(pDX, IDC_EDIT_MIN_VAL_DIST2, m_minValue2); |
| | | DDX_Text(pDX, IDC_EDIT_MAX_VAL_DIST2, m_maxValue2); |
| | | |
| | | DDX_Control(pDX, IDC_COMBO_NG_TYPE_DIST, m_combNgType); //DIST Mode |
| | | DDX_Control(pDX, IDC_COMBO_NG_TYPE_DIST2, m_combNgType2); //DIST Mode |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_INC_DIST, m_incValue); |
| | | DDX_Text(pDX, IDC_EDIT_INC_DIST2, m_incValue2); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CCornerDistSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_NOTIFY(NM_CLICK, IDC_LIST_DIST_DOT, &CCornerDistSetDlg::OnNMClickListDistDot) |
| | | ON_BN_CLICKED(IDC_BUTTON_MODEL_ROI, &CCornerDistSetDlg::OnBnClickedButtonModelRoi) |
| | | ON_BN_CLICKED(IDC_BUTTON_MEASURE_ROI, &CCornerDistSetDlg::OnBnClickedButtonMeasureRoi) |
| | | ON_BN_CLICKED(IDC_BUTTON_DIST_TEST_ALL, &CCornerDistSetDlg::OnBnClickedButtonDistTestAll) |
| | | ON_BN_CLICKED(IDC_BUTTON_LOCK_MARK_DIST, &CCornerDistSetDlg::OnBnClickedButtonLockMarkDist) |
| | | ON_BN_CLICKED(IDC_BUTTON_COPY_TOP_MARK_DIST, &CCornerDistSetDlg::OnBnClickedButtonCopyTopMarkDist) |
| | | ON_NOTIFY(NM_RCLICK, IDC_LIST_DIST_DOT, &CCornerDistSetDlg::OnNMRClickListDistDot) |
| | | ON_COMMAND(ID_VISION_DELETE, &CCornerDistSetDlg::OnVisionDelete) |
| | | ON_COMMAND(ID_ADD_DIST, &CCornerDistSetDlg::OnAddDist) |
| | | ON_COMMAND(ID_Menu_Measure_Set, &CCornerDistSetDlg::OnMenuMeasureSet) |
| | | ON_COMMAND(ID_EDITROI_DRAWKEYROI, &CCornerDistSetDlg::OnEditroiDrawkeyroi) |
| | | ON_COMMAND(ID_EDITROI_DRAWMEASUREROI, &CCornerDistSetDlg::OnEditroiDrawmeasureroi) |
| | | ON_COMMAND(ID_EDITROI_DELETEALLROI, &CCornerDistSetDlg::OnEditroiDeleteallroi) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CDistCornerSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CCornerDistSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | //1. çªä½UI |
| | | InitWindUi(); |
| | | |
| | | ChangeVisionType(DIMENSION_NONE); |
| | | |
| | | m_eDotIndex = -1; |
| | | ChangeCornerDotIdx(-1); |
| | | |
| | | //3. æ¾ç¤ºææçåæ° |
| | | dispListParam(); |
| | | |
| | | LockImage(-1); |
| | | m_isLockPoint = TRUE; |
| | | LockMark(m_isLockPoint); |
| | | |
| | | InitMenu(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CCornerDistSetDlg::InitWindUi(void) { |
| | | /* code */ |
| | | InitPointUi(); |
| | | |
| | | m_combFrirtRefer.InsertString(0, _T("First Type")); |
| | | m_combFrirtRefer.InsertString(1, _T("Second Type")); |
| | | m_combFrirtRefer.InsertString(2, _T("Thrid Type")); |
| | | m_combFrirtRefer.InsertString(3, _T("Fourth Type")); |
| | | m_combFrirtRefer.SetCurSel(0); |
| | | |
| | | m_combDistMode.InsertString(0, _T("false")); |
| | | m_combDistMode.InsertString(1, _T("Grind Size")); |
| | | m_combDistMode.InsertString(2, _T("Top Point")); |
| | | m_combDistMode.InsertString(3, _T("Bot Point")); |
| | | m_combDistMode.InsertString(4, _T("Key Dist")); |
| | | m_combDistMode.InsertString(5, _T("Cut Dist")); |
| | | m_combDistMode.SetCurSel(0); |
| | | |
| | | m_combDistMode2.InsertString(0, _T("false")); |
| | | m_combDistMode2.InsertString(1, _T("Grind Size")); |
| | | m_combDistMode2.InsertString(2, _T("Top Point")); |
| | | m_combDistMode2.InsertString(3, _T("Bot Point")); |
| | | m_combDistMode2.InsertString(4, _T("Key Dist")); |
| | | m_combDistMode2.InsertString(5, _T("Cut Dist")); |
| | | m_combDistMode2.SetCurSel(0); |
| | | |
| | | const CString ng_array_type[] = { |
| | | _T("Chip"), |
| | | _T("Broken"), |
| | | _T("Grind"), |
| | | _T("Dist Cut"), |
| | | _T("Corner Dist"), |
| | | _T("Unkown NG") |
| | | }; |
| | | int ngNum = 6; |
| | | for (int i = 0; i < ngNum; i++) { |
| | | m_combNgType.InsertString(i, ng_array_type[i]); |
| | | m_combNgType2.InsertString(i, ng_array_type[i]); |
| | | } |
| | | m_combNgType.SetCurSel(2); |
| | | m_combNgType2.SetCurSel(3); |
| | | |
| | | CString strCaption = _T(""); |
| | | GetDlgItem(IDC_STATIC_DIST_RESULT_DIST)->SetWindowText(strCaption); |
| | | GetDlgItem(IDC_STATIC_DIST_RESULT_DIST2)->SetWindowText(strCaption); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::InitPointUi(void) { |
| | | /* code */ |
| | | CRect rect; |
| | | m_listCornerPoint.GetClientRect(&rect); |
| | | |
| | | // 为å表è§å¾æ§ä»¶æ·»å å
¨è¡éä¸åæ
æ ¼é£æ ¼ |
| | | m_listCornerPoint.SetExtendedStyle(m_listCornerPoint.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_DOUBLEBUFFER); |
| | | |
| | | // 为å表è§å¾æ§ä»¶æ·»å ä¸å |
| | | int nCount = 13; |
| | | m_listCornerPoint.InsertColumn(0, _T("ID"), LVCFMT_CENTER, rect.Width() / nCount, 0); |
| | | m_listCornerPoint.InsertColumn(1, _T("Name"), LVCFMT_CENTER, rect.Width() / nCount, 1); |
| | | m_listCornerPoint.InsertColumn(2, _T("Refer Index"), LVCFMT_CENTER, rect.Width() / nCount, 2); |
| | | m_listCornerPoint.InsertColumn(3, _T("X"), LVCFMT_CENTER, rect.Width() / nCount, 3); |
| | | m_listCornerPoint.InsertColumn(4, _T("Y"), LVCFMT_CENTER, rect.Width() / nCount, 4); |
| | | m_listCornerPoint.InsertColumn(5, _T("Pos+"), LVCFMT_CENTER, rect.Width() / nCount, 5); |
| | | m_listCornerPoint.InsertColumn(6, _T("Pos-"), LVCFMT_CENTER, rect.Width() / nCount, 6); |
| | | m_listCornerPoint.InsertColumn(7, _T("First Judge"), LVCFMT_CENTER, rect.Width() / nCount, 7); |
| | | m_listCornerPoint.InsertColumn(8, _T("Min1"), LVCFMT_CENTER, rect.Width() / nCount, 8); |
| | | m_listCornerPoint.InsertColumn(9, _T("Max1"), LVCFMT_CENTER, rect.Width() / nCount, 9); |
| | | m_listCornerPoint.InsertColumn(10, _T("Second Judge"), LVCFMT_CENTER, rect.Width() / nCount, 10); |
| | | m_listCornerPoint.InsertColumn(11, _T("Min2"), LVCFMT_CENTER, rect.Width() / nCount, 11); |
| | | m_listCornerPoint.InsertColumn(12, _T("Max2"), LVCFMT_CENTER, rect.Width() / nCount, 12); |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | BOOL CCornerDistSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveDistCorner(); |
| | | |
| | | //2. æ¾ç¤ºå½åçæ°æ® |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getCornerDistProcess(eDir); |
| | | ShowDistCornerParam(); |
| | | |
| | | ChangeCornerDotIdx(-1); |
| | | int curIndex = m_eDotIndex; |
| | | ChangeCornerDotIdx(curIndex); |
| | | |
| | | LockMark(TRUE); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::ShowDistCornerParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | m_topMark = m_dot->getPoint(0); |
| | | m_botMark = m_dot->getPoint(1); |
| | | m_topPoint = m_dot->getPoint(2); |
| | | m_botPoint = m_dot->getPoint(3); |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::SaveDistCorner(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::ChangeCornerDotIdx(int eIdx) { |
| | | /* code */ |
| | | SaveDistDotProcess(); |
| | | |
| | | if (eIdx == m_eDotIndex) { |
| | | return; |
| | | } |
| | | |
| | | m_eDotIndex = eIdx; |
| | | m_dotDist = m_dot->getDot(eIdx); |
| | | |
| | | ShowDistDotParam(); |
| | | LockImage(-1); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::ShowDistDotParam(void) { |
| | | /* code */ |
| | | if (-1 == m_eDotIndex) return; |
| | | if (NULL == m_dotDist) return; |
| | | |
| | | m_combFrirtRefer.SetCurSel(m_dotDist->m_idxRefer); |
| | | m_strName = m_dotDist->m_strName; |
| | | m_pos = m_dotDist->getPose(); |
| | | |
| | | m_id = m_dotDist->getID(); |
| | | m_refer = m_dotDist->m_nRef; |
| | | m_refer_ = m_dotDist->m_nRef_; |
| | | |
| | | m_combDistMode.SetCurSel(m_dotDist->m_distMode); |
| | | m_minValue = m_dotDist->m_minValue; |
| | | m_maxValue = m_dotDist->m_maxValue; |
| | | m_combNgType.SetCurSel(m_dotDist->m_ngType - 1); |
| | | m_incValue = m_dotDist->m_incValue; |
| | | |
| | | m_combDistMode2.SetCurSel(m_dotDist->m_distMode2); |
| | | m_minValue2 = m_dotDist->m_minValue2; |
| | | m_maxValue2 = m_dotDist->m_maxValue2; |
| | | m_combNgType2.SetCurSel(m_dotDist->m_ngType2 - 1); |
| | | m_incValue2 = m_dotDist->m_incValue2; |
| | | |
| | | //ä¿ååæ° |
| | | dispRegion(); |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::dispRegion(void) { |
| | | /* code */ |
| | | } |
| | | |
| | | void CCornerDistSetDlg::SaveDistDotProcess(void) { |
| | | /* code */ |
| | | if (NULL == m_dotDist) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | SaveDistCorner(); |
| | | |
| | | m_dotDist->m_idxRefer = m_combFrirtRefer.GetCurSel(); |
| | | m_dotDist->m_strName = m_strName; |
| | | m_dotDist->m_nRef = m_refer; |
| | | m_dotDist->m_nRef_ = m_refer_; |
| | | |
| | | m_dotDist->m_distMode = m_combDistMode.GetCurSel(); |
| | | m_dotDist->m_minValue = m_minValue; |
| | | m_dotDist->m_maxValue = m_maxValue; |
| | | m_dotDist->m_ngType = m_combNgType.GetCurSel() + 1; |
| | | m_dotDist->m_incValue = m_incValue; |
| | | |
| | | m_dotDist->m_distMode2 = m_combDistMode2.GetCurSel(); |
| | | m_dotDist->m_minValue2 = m_minValue2; |
| | | m_dotDist->m_maxValue2 = m_maxValue2; |
| | | m_dotDist->m_ngType2 = m_combNgType2.GetCurSel() + 1; |
| | | m_dotDist->m_incValue2 = m_incValue2; |
| | | |
| | | int nCount = m_listCornerPoint.GetItemCount(); |
| | | int id = m_dotDist->getID(); |
| | | std::vector<CDistDotProcess*> vDots = m_dot->getDots(); |
| | | |
| | | int nNum = (int)(vDots.size()); |
| | | if (nCount != nNum) return; |
| | | |
| | | Point2I pose; |
| | | for (int index = 0; index < nCount; index++){ |
| | | CDistDotProcess *pSelectDot = vDots.at(index); |
| | | if (NULL == pSelectDot) continue; |
| | | if (pSelectDot->getID() != id) continue; |
| | | CDistDotProcess *dot = m_dotDist; |
| | | if (NULL == dot) return; |
| | | CString strText; |
| | | int i = index; |
| | | //0. IDÖµ |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_listCornerPoint.SetItemText(i, 0, strText); |
| | | |
| | | //1. åç§° |
| | | strText = dot->m_strName; |
| | | m_listCornerPoint.SetItemText(i, 1, strText); |
| | | |
| | | //2. Refer Type |
| | | strText = _T("First Type"); |
| | | if (1 == dot->m_idxRefer) { |
| | | strText = _T("Second Type"); |
| | | } |
| | | else if (2 == dot->m_idxRefer) { |
| | | strText = _T("Third Type"); |
| | | } |
| | | else if (3 == dot->m_idxRefer) { |
| | | strText = _T("Fourth Type"); |
| | | } |
| | | m_listCornerPoint.SetItemText(i, 2, strText); |
| | | |
| | | //3. X |
| | | pose = dot->getPose(); |
| | | strText.Format(_T("%d"), pose.x); |
| | | m_listCornerPoint.SetItemText(i, 3, strText); |
| | | |
| | | //4. Y |
| | | strText.Format(_T("%d"), pose.y); |
| | | m_listCornerPoint.SetItemText(i, 4, strText); |
| | | |
| | | //5.ref |
| | | strText.Format(_T("%d"), dot->m_nRef); |
| | | m_listCornerPoint.SetItemText(i, 5, strText); |
| | | |
| | | //6. ref_ |
| | | strText.Format(_T("%d"), dot->m_nRef_); |
| | | m_listCornerPoint.SetItemText(i, 6, strText); |
| | | |
| | | //7. Dist Mode |
| | | strText = _T("false"); |
| | | if (1 == dot->m_distMode) { |
| | | strText = _T("Grind Size"); |
| | | } |
| | | else if (2 == dot->m_distMode) { |
| | | strText = _T("Top Point"); |
| | | } |
| | | else if (3 == dot->m_distMode) { |
| | | strText = _T("Bot Point"); |
| | | } |
| | | else if (4 == dot->m_distMode) { |
| | | strText = _T("Key Dist"); |
| | | } |
| | | else if (5 == dot->m_distMode) { |
| | | strText = _T("Cut Dist"); |
| | | } |
| | | m_listCornerPoint.SetItemText(i, 7, strText); |
| | | |
| | | //8. é»è¿è·ç¦»æå°å¼ |
| | | strText.Format(_T("%d"), dot->m_minValue); |
| | | m_listCornerPoint.SetItemText(i, 8, strText); |
| | | |
| | | //9. é»è¿è·ç¦»æå¤§å¼ |
| | | strText.Format(_T("%d"), dot->m_maxValue); |
| | | m_listCornerPoint.SetItemText(i, 9, strText); |
| | | |
| | | //10. Dist Mode |
| | | strText = _T("false"); |
| | | if (1 == dot->m_distMode2) { |
| | | strText = _T("Grind Size"); |
| | | } |
| | | else if (2 == dot->m_distMode2) { |
| | | strText = _T("Top Point"); |
| | | } |
| | | else if (3 == dot->m_distMode2) { |
| | | strText = _T("Bot Point"); |
| | | } |
| | | else if (4 == dot->m_distMode2) { |
| | | strText = _T("Key Dist"); |
| | | } |
| | | else if (5 == dot->m_distMode2) { |
| | | strText = _T("Cut Dist"); |
| | | } |
| | | m_listCornerPoint.SetItemText(i, 10, strText); |
| | | |
| | | //11. é»è¿è·ç¦»æå°å¼ |
| | | strText.Format(_T("%d"), dot->m_minValue2); |
| | | m_listCornerPoint.SetItemText(i, 11, strText); |
| | | |
| | | //12. é»è¿è·ç¦»æå¤§å¼ |
| | | strText.Format(_T("%d"), dot->m_maxValue2); |
| | | m_listCornerPoint.SetItemText(i, 12, strText); |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | int CCornerDistSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | dispListParam(); |
| | | return 0; |
| | | } |
| | | |
| | | void CCornerDistSetDlg::dispListParam(void) { |
| | | /* code */ |
| | | m_listCornerPoint.DeleteAllItems(); |
| | | if (NULL == m_dot) return; |
| | | |
| | | //1. è·åæ°æ® |
| | | std::vector<CDistDotProcess*> &vDots = m_dot->getDots(); |
| | | int nCount = (int)(vDots.size()); |
| | | if (nCount < 1) return; |
| | | |
| | | CString strText; |
| | | Point2I pose; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CDistDotProcess *dot = vDots.at(i); |
| | | if (NULL == dot) continue; |
| | | //0. IDÖµ |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_listCornerPoint.InsertItem(i, strText); |
| | | |
| | | //1. åç§° |
| | | strText = dot->m_strName; |
| | | m_listCornerPoint.SetItemText(i, 1, strText); |
| | | |
| | | //2. Refer Type |
| | | strText = _T("First Type"); |
| | | if (1 == dot->m_idxRefer) { |
| | | strText = _T("Second Type"); |
| | | } |
| | | else if (2 == dot->m_idxRefer) { |
| | | strText = _T("Third Type"); |
| | | } |
| | | else if (3 == dot->m_idxRefer) { |
| | | strText = _T("Fourth Type"); |
| | | } |
| | | m_listCornerPoint.SetItemText(i, 2, strText); |
| | | |
| | | //3. X |
| | | pose = dot->getPose(); |
| | | strText.Format(_T("%d"), pose.x); |
| | | m_listCornerPoint.SetItemText(i, 3, strText); |
| | | |
| | | //4. Y |
| | | strText.Format(_T("%d"), pose.y); |
| | | m_listCornerPoint.SetItemText(i, 4, strText); |
| | | |
| | | //5.ref |
| | | strText.Format(_T("%d"), dot->m_nRef); |
| | | m_listCornerPoint.SetItemText(i, 5, strText); |
| | | |
| | | //6. ref_ |
| | | strText.Format(_T("%d"), dot->m_nRef_); |
| | | m_listCornerPoint.SetItemText(i, 6, strText); |
| | | |
| | | //7. Dist Mode |
| | | strText = _T("false"); |
| | | if (1 == dot->m_distMode) { |
| | | strText = _T("Grind Size"); |
| | | } |
| | | else if (2 == dot->m_distMode) { |
| | | strText = _T("Top Point"); |
| | | } |
| | | else if (3 == dot->m_distMode) { |
| | | strText = _T("Bot Point"); |
| | | } |
| | | else if (4 == dot->m_distMode) { |
| | | strText = _T("Key Dist"); |
| | | } |
| | | else if (5 == dot->m_distMode) { |
| | | strText = _T("Cut Dist"); |
| | | } |
| | | m_listCornerPoint.SetItemText(i, 7, strText); |
| | | |
| | | //8. é»è¿è·ç¦»æå°å¼ |
| | | strText.Format(_T("%d"), dot->m_minValue); |
| | | m_listCornerPoint.SetItemText(i, 8, strText); |
| | | |
| | | //9. é»è¿è·ç¦»æå¤§å¼ |
| | | strText.Format(_T("%d"), dot->m_maxValue); |
| | | m_listCornerPoint.SetItemText(i, 9, strText); |
| | | |
| | | //10. Dist Mode |
| | | strText = _T("false"); |
| | | if (1 == dot->m_distMode2) { |
| | | strText = _T("Grind Size"); |
| | | } |
| | | else if (2 == dot->m_distMode2) { |
| | | strText = _T("Top Point"); |
| | | } |
| | | else if (3 == dot->m_distMode2) { |
| | | strText = _T("Bot Point"); |
| | | } |
| | | else if (4 == dot->m_distMode2) { |
| | | strText = _T("Key Dist"); |
| | | } |
| | | else if (5 == dot->m_distMode2) { |
| | | strText = _T("Cut Dist"); |
| | | } |
| | | m_listCornerPoint.SetItemText(i, 10, strText); |
| | | |
| | | //11. é»è¿è·ç¦»æå°å¼ |
| | | strText.Format(_T("%d"), dot->m_minValue2); |
| | | m_listCornerPoint.SetItemText(i, 11, strText); |
| | | |
| | | //12. é»è¿è·ç¦»æå¤§å¼ |
| | | strText.Format(_T("%d"), dot->m_maxValue2); |
| | | m_listCornerPoint.SetItemText(i, 12, strText); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnNMClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult) |
| | | { |
| | | LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | NM_LISTVIEW *plisCtrl = (NM_LISTVIEW *)pNMHDR; |
| | | CString strID = m_listCornerPoint.GetItemText(plisCtrl->iItem, 0); |
| | | int id = atoi(CW2A(strID.GetString())); |
| | | int eIdx = id; |
| | | ChangeCornerDotIdx(eIdx); |
| | | |
| | | *pResult = 0; |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnBnClickedButtonModelRoi() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnBnClickedButtonMeasureRoi() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | void CCornerDistSetDlg::LockImage(int nType) { |
| | | /* code */ |
| | | if (1 == nType) { |
| | | GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(TRUE); |
| | | GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(FALSE); |
| | | } |
| | | else if (2 == nType) { |
| | | GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(FALSE); |
| | | GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(TRUE); |
| | | } |
| | | else{ |
| | | GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(FALSE); |
| | | GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(FALSE); |
| | | } |
| | | } |
| | | |
| | | void CCornerDistSetDlg::LockMark(BOOL isLock) { |
| | | /* code */ |
| | | m_isLockPoint = isLock; |
| | | if (isLock) { |
| | | GetDlgItem(IDC_BUTTON_COPY_TOP_MARK_DIST)->EnableWindow(FALSE); |
| | | GetDlgItem(IDC_BUTTON_LOCK_MARK_DIST)->SetWindowTextW(L"Unlock"); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_BUTTON_COPY_TOP_MARK_DIST)->EnableWindow(TRUE); |
| | | GetDlgItem(IDC_BUTTON_LOCK_MARK_DIST)->SetWindowTextW(L"Lock"); |
| | | } |
| | | } |
| | | |
| | | void CCornerDistSetDlg::InitMenu(void) { |
| | | /* code */ |
| | | m_visionMenu.LoadMenu(IDR_MENU1); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnBnClickedButtonDistTestAll() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveDistCorner(); |
| | | SaveDistDotProcess(); |
| | | if (nullptr == m_dot) return; |
| | | |
| | | CString strCaption = _T(""); |
| | | GetDlgItem(IDC_STATIC_DIST_RESULT_DIST)->SetWindowText(strCaption); |
| | | GetDlgItem(IDC_STATIC_DIST_RESULT_DIST2)->SetWindowText(strCaption); |
| | | |
| | | m_dot->execute(m_eDir); |
| | | |
| | | dispAllPointResult(); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::dispAllPointResult(void) { |
| | | /* code */ |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnBnClickedButtonLockMarkDist() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (m_isLockPoint) { |
| | | m_isLockPoint = FALSE; |
| | | } |
| | | else { |
| | | m_isLockPoint = TRUE; |
| | | } |
| | | LockMark(m_isLockPoint); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnBnClickedButtonCopyTopMarkDist() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return; |
| | | |
| | | if (pSideData->m_bTopMark_Find) { |
| | | m_topMark.x = pSideData->m_mTopMark.x; |
| | | m_topMark.y = pSideData->m_mTopMark.y; |
| | | if (nullptr != m_dot) { |
| | | m_dot->setPoint(m_topMark, 0); |
| | | } |
| | | } |
| | | |
| | | if (pSideData->m_bBotMark_Find) { |
| | | m_botMark.x = pSideData->m_mBotMark.x; |
| | | m_botMark.y = pSideData->m_mBotMark.y; |
| | | if (nullptr != m_dot) { |
| | | m_dot->setPoint(m_botMark, 1); |
| | | } |
| | | } |
| | | |
| | | if (pSideData->m_bTopPoint_Find) { |
| | | m_topPoint = pSideData->m_mTopPoint; |
| | | if (nullptr != m_dot) { |
| | | m_dot->setPoint(m_topPoint, 2); |
| | | } |
| | | } |
| | | |
| | | if (pSideData->m_bBotPoint_Find) { |
| | | m_botPoint = pSideData->m_mBotPoint; |
| | | if (nullptr != m_dot) { |
| | | m_dot->setPoint(m_botPoint, 3); |
| | | } |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnNMRClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult) |
| | | { |
| | | LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | |
| | | POINT pos; // pos1; |
| | | GetCursorPos(&pos); |
| | | |
| | | CMenu *pDotMenu = m_visionMenu.GetSubMenu(0); |
| | | pDotMenu->TrackPopupMenu(TPM_LEFTALIGN, pos.x, pos.y, this); |
| | | |
| | | *pResult = 0; |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnVisionDelete() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | if (NULL == m_dot) return; |
| | | if (NULL == m_dotDist) return; |
| | | |
| | | int idDel = m_dotDist->getID(); |
| | | int id = m_dot->delDot(idDel); |
| | | dispListParam(); |
| | | //if (id < 0) { |
| | | // m_dotDist = NULL; |
| | | // return; |
| | | //} |
| | | |
| | | //m_eCornerIndex = id; |
| | | //m_dotDist = m_dot->getDot((int)id); |
| | | |
| | | //ShowDistDotParam(); |
| | | |
| | | //LockImage(TRUE); |
| | | //LocTop(TRUE); |
| | | //LockBot(TRUE); |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnAddDist() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | if (NULL == m_dot) return; |
| | | |
| | | SaveDistCorner(); |
| | | SaveDistDotProcess(); |
| | | |
| | | int id = m_dot->addDot(); |
| | | dispListParam(); |
| | | m_dotDist = m_dot->getDot(id); |
| | | m_eDotIndex = id; |
| | | |
| | | ShowDistDotParam(); |
| | | LockImage(-1); |
| | | } |
| | | |
| | | void CCornerDistSetDlg::OnMenuMeasureSet() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | if (NULL == m_dot) return; |
| | | |
| | | CMeasureSetDlg dlg; |
| | | dlg.SetDot(m_dot); |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnEditroiDrawkeyroi() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg()); |
| | | if (NULL == pMainDlg) return; |
| | | |
| | | LockImage(1); |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnEditroiDrawmeasureroi() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg()); |
| | | if (NULL == pMainDlg) return; |
| | | |
| | | LockImage(2); |
| | | } |
| | | |
| | | |
| | | void CCornerDistSetDlg::OnEditroiDeleteallroi() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | if (nullptr == m_dotDist) return; |
| | | |
| | | HalconCpp::HObject hRegion; |
| | | HalconCpp::GenEmptyObj(&hRegion); |
| | | m_dotDist->setRoiRegion(hRegion); |
| | | m_dotDist->setLineRegion(hRegion); |
| | | |
| | | dispRegion(); |
| | | dispListParam(); |
| | | ShowDistDotParam(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CCornerDistSetDlg å¯¹è¯æ¡ |
| | | #include "VisionRecipe.h" |
| | | #include "afxwin.h" |
| | | |
| | | enum CORNER_IMAGE_TYPE { |
| | | CORNER_IMAGE = 0, |
| | | CORNER_MEASURE_REGION, |
| | | CORNER_TOP_POINT, |
| | | CORNER_BOT_POINT |
| | | }; |
| | | |
| | | class CCornerDistSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CCornerDistSetDlg) |
| | | |
| | | public: |
| | | CCornerDistSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CCornerDistSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DLG_DIST_CORNER }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | CListCtrl m_listCornerPoint; |
| | | CCornerDistProcess *m_dot; |
| | | CDistDotProcess *m_dotDist; |
| | | |
| | | |
| | | CComboBox m_combFrirtRefer; //First Refer |
| | | |
| | | Point2I m_topMark; |
| | | Point2I m_botMark; |
| | | Point2I m_topPoint; |
| | | Point2I m_botPoint; |
| | | |
| | | int m_id; |
| | | CString m_strName; |
| | | Point2I m_pos; |
| | | int m_refer; |
| | | int m_refer_; |
| | | |
| | | CComboBox m_combDistMode; |
| | | int m_minValue; |
| | | int m_maxValue; |
| | | int m_incValue; |
| | | |
| | | CComboBox m_combDistMode2; |
| | | int m_minValue2; |
| | | int m_maxValue2; |
| | | int m_incValue2; |
| | | |
| | | // |
| | | DimensionDir m_eDir; |
| | | int m_eDotIndex; |
| | | |
| | | CMenu m_visionMenu; |
| | | |
| | | CComboBox m_combNgType; |
| | | CComboBox m_combNgType2; |
| | | |
| | | private: |
| | | BOOL m_isLockPoint; |
| | | |
| | | private: |
| | | //1. æ¾ç¤ºææçåæ° |
| | | void dispListParam(void); |
| | | |
| | | //2. åå§åç¹ä½çé¢ |
| | | void InitPointUi(void); |
| | | |
| | | //4. åå§åUIçé¢ |
| | | void InitWindUi(void); |
| | | |
| | | //5. æ§è¡ |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | |
| | | //6. æ§è¡ |
| | | void ChangeCornerDotIdx(int eIdx); |
| | | |
| | | //7. ä¿åæ°æ® |
| | | void SaveDistCorner(void); |
| | | |
| | | //8. æ¾ç¤ºå½åçæ°æ® |
| | | void ShowDistCornerParam(void); |
| | | |
| | | //9. ä¿åæ°æ® |
| | | void SaveDistDotProcess(void); |
| | | |
| | | //10. æ¾ç¤ºå½åçè§è§åæ° |
| | | void ShowDistDotParam(void); |
| | | |
| | | //11. æ¾ç¤ºåºå |
| | | void dispRegion(void); |
| | | |
| | | //12. éæä½ |
| | | void LockImage(int nType); |
| | | |
| | | //14. æ¾ç¤ºææçææçè§è§æ£æµç¹ |
| | | void dispAllPointResult(void); |
| | | |
| | | //17. æ·éMARK |
| | | void LockMark(BOOL isLock); |
| | | |
| | | //18. åå§åèå |
| | | void InitMenu(void); |
| | | |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnClose(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | int setDimensionDir(DimensionDir eDir); |
| | | afx_msg void OnNMClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult); |
| | | afx_msg void OnBnClickedButtonModelRoi(); |
| | | afx_msg void OnBnClickedButtonMeasureRoi(); |
| | | afx_msg void OnBnClickedButtonDistTestAll(); |
| | | afx_msg void OnBnClickedButtonLockMarkDist(); |
| | | afx_msg void OnBnClickedButtonCopyTopMarkDist(); |
| | | afx_msg void OnNMRClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult); |
| | | afx_msg void OnVisionDelete(); |
| | | afx_msg void OnAddDist(); |
| | | afx_msg void OnMenuMeasureSet(); |
| | | afx_msg void OnEditroiDrawkeyroi(); |
| | | afx_msg void OnEditroiDrawmeasureroi(); |
| | | afx_msg void OnEditroiDeleteallroi(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CutSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "CutSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | |
| | | // CCutSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CCutSetDlg, CDialogEx) |
| | | |
| | | CCutSetDlg::CCutSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_CUTLINE_SET, pParent) |
| | | { |
| | | /* code */ |
| | | m_dot = NULL; |
| | | m_eDir = DIMENSION_NONE; |
| | | } |
| | | |
| | | CCutSetDlg::~CCutSetDlg(){ |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | } |
| | | |
| | | void CCutSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Control(pDX, IDC_PANEL_CUTLINE_INFO_CUT, m_PanelCutLine); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CCutSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCESS_CUT, &CCutSetDlg::OnBnClickedButtonProcessCut) |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_CUT, &CCutSetDlg::OnBnClickedButtonSaveCut) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CCutSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CCutSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitPanel(); |
| | | |
| | | m_eDir = DIMENSION_NONE; |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CCutSetDlg::InitPanel(void) { |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | |
| | | CString strText; |
| | | //1. ID |
| | | strText = _T("ID."); |
| | | m_vParams.push_back(strText); |
| | | //2. Name |
| | | strText = _T("Name"); |
| | | m_vParams.push_back(strText); |
| | | //3. Use |
| | | strText = _T("use"); |
| | | m_vParams.push_back(strText); |
| | | //4. Pos Type |
| | | strText = _T("Pos Type"); |
| | | m_vParams.push_back(strText); |
| | | //5. line thres |
| | | strText = _T("line thres"); |
| | | m_vParams.push_back(strText); |
| | | //6. Pos Y |
| | | strText = _T("Top Y(um)"); |
| | | m_vParams.push_back(strText); |
| | | //7. Pos X |
| | | strText = _T("Std Dist(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 8.Inc |
| | | strText = _T("Inc(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 9.Min |
| | | strText = _T("Min(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 10.Max |
| | | strText = _T("Max(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 11.Result |
| | | strText = _T("Result(um)"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | int nRows = 51; |
| | | int nCols = (int)(m_vParams.size()); |
| | | int nFixRows = 1; |
| | | int nFixCols = 0; |
| | | int nRowIdx = 0; |
| | | int nColIdx = 0; |
| | | |
| | | m_PanelCutLine.DeleteAllItems(); |
| | | m_PanelCutLine.SetVirtualMode(FALSE); |
| | | m_PanelCutLine.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelCutLine.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelCutLine.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); |
| | | m_PanelCutLine.SetFixedTextColor(_gGridFixFontColor); |
| | | |
| | | m_PanelCutLine.SetRowCount(nRows); |
| | | m_PanelCutLine.SetColumnCount(nCols); |
| | | m_PanelCutLine.SetFixedRowCount(nFixRows); |
| | | m_PanelCutLine.SetFixedColumnCount(nFixCols); |
| | | |
| | | CFont *pFont = m_PanelCutLine.GetFont(); |
| | | if (pFont){ |
| | | LOGFONT lf; |
| | | pFont->GetLogFont(&lf); |
| | | lf.lfItalic = 0; |
| | | lf.lfHeight = 14; |
| | | lf.lfWeight = FW_BOLD; |
| | | _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); |
| | | |
| | | m_PanelCutLine.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); |
| | | m_PanelCutLine.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); |
| | | m_PanelCutLine.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); |
| | | m_PanelCutLine.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); |
| | | } |
| | | |
| | | // Col |
| | | for (int i = 0; i < nCols; i++) { |
| | | if (1 == i) { |
| | | m_PanelCutLine.SetColumnWidth(nColIdx, 115); |
| | | } |
| | | else if (0 == i) { |
| | | m_PanelCutLine.SetColumnWidth(nColIdx, 50); |
| | | } |
| | | else { |
| | | m_PanelCutLine.SetColumnWidth(nColIdx, 75); |
| | | } |
| | | strText = m_vParams[i]; |
| | | m_PanelCutLine.SetItemText(nRowIdx, nColIdx++, strText); |
| | | } |
| | | |
| | | for (int i = 1; i < nRows; i++) |
| | | { |
| | | m_PanelCutLine.GetCell(i, 0)->SetState(GVIS_READONLY); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CCutSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | BOOL CCutSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | void CCutSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveCutLineParam(); |
| | | |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getCutProcess(eDir); |
| | | |
| | | ShowCutLineParam(); |
| | | } |
| | | |
| | | void CCutSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | } |
| | | |
| | | |
| | | void CCutSetDlg::OnBnClickedButtonProcessCut() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { |
| | | pSideData->m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | SaveCutLineParam(); |
| | | |
| | | if (NULL == m_dot) return; |
| | | |
| | | m_dot->Execute(m_eDir); |
| | | |
| | | DispAllResult(); |
| | | } |
| | | |
| | | void CCutSetDlg::DispAllResult(void) { |
| | | /* code */ |
| | | int nCount = 50; |
| | | for (int i = 0; i < 50; i++) { |
| | | CCutDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | bool isDo = true; |
| | | if (1 != dot->m_nUse) isDo = false; |
| | | if (!isDo) { |
| | | int id = dot->getID(); |
| | | m_PanelCutLine.SetItemText(id, 10, _T("NAN")); |
| | | } |
| | | else{ //æ¾ç¤ºç»æ |
| | | CString strResult; |
| | | strResult.Format(_T("%.1f"), dot->m_distResult); |
| | | int id = dot->getID(); |
| | | m_PanelCutLine.SetItemText(id, 10, strResult); |
| | | } |
| | | } |
| | | CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); |
| | | |
| | | m_PanelCutLine.Invalidate(FALSE); |
| | | } |
| | | |
| | | void CCutSetDlg::SaveCutLineParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | { |
| | | CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_CUT)); |
| | | int iUse = pBtnUse->GetCheck(); |
| | | m_dot->m_isUse = (1 == iUse); |
| | | } |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 50; i++) { |
| | | CCutDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | idx += 1; |
| | | |
| | | //2. Use Name |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_strName = strText; |
| | | idx += 1; |
| | | |
| | | //3. ID |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nUse = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //4. Pos Type |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_poseType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //5. line thres |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nEdgeThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //6. Pos Y |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nPosY = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //7. Pos X |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nPosX = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //8. Inc |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nInc = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //9. Min |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nMin = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //10. Max |
| | | strText = m_PanelCutLine.GetItemText(idRow, idx); |
| | | dot->m_nMax = _wtoi(strText); |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | void CCutSetDlg::ShowCutLineParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | { |
| | | CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_CUT)); |
| | | int iUse = 0; |
| | | if (m_dot->m_isUse) iUse = 1; |
| | | pBtnUse->SetCheck(iUse); |
| | | } |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 50; i++) { |
| | | CCutDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = dot->m_strName; |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText.Format(_T("%d"), dot->m_nUse); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //4. Pose Type |
| | | strText.Format(_T("%d"), dot->m_poseType); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //5. line thres |
| | | strText.Format(_T("%d"), dot->m_nEdgeThres); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //6. Pos Y |
| | | strText.Format(_T("%d"), dot->m_nPosY); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //7. Pos X |
| | | strText.Format(_T("%d"), dot->m_nPosX); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //8. Inc |
| | | strText.Format(_T("%d"), dot->m_nInc); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //9. Min |
| | | strText.Format(_T("%d"), dot->m_nMin); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //10. Max |
| | | strText.Format(_T("%d"), dot->m_nMax); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //11. Result |
| | | strText.Format(_T("%.1f"), dot->m_distResult); |
| | | m_PanelCutLine.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CCutSetDlg::OnBnClickedButtonSaveCut() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveCutLineParam(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | #include "CutProcess.h" |
| | | // CCutSetDlg å¯¹è¯æ¡ |
| | | |
| | | class CCutSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CCutSetDlg) |
| | | |
| | | public: |
| | | CCutSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CCutSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { |
| | | IDD = IDD_DIALOG_CUTLINE_SET |
| | | }; |
| | | #endif |
| | | |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | CGridCtrl m_PanelCutLine; |
| | | std::vector<CString> m_vParams; |
| | | CCutProcess *m_dot; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | void InitPanel(void); |
| | | |
| | | //2. ä¿åæ°æ® |
| | | void SaveCutLineParam(void); |
| | | |
| | | //3. æ¾ç¤ºåæ° |
| | | void ShowCutLineParam(void); |
| | | |
| | | //4. æ¾ç¤ºç»æ |
| | | void DispAllResult(void); |
| | | |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnClose(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | void setDimensionDir(DimensionDir eDir); |
| | | |
| | | afx_msg void OnBnClickedButtonProcessCut(); |
| | | afx_msg void OnBnClickedButtonSaveCut(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // GrindSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "GrindSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | |
| | | // CGrindSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CGrindSetDlg, CDialogEx) |
| | | |
| | | CGrindSetDlg::CGrindSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_GRIND_SET, pParent) |
| | | , m_nLeftLineDist(0) |
| | | , m_nLeftThres(20) |
| | | { |
| | | m_dot = NULL; |
| | | m_eDir = DIMENSION_NONE; |
| | | } |
| | | |
| | | CGrindSetDlg::~CGrindSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CGrindSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_PANEL_GRIND_INFO, m_PanelGrind); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_LEFT_LINE_DISTANCE, m_nLeftLineDist); |
| | | DDX_Text(pDX, IDC_EDIT_LEFT_LINE_THRES_GRIND, m_nLeftThres); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CGrindSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCESS_GRIND, &CGrindSetDlg::OnBnClickedButtonProcessGrind) |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_GRIND, &CGrindSetDlg::OnBnClickedButtonSaveGrind) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CGrindSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CGrindSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | void CGrindSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | // SaveGrindParam(); |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | BOOL CGrindSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitPanel(); |
| | | |
| | | m_eDir = DIMENSION_NONE; |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CGrindSetDlg::InitPanel(void) { |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | |
| | | CString strText; |
| | | //1. ID |
| | | strText = _T("ID."); |
| | | m_vParams.push_back(strText); |
| | | //2. Name |
| | | strText = _T("Name"); |
| | | m_vParams.push_back(strText); |
| | | //3. use |
| | | strText = _T("use"); |
| | | m_vParams.push_back(strText); |
| | | //4. Pose Type |
| | | strText = _T("Pos Type"); |
| | | m_vParams.push_back(strText); |
| | | //5. Pose Y |
| | | strText = _T("Top Y(um)"); |
| | | m_vParams.push_back(strText); |
| | | //6. End Thres |
| | | strText = _T("End Thres"); |
| | | m_vParams.push_back(strText); |
| | | // 7. Inc |
| | | strText = _T("Inc(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 8.Min |
| | | strText = _T("Min(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 9.Min |
| | | strText = _T("Max(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 10.Result |
| | | strText = _T("Result(um)"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | int nRows = 51; |
| | | int nCols = (int)(m_vParams.size()); |
| | | int nFixRows = 1; |
| | | int nFixCols = 0; |
| | | int nRowIdx = 0; |
| | | int nColIdx = 0; |
| | | |
| | | m_PanelGrind.DeleteAllItems(); |
| | | m_PanelGrind.SetVirtualMode(FALSE); |
| | | m_PanelGrind.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelGrind.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelGrind.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); |
| | | m_PanelGrind.SetFixedTextColor(_gGridFixFontColor); |
| | | |
| | | m_PanelGrind.SetRowCount(nRows); |
| | | m_PanelGrind.SetColumnCount(nCols); |
| | | m_PanelGrind.SetFixedRowCount(nFixRows); |
| | | m_PanelGrind.SetFixedColumnCount(nFixCols); |
| | | |
| | | CFont *pFont = m_PanelGrind.GetFont(); |
| | | if (pFont) { |
| | | LOGFONT lf; |
| | | pFont->GetLogFont(&lf); |
| | | lf.lfItalic = 0; |
| | | lf.lfHeight = 14; |
| | | lf.lfWeight = FW_BOLD; |
| | | _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); |
| | | |
| | | m_PanelGrind.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); |
| | | m_PanelGrind.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); |
| | | m_PanelGrind.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); |
| | | m_PanelGrind.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); |
| | | } |
| | | |
| | | // Col |
| | | for (int i = 0; i < nCols; i++) { |
| | | if (1 == i) { |
| | | m_PanelGrind.SetColumnWidth(nColIdx, 115); |
| | | } |
| | | else if (0 == i) { |
| | | m_PanelGrind.SetColumnWidth(nColIdx, 50); |
| | | } |
| | | else { |
| | | m_PanelGrind.SetColumnWidth(nColIdx, 75); |
| | | } |
| | | strText = m_vParams[i]; |
| | | m_PanelGrind.SetItemText(nRowIdx, nColIdx++, strText); |
| | | } |
| | | |
| | | for (int i = 1; i < nRows; i++){ |
| | | m_PanelGrind.GetCell(i, 0)->SetState(GVIS_READONLY); |
| | | } |
| | | } |
| | | |
| | | void CGrindSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | } |
| | | |
| | | void CGrindSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveGrindParam(); |
| | | |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getGrindProcess(eDir); |
| | | |
| | | ShowGrindParam(); |
| | | } |
| | | |
| | | void CGrindSetDlg::SaveGrindParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | |
| | | { |
| | | CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_GRIND)); |
| | | int iUse = pBtnUse->GetCheck(); |
| | | m_dot->m_isUse = (1 == iUse); |
| | | } |
| | | |
| | | m_dot->m_nLeftLineDist = m_nLeftLineDist; |
| | | m_dot->m_nLeftThres = m_nLeftThres; |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 50; i++) { |
| | | CGrindDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_strName = strText; |
| | | idx += 1; |
| | | |
| | | //3. Use |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_nUse = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //4. Pos Type |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_poseType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //5. Pose Y |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_nPosY = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //6. Edge Pose |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_nEdgeThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //7. Inc |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_nInc = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //8. Min |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_nMin = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //9. Max |
| | | strText = m_PanelGrind.GetItemText(idRow, idx); |
| | | dot->m_nMax = _wtoi(strText); |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | void CGrindSetDlg::ShowGrindParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | { |
| | | CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_GRIND)); |
| | | int iUse = 0; |
| | | if (m_dot->m_isUse) iUse = 1; |
| | | pBtnUse->SetCheck(iUse); |
| | | } |
| | | |
| | | m_nLeftLineDist = m_dot->m_nLeftLineDist; |
| | | m_nLeftThres = m_dot->m_nLeftThres; |
| | | |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 50; i++) { |
| | | CGrindDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = dot->m_strName; |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText.Format(_T("%d"), dot->m_nUse); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //4. Pos Type |
| | | strText.Format(_T("%d"), dot->m_poseType); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //5. Pose Y |
| | | strText.Format(_T("%d"), dot->m_nPosY); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //6. Edge Pose |
| | | strText.Format(_T("%d"), dot->m_nEdgeThres); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //7. Inc |
| | | strText.Format(_T("%d"), dot->m_nInc); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //8. Min |
| | | strText.Format(_T("%d"), dot->m_nMin); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //9. Max |
| | | strText.Format(_T("%d"), dot->m_nMax); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //10. Result |
| | | strText.Format(_T("%.1f"), dot->m_distResult); |
| | | m_PanelGrind.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CGrindSetDlg::OnBnClickedButtonProcessGrind() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { |
| | | pSideData->m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | SaveGrindParam(); |
| | | |
| | | if (NULL == m_dot) return; |
| | | |
| | | m_dot->Execute(m_eDir); |
| | | |
| | | DispAllResult(); |
| | | } |
| | | |
| | | void CGrindSetDlg::DispAllResult(void) { |
| | | /* code */ |
| | | int nCount = 50; |
| | | for (int i = 0; i < 50; i++) { |
| | | CGrindDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | bool isDo = true; |
| | | if (1 != dot->m_nUse) isDo = false; |
| | | if (!isDo) { |
| | | int id = dot->getID(); |
| | | m_PanelGrind.SetItemText(id, 9, _T("NAN")); |
| | | } |
| | | else{ //æ¾ç¤ºç»æ |
| | | CString strResult; |
| | | strResult.Format(_T("%.1f"), dot->m_distResult); |
| | | int id = dot->getID(); |
| | | m_PanelGrind.SetItemText(id, 9, strResult); |
| | | } |
| | | } |
| | | |
| | | CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); |
| | | |
| | | m_PanelGrind.Invalidate(FALSE); |
| | | } |
| | | |
| | | |
| | | void CGrindSetDlg::OnBnClickedButtonSaveGrind() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveGrindParam(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | #include "GrindProcess.h" |
| | | // CGrindSetDlg å¯¹è¯æ¡ |
| | | |
| | | class CGrindSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CGrindSetDlg) |
| | | |
| | | public: |
| | | CGrindSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CGrindSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_GRIND_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | CGridCtrl m_PanelGrind; |
| | | std::vector<CString> m_vParams; |
| | | CGrindProcess *m_dot; |
| | | |
| | | int m_nLeftLineDist; |
| | | int m_nLeftThres; |
| | | |
| | | private: |
| | | void InitPanel(void); |
| | | |
| | | //2. ä¿åæ°æ® |
| | | void SaveGrindParam(void); |
| | | |
| | | //3. æ¾ç¤ºåæ° |
| | | void ShowGrindParam(void); |
| | | |
| | | //4. æ¾ç¤ºåºå |
| | | void DispAllResult(void); |
| | | |
| | | public: |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | afx_msg void OnClose(); |
| | | virtual BOOL OnInitDialog(); |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | void setDimensionDir(DimensionDir eDir); |
| | | |
| | | afx_msg void OnBnClickedButtonProcessGrind(); |
| | | afx_msg void OnBnClickedButtonSaveGrind(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // HoleSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "HoleSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | // CHoleSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CHoleSetDlg, CDialogEx) |
| | | |
| | | CHoleSetDlg::CHoleSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_HOLE_INSPECT, pParent) |
| | | { |
| | | m_dot = NULL; |
| | | m_eDir = DIMENSION_NONE; |
| | | m_display = NULL; |
| | | } |
| | | |
| | | CHoleSetDlg::~CHoleSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CHoleSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Control(pDX, IDC_PANEL_HOLE_INFO, m_PanelHole); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CHoleSetDlg, CDialogEx) |
| | | ON_WM_DESTROY() |
| | | ON_BN_CLICKED(IDC_BUTTON_HOLE_PROCESS, &CHoleSetDlg::OnBnClickedButtonHoleProcess) |
| | | ON_BN_CLICKED(IDC_BUTTON_HOLE_SAVE, &CHoleSetDlg::OnBnClickedButtonHoleSave) |
| | | ON_BN_CLICKED(IDC_BUTTON_HOLE_UP_IMAGE, &CHoleSetDlg::OnBnClickedButtonHoleUpImage) |
| | | ON_BN_CLICKED(IDC_BUTTON_HOLE_CHANGE_SHOW, &CHoleSetDlg::OnBnClickedButtonHoleChangeShow) |
| | | ON_BN_CLICKED(IDC_BUTTON_HOLE_DEL_IMAGE, &CHoleSetDlg::OnBnClickedButtonHoleDelImage) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CHoleSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | void CHoleSetDlg::OnDestroy() |
| | | { |
| | | CDialogEx::OnDestroy(); |
| | | |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | if (nullptr != m_display) { |
| | | m_display->CloseWindow(); |
| | | ClsDisplay_Free(m_display); |
| | | m_display = nullptr; |
| | | } |
| | | } |
| | | |
| | | |
| | | BOOL CHoleSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitPanel(); |
| | | |
| | | InitDisplay(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | BOOL CHoleSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | void CHoleSetDlg::InitDisplay(void) { |
| | | /* code */ |
| | | m_display = ClsDisplay_Create(); |
| | | if (nullptr != m_display) { |
| | | CRect rect; |
| | | CWnd* pDispWnd = GetDlgItem(IDC_STATIC_HOLE_IMG); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_display->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_display->SetOperFlag(DEFAULT_OPER_FLAG); |
| | | m_display->SetDraw("fill", DISP_OBJECT); |
| | | m_display->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_display->SetDraw("margin", DISP_REGION); |
| | | std::string color = ClsVision::Rgb2Color(0, 255, 0); |
| | | m_display->SetColor(color, DISP_REGION); |
| | | |
| | | m_display->SetDraw("margin", DISP_CROSS); |
| | | color = ClsVision::Rgb2Color(255, 0, 0); |
| | | m_display->SetColor(color, DISP_CROSS); |
| | | |
| | | m_display->SetDraw("fill", DISP_SELECT); |
| | | m_display->SetColor("yellow", DISP_SELECT); |
| | | color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_display->SetBackgroundColor(color); |
| | | } |
| | | } |
| | | |
| | | int CHoleSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | void CHoleSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveHoleParam(); |
| | | |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getHoleProcess(m_eDir); |
| | | |
| | | ShowHoleParam(); |
| | | } |
| | | |
| | | void CHoleSetDlg::ShowHoleParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 4; i++) { |
| | | CHoleDotProcess* dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->GetID(); |
| | | int idx = 0; |
| | | strText.Format(_T("%d"), dot->GetID()); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = dot->m_strName; |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText.Format(_T("%d"), dot->m_nUse); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //4. Pos Type |
| | | strText.Format(_T("%d"), dot->m_nPoseType); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //5. Shape Type |
| | | strText.Format(_T("%d"), dot->m_nShapeType); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //6. Bright Type |
| | | strText.Format(_T("%d"), dot->m_nBrightType); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //7. Thres |
| | | strText.Format(_T("%d"), dot->m_nThres); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //8. Smooth Size |
| | | strText.Format(_T("%d"), dot->m_nSmoothSize); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //9. Defect Size |
| | | strText.Format(_T("%d"), dot->m_nDefectSize); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //10. Result |
| | | int ngNum = (int)(dot->m_nNgInfo.size()); |
| | | strText.Format(_T("%d"), ngNum); |
| | | m_PanelHole.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | |
| | | ShowHoleImage(); |
| | | } |
| | | |
| | | void CHoleSetDlg::SaveHoleParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 4; i++) { |
| | | CHoleDotProcess* dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->GetID(); |
| | | int idx = 0; |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_strName = strText; |
| | | idx += 1; |
| | | |
| | | //3. Use |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nUse = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //4.Pos Type |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nPoseType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //5. Shape Type |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nShapeType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //6. Bright Type |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nBrightType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //7. Thres |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //8. Smooth Size |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nSmoothSize = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //9. Defect Size |
| | | strText = m_PanelHole.GetItemText(idRow, idx); |
| | | dot->m_nDefectSize = _wtoi(strText); |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | void CHoleSetDlg::OnBnClickedButtonHoleProcess() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (nullptr == m_dot) return; |
| | | |
| | | m_dot->Execute(m_eDir); |
| | | } |
| | | |
| | | void CHoleSetDlg::InitPanel(void) { |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | |
| | | CString strText; |
| | | //1. ID |
| | | strText = _T("ID."); |
| | | m_vParams.push_back(strText); |
| | | //2. useName |
| | | strText = _T("Name"); |
| | | m_vParams.push_back(strText); |
| | | //3. useName |
| | | strText = _T("use"); |
| | | m_vParams.push_back(strText); |
| | | //4. Pos Type |
| | | strText = _T("Pos Type"); |
| | | m_vParams.push_back(strText); |
| | | //5. Shape Type |
| | | strText = _T("Shape Type"); |
| | | m_vParams.push_back(strText); |
| | | //6. Bright Type |
| | | strText = _T("Bright Type"); |
| | | m_vParams.push_back(strText); |
| | | //7. Thres |
| | | strText = _T("Thres"); |
| | | m_vParams.push_back(strText); |
| | | //8. Smooth |
| | | strText = _T("Smooth Size"); |
| | | m_vParams.push_back(strText); |
| | | // 9. Defect Size |
| | | strText = _T("Defect Size"); |
| | | m_vParams.push_back(strText); |
| | | // 10.Result |
| | | strText = _T("Result"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | int nRows = 5; |
| | | int nCols = (int)(m_vParams.size()); |
| | | int nFixRows = 1; |
| | | int nFixCols = 0; |
| | | int nRowIdx = 0; |
| | | int nColIdx = 0; |
| | | |
| | | m_PanelHole.DeleteAllItems(); |
| | | m_PanelHole.SetVirtualMode(FALSE); |
| | | m_PanelHole.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelHole.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelHole.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); |
| | | m_PanelHole.SetFixedTextColor(_gGridFixFontColor); |
| | | |
| | | m_PanelHole.SetRowCount(nRows); |
| | | m_PanelHole.SetColumnCount(nCols); |
| | | m_PanelHole.SetFixedRowCount(nFixRows); |
| | | m_PanelHole.SetFixedColumnCount(nFixCols); |
| | | |
| | | CFont* pFont = m_PanelHole.GetFont(); |
| | | if (pFont) { |
| | | LOGFONT lf; |
| | | pFont->GetLogFont(&lf); |
| | | lf.lfItalic = 0; |
| | | lf.lfHeight = 14; |
| | | lf.lfWeight = FW_BOLD; |
| | | _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); |
| | | |
| | | m_PanelHole.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); |
| | | m_PanelHole.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); |
| | | m_PanelHole.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); |
| | | m_PanelHole.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); |
| | | } |
| | | |
| | | // Col |
| | | for (int i = 0; i < nCols; i++) { |
| | | if (1 == i) { |
| | | m_PanelHole.SetColumnWidth(nColIdx, 115); |
| | | } |
| | | else if (0 == i) { |
| | | m_PanelHole.SetColumnWidth(nColIdx, 50); |
| | | } |
| | | else { |
| | | m_PanelHole.SetColumnWidth(nColIdx, 75); |
| | | } |
| | | strText = m_vParams[i]; |
| | | m_PanelHole.SetItemText(nRowIdx, nColIdx++, strText); |
| | | } |
| | | |
| | | for (int i = 1; i < nRows; i++) { |
| | | m_PanelHole.GetCell(i, 0)->SetState(GVIS_READONLY); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CHoleSetDlg::OnBnClickedButtonHoleSave() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveHoleParam(); |
| | | ShowHoleImage(); |
| | | } |
| | | |
| | | |
| | | void CHoleSetDlg::OnBnClickedButtonHoleUpImage() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CCellID selCell = m_PanelHole.GetFocusCell(); |
| | | int id = 1; |
| | | if (selCell.IsValid()) { |
| | | id = selCell.row; |
| | | } |
| | | if (id < 1 || id > 4) return; |
| | | CHoleDotProcess * dot = m_dot->m_dots[id - 1]; |
| | | if (nullptr == dot) return; |
| | | |
| | | //1. åéä¿¡æ¯ |
| | | CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); |
| | | |
| | | //2. è·åä½ç½®ä¿¡æ¯ |
| | | int x1 = 0; |
| | | int y1 = 0; |
| | | int x2 = 0; |
| | | int y2 = 0; |
| | | if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; |
| | | |
| | | //æªå¾ |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) return; |
| | | |
| | | Point2I ptCenter; |
| | | ptCenter.x = (int)(1.0f * (x1 + x2) / 2 + 0.5f); |
| | | ptCenter.y = (int)(1.0f * (y1 + y2) / 2 + 0.5f); |
| | | Point2I ptStd, ptTop, ptBot; |
| | | if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, ptCenter, ptStd, ptTop, ptBot)) return; |
| | | |
| | | dot->SetPose(ptStd.x, ptStd.y); |
| | | dot->SetImage(hImage); |
| | | |
| | | ShowHoleImage(); |
| | | } |
| | | |
| | | void CHoleSetDlg::ShowHoleImage(void) { |
| | | /* code */ |
| | | if (nullptr == m_dot) return; |
| | | |
| | | CCellID selCell = m_PanelHole.GetFocusCell(); |
| | | int id = 1; |
| | | if (selCell.IsValid()) { |
| | | id = selCell.row; |
| | | } |
| | | if (id < 1 || id > 4) return; |
| | | CHoleDotProcess* dot = m_dot->m_dots[id - 1]; |
| | | if (nullptr == dot) return; |
| | | |
| | | HalconCpp::HObject& hImage = dot->GetImage(); |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) { |
| | | HalconCpp::GenEmptyObj(&m_display->GetImage()); |
| | | HalconCpp::GenEmptyObj(&m_display->GetRegion()); |
| | | HalconCpp::GenEmptyObj(&m_display->GetCross()); |
| | | m_display->ClearWindow(); |
| | | m_display->DispImage(); |
| | | return; |
| | | } |
| | | |
| | | HalconCpp::HObject hRegion, hRoiRegion; |
| | | int offset = dot->m_nSmoothSize; |
| | | HalconCpp::GenEllipse(&hRegion, 0.5 * (height-1), 0.5 * (width-1), 0, 0.5 * width, 0.5 * height); |
| | | HalconCpp::GenEllipse(&hRoiRegion, 0.5 * (height - 1), 0.5 * (width - 1), 0, 0.5 * width - offset, 0.5 * height - offset); |
| | | m_display->SetRegion(hRoiRegion); |
| | | m_display->SetCross(hRegion); |
| | | |
| | | m_display->AutoWindowSize(width, height); |
| | | m_display->SetImage(hImage); |
| | | m_display->DispImage(); |
| | | m_display->DispCross(); |
| | | m_display->DispRegion(); |
| | | } |
| | | |
| | | |
| | | |
| | | void CHoleSetDlg::OnBnClickedButtonHoleChangeShow() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | ShowHoleImage(); |
| | | } |
| | | |
| | | |
| | | void CHoleSetDlg::OnBnClickedButtonHoleDelImage() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (nullptr == m_dot) return; |
| | | |
| | | CCellID selCell = m_PanelHole.GetFocusCell(); |
| | | if (!selCell.IsValid()) return; |
| | | int id = selCell.row; |
| | | if (id < 1 || id > 4) return; |
| | | CHoleDotProcess* dot = m_dot->m_dots[id - 1]; |
| | | if (nullptr == dot) return; |
| | | |
| | | HalconCpp::HObject& hImage = dot->GetImage(); |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) return; |
| | | |
| | | HalconCpp::HObject hNilImage; |
| | | HalconCpp::GenEmptyObj(&hNilImage); |
| | | dot->SetImage(hNilImage); |
| | | |
| | | ShowHoleImage(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CHoleSetDlg å¯¹è¯æ¡ |
| | | #include "HoleProcess.h" |
| | | |
| | | class CHoleSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CHoleSetDlg) |
| | | |
| | | public: |
| | | CHoleSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CHoleSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_HOLE_INSPECT }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | afx_msg void OnDestroy(); |
| | | virtual BOOL OnInitDialog(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | afx_msg void OnBnClickedButtonHoleProcess(); |
| | | |
| | | //1. 设置edir |
| | | int setDimensionDir(DimensionDir eDir); |
| | | |
| | | private: |
| | | CGridCtrl m_PanelHole; |
| | | std::vector<CString> m_vParams; |
| | | DimensionDir m_eDir; |
| | | CHoleProcess* m_dot; |
| | | IClsDisplay* m_display; |
| | | |
| | | private: |
| | | //1. åå§åPanel |
| | | void InitPanel(void); |
| | | |
| | | //2. ä¿®æ¹ç®æ³ |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | |
| | | //3. ä¿ååæ° |
| | | void SaveHoleParam(void); |
| | | |
| | | //4. æ¾ç¤ºåæ° |
| | | void ShowHoleParam(void); |
| | | |
| | | //5. åå§å |
| | | void InitDisplay(void); |
| | | |
| | | //6. æ¾ç¤ºå¾å |
| | | void ShowHoleImage(void); |
| | | |
| | | public: |
| | | afx_msg void OnBnClickedButtonHoleSave(); |
| | | afx_msg void OnBnClickedButtonHoleUpImage(); |
| | | afx_msg void OnBnClickedButtonHoleChangeShow(); |
| | | afx_msg void OnBnClickedButtonHoleDelImage(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // KDistSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "KDistSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | |
| | | // CKDistSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CKDistSetDlg, CDialogEx) |
| | | |
| | | CKDistSetDlg::CKDistSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_DIST_SET, pParent) |
| | | { |
| | | m_dot = NULL; |
| | | m_eDir = DIMENSION_NONE; |
| | | } |
| | | |
| | | CKDistSetDlg::~CKDistSetDlg() |
| | | { |
| | | /* code */ |
| | | } |
| | | |
| | | void CKDistSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Control(pDX, IDC_PANEL_CUT_INFO, m_PanelKeyDist); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CKDistSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCESS_KDIST, &CKDistSetDlg::OnBnClickedButtonProcessKdist) |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_KDIST, &CKDistSetDlg::OnBnClickedButtonSaveKdist) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CKDistSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CKDistSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | void CKDistSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | BOOL CKDistSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitPanel(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CKDistSetDlg::InitPanel(void) { |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | |
| | | CString strText; |
| | | //1. ID |
| | | strText = _T("ID."); |
| | | m_vParams.push_back(strText); |
| | | //2. useName |
| | | strText = _T("Name"); |
| | | m_vParams.push_back(strText); |
| | | //3. useName |
| | | strText = _T("use"); |
| | | m_vParams.push_back(strText); |
| | | //4. Pos Type |
| | | strText = _T("Pos Type"); |
| | | m_vParams.push_back(strText); |
| | | //5. Key X |
| | | strText = _T("Key X(um)"); |
| | | m_vParams.push_back(strText); |
| | | //6. Key Y |
| | | strText = _T("Key Y(um)"); |
| | | m_vParams.push_back(strText); |
| | | //7. Pos X |
| | | strText = _T("Pos X(um)"); |
| | | m_vParams.push_back(strText); |
| | | //8. Pos Y |
| | | strText = _T("Pos Y(um)"); |
| | | m_vParams.push_back(strText); |
| | | //9. End Type |
| | | strText = _T("Edge Thres"); |
| | | m_vParams.push_back(strText); |
| | | //10. ROI Width |
| | | strText = _T("Std(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 11. Inc |
| | | strText = _T("Inc(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 12.Min |
| | | strText = _T("Min(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 13.MAX |
| | | strText = _T("Max(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 14.Result |
| | | strText = _T("Result(um)"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | int nRows = 51; |
| | | int nCols = (int)(m_vParams.size()); |
| | | int nFixRows = 1; |
| | | int nFixCols = 0; |
| | | int nRowIdx = 0; |
| | | int nColIdx = 0; |
| | | |
| | | m_PanelKeyDist.DeleteAllItems(); |
| | | m_PanelKeyDist.SetVirtualMode(FALSE); |
| | | m_PanelKeyDist.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelKeyDist.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelKeyDist.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); |
| | | m_PanelKeyDist.SetFixedTextColor(_gGridFixFontColor); |
| | | |
| | | m_PanelKeyDist.SetRowCount(nRows); |
| | | m_PanelKeyDist.SetColumnCount(nCols); |
| | | m_PanelKeyDist.SetFixedRowCount(nFixRows); |
| | | m_PanelKeyDist.SetFixedColumnCount(nFixCols); |
| | | |
| | | CFont *pFont = m_PanelKeyDist.GetFont(); |
| | | if (pFont) { |
| | | LOGFONT lf; |
| | | pFont->GetLogFont(&lf); |
| | | lf.lfItalic = 0; |
| | | lf.lfHeight = 14; |
| | | lf.lfWeight = FW_BOLD; |
| | | _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); |
| | | |
| | | m_PanelKeyDist.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); |
| | | m_PanelKeyDist.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); |
| | | m_PanelKeyDist.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); |
| | | m_PanelKeyDist.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); |
| | | } |
| | | |
| | | // Col |
| | | for (int i = 0; i < nCols; i++) { |
| | | if (1 == i) { |
| | | m_PanelKeyDist.SetColumnWidth(nColIdx, 115); |
| | | } |
| | | else if (0 == i) { |
| | | m_PanelKeyDist.SetColumnWidth(nColIdx, 50); |
| | | } |
| | | else { |
| | | m_PanelKeyDist.SetColumnWidth(nColIdx, 75); |
| | | } |
| | | strText = m_vParams[i]; |
| | | m_PanelKeyDist.SetItemText(nRowIdx, nColIdx++, strText); |
| | | } |
| | | |
| | | for (int i = 1; i < nRows; i++){ |
| | | m_PanelKeyDist.GetCell(i, 0)->SetState(GVIS_READONLY); |
| | | } |
| | | } |
| | | |
| | | void CKDistSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | } |
| | | |
| | | void CKDistSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveKDistParam(); |
| | | |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getKDistProcess(eDir); |
| | | |
| | | ShowKDistParam(); |
| | | } |
| | | |
| | | void CKDistSetDlg::SaveKDistParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | |
| | | { |
| | | CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_KDIST)); |
| | | int iUse = pBtnUse->GetCheck(); |
| | | m_dot->m_isUse = (1 == iUse); |
| | | |
| | | int nValue = GetDlgItemInt(IDC_EDIT_ROI_LENGTH_SIZE_DIST); |
| | | m_dot->m_nRoiSize = nValue; |
| | | } |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 50; i++) { |
| | | CKeyDistDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_strName = strText; |
| | | idx += 1; |
| | | |
| | | //3. Use |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nUse = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //4.Pos Type |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_poseType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //5. Key X |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_keyPoseX = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //6. Key Y |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_keyPoseY = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //7. Pos X |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nPosX = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //8. Pos Y |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nPosY = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //9. End Type |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nEndThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //10. ROI Width |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nStdDist = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //11. Inc |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nInc = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //12. Min |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nMin = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //13. Max |
| | | strText = m_PanelKeyDist.GetItemText(idRow, idx); |
| | | dot->m_nMax = _wtoi(strText); |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | void CKDistSetDlg::ShowKDistParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | { |
| | | CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_KDIST)); |
| | | int iUse = 0; |
| | | if (m_dot->m_isUse) iUse = 1; |
| | | pBtnUse->SetCheck(iUse); |
| | | |
| | | SetDlgItemInt(IDC_EDIT_ROI_LENGTH_SIZE_DIST, m_dot->m_nRoiSize); |
| | | } |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 50; i++) { |
| | | CKeyDistDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = dot->m_strName; |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText.Format(_T("%d"), dot->m_nUse); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //4. Pos Type |
| | | strText.Format(_T("%d"), dot->m_poseType); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //5. Key X |
| | | strText.Format(_T("%d"), dot->m_keyPoseX); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //6. Key Y |
| | | strText.Format(_T("%d"), dot->m_keyPoseY); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //7. Pos X |
| | | strText.Format(_T("%d"), dot->m_nPosX); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //8. Pos Y |
| | | strText.Format(_T("%d"), dot->m_nPosY); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //9. End Type |
| | | strText.Format(_T("%d"), dot->m_nEndThres); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //10. Std |
| | | strText.Format(_T("%d"), dot->m_nStdDist); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //11. Inc |
| | | strText.Format(_T("%d"), dot->m_nInc); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //12. Min |
| | | strText.Format(_T("%d"), dot->m_nMin); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //13. Max |
| | | strText.Format(_T("%d"), dot->m_nMax); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //14. Result |
| | | strText.Format(_T("%.1f"), dot->m_distResult); |
| | | m_PanelKeyDist.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | |
| | | void CKDistSetDlg::OnBnClickedButtonProcessKdist() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { |
| | | pSideData->m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | SaveKDistParam(); |
| | | |
| | | if (NULL == m_dot) return; |
| | | |
| | | CLocProcess *pLoc = CVisionRecipe::getInstance()->getLocProcess(m_eDir); |
| | | if (NULL != pLoc) { |
| | | pLoc->execute(m_eDir); |
| | | } |
| | | |
| | | m_dot->Execute(m_eDir); |
| | | |
| | | DispAllResult(); |
| | | |
| | | } |
| | | |
| | | void CKDistSetDlg::DispAllResult(void) { |
| | | /* code */ |
| | | int nCount = 50; |
| | | for (int i = 0; i < 50; i++) { |
| | | CKeyDistDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | bool isDo = true; |
| | | if (1 != dot->m_nUse) isDo = false; |
| | | if (!isDo) { |
| | | int id = dot->getID(); |
| | | m_PanelKeyDist.SetItemText(id, 13, _T("NAN")); |
| | | } |
| | | else{ //æ¾ç¤ºç»æ |
| | | CString strResult; |
| | | strResult.Format(_T("%.1f"), dot->m_distResult); |
| | | int id = dot->getID(); |
| | | m_PanelKeyDist.SetItemText(id, 13, strResult); |
| | | } |
| | | } |
| | | CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); |
| | | |
| | | m_PanelKeyDist.Invalidate(FALSE); |
| | | } |
| | | |
| | | void CKDistSetDlg::OnBnClickedButtonSaveKdist() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveKDistParam(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | #include "KDistProcess.h" |
| | | // CKDistSetDlg å¯¹è¯æ¡ |
| | | |
| | | class CKDistSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CKDistSetDlg) |
| | | |
| | | public: |
| | | CKDistSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CKDistSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_DIST_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | CGridCtrl m_PanelKeyDist; |
| | | std::vector<CString> m_vParams; |
| | | CKDistProcess *m_dot; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | void InitPanel(void); |
| | | |
| | | //2. åå§å |
| | | void SaveKDistParam(void); |
| | | |
| | | //3. æ¾ç¤ºè·ç¦» |
| | | void ShowKDistParam(void); |
| | | |
| | | //4. æ¾ç¤ºç»æ |
| | | void DispAllResult(void); |
| | | |
| | | public: |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | afx_msg void OnClose(); |
| | | virtual BOOL OnInitDialog(); |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | void setDimensionDir(DimensionDir eDir); |
| | | afx_msg void OnBnClickedButtonProcessKdist(); |
| | | afx_msg void OnBnClickedButtonSaveKdist(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // KeyVisionSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "KeyVisionSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "ScanSetDlg.h" |
| | | #include "SoftVisionApp.h" |
| | | #include "FileRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | |
| | | // CKeyVisionSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CKeyVisionSetDlg, CDialogEx) |
| | | |
| | | CKeyVisionSetDlg::CKeyVisionSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG1, pParent) |
| | | , m_strPassword(_T("")) |
| | | { |
| | | |
| | | } |
| | | |
| | | CKeyVisionSetDlg::~CKeyVisionSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CKeyVisionSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_VISION_DISPLAY, m_btnVisionDisplay); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE, m_btnVisionUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE2, m_btnVisionUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE3, m_btnVisionUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE4, m_btnVisionUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE5, m_btnVisionUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE6, m_btnVisionUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE7, m_btnVisionUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE8, m_btnVisionUse[7]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE, m_btnLocUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE2, m_btnLocUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE3, m_btnLocUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE4, m_btnLocUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE5, m_btnLocUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE6, m_btnLocUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE7, m_btnLocUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE8, m_btnLocUse[7]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE, m_btnDistUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE2, m_btnDistUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE3, m_btnDistUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE4, m_btnDistUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE5, m_btnDistUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE6, m_btnDistUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE7, m_btnDistUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE8, m_btnDistUse[7]); |
| | | DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE9, m_btnDistUse[8]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE, m_btnRcutUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE2, m_btnRcutUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE3, m_btnRcutUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE4, m_btnRcutUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE5, m_btnRcutUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE6, m_btnRcutUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE7, m_btnRcutUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE8, m_btnRcutUse[7]); |
| | | DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE9, m_btnRcutUse[8]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE, m_btnGrindUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE2, m_btnGrindUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE3, m_btnGrindUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE4, m_btnGrindUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE5, m_btnGrindUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE6, m_btnGrindUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE7, m_btnGrindUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE8, m_btnGrindUse[7]); |
| | | DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE9, m_btnGrindUse[8]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE, m_btnCutUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE2, m_btnCutUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE3, m_btnCutUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE4, m_btnCutUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE5, m_btnCutUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE6, m_btnCutUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE7, m_btnCutUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE8, m_btnCutUse[7]); |
| | | DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE9, m_btnCutUse[8]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE, m_btnThresUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE2, m_btnThresUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE3, m_btnThresUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE4, m_btnThresUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE5, m_btnThresUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE6, m_btnThresUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE7, m_btnThresUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE8, m_btnThresUse[7]); |
| | | DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE9, m_btnThresUse[8]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE, m_btnHoleUse[0]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE2, m_btnHoleUse[1]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE3, m_btnHoleUse[2]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE4, m_btnHoleUse[3]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE5, m_btnHoleUse[4]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE6, m_btnHoleUse[5]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE7, m_btnHoleUse[6]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE8, m_btnHoleUse[7]); |
| | | DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE9, m_btnHoleUse[8]); |
| | | |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_TOOL_KEY, m_btnDebugKey[0]); |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_KEY, m_btnDebugKey[1]); |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_KEY2, m_btnDebugKey[2]); |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_KEY3, m_btnDebugKey[3]); |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_KEY4, m_btnDebugKey[4]); |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_KEY5, m_btnDebugKey[5]); |
| | | DDX_Control(pDX, IDC_CHECK_DEBUG_KEY6, m_btnDebugKey[6]); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_PWD_KEY, m_strPassword); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CKeyVisionSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_RECIPE, &CKeyVisionSetDlg::OnBnClickedButtonSaveRecipe) |
| | | ON_BN_CLICKED(IDC_BUTTON_LOAD_RECIPE, &CKeyVisionSetDlg::OnBnClickedButtonLoadRecipe) |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCESS_KEY, &CKeyVisionSetDlg::OnBnClickedButtonProcessKey) |
| | | ON_BN_CLICKED(IDC_CHECK_DEBUG_TOOL_KEY, &CKeyVisionSetDlg::OnBnClickedCheckDebugToolKey) |
| | | ON_BN_CLICKED(IDC_BUTTON_DEBUG_MODE_KEY, &CKeyVisionSetDlg::OnBnClickedButtonDebugModeKey) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CKeyVisionSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CKeyVisionSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | LockBtn(TRUE); |
| | | |
| | | ShowUiParams(); |
| | | |
| | | this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CKeyVisionSetDlg::ShowUiParams(void) { |
| | | /* code */ |
| | | CVisionRecipe* pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return; |
| | | |
| | | VisionDisplayInfo infDisplay = pInstance->getVisionDisplay(); |
| | | m_btnVisionDisplay.SetCheck(infDisplay.isVisionDisplay); |
| | | m_btnDistUse[8].SetCheck(infDisplay.isDistDisplay); |
| | | m_btnRcutUse[8].SetCheck(infDisplay.isRcutDisplay); |
| | | m_btnGrindUse[8].SetCheck(infDisplay.isGrindDisplay); |
| | | m_btnCutUse[8].SetCheck(infDisplay.isCutDisplay); |
| | | m_btnThresUse[8].SetCheck(infDisplay.isThresDisplay); |
| | | m_btnHoleUse[8].SetCheck(infDisplay.isHoleDisplay); |
| | | |
| | | for (int i = 0; i < 8; i++) { |
| | | VisionUseInfo inf = pInstance->getVisionUse((DimensionDir)i); |
| | | m_btnVisionUse[i].SetCheck(inf.isVisionUse); |
| | | m_btnLocUse[i].SetCheck(inf.isLocUse); |
| | | m_btnDistUse[i].SetCheck(inf.isDistUse); |
| | | m_btnRcutUse[i].SetCheck(inf.isRcutUse); |
| | | m_btnGrindUse[i].SetCheck(inf.isGrindUse); |
| | | m_btnCutUse[i].SetCheck(inf.isCutUse); |
| | | m_btnThresUse[i].SetCheck(inf.isThresUse); |
| | | m_btnHoleUse[i].SetCheck(inf.isHoleUse); |
| | | } |
| | | |
| | | KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo(); |
| | | m_btnDebugKey[0].SetCheck(info.isDebugTool); |
| | | m_btnDebugKey[1].SetCheck(info.isInspectKey); |
| | | m_btnDebugKey[2].SetCheck(info.isLocKey); |
| | | m_btnDebugKey[3].SetCheck(info.isGrindKey); |
| | | m_btnDebugKey[4].SetCheck(info.isDistKey); |
| | | m_btnDebugKey[5].SetCheck(info.isCutLineKey); |
| | | m_btnDebugKey[6].SetCheck(info.isRcutKey); |
| | | |
| | | LockBtn(!m_btnDebugKey[0].GetCheck()); |
| | | } |
| | | |
| | | |
| | | void CKeyVisionSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | SaveUiParam(); |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | void CKeyVisionSetDlg::SaveUiParam(void) { |
| | | /* code */ |
| | | CVisionRecipe* pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return; |
| | | |
| | | VisionDisplayInfo infDisplay; |
| | | infDisplay.isVisionDisplay = (1 == m_btnVisionDisplay.GetCheck()); |
| | | infDisplay.isDistDisplay = (1 == m_btnDistUse[8].GetCheck()); |
| | | infDisplay.isRcutDisplay = (1 == m_btnRcutUse[8].GetCheck()); |
| | | infDisplay.isGrindDisplay = (1 == m_btnGrindUse[8].GetCheck()); |
| | | infDisplay.isCutDisplay = (1 == m_btnCutUse[8].GetCheck()); |
| | | infDisplay.isThresDisplay = (1 == m_btnThresUse[8].GetCheck()); |
| | | infDisplay.isHoleDisplay = (1 == m_btnHoleUse[8].GetCheck()); |
| | | pInstance->setVisionDisplay(infDisplay); |
| | | |
| | | for (int i = 0; i < 8; i++) { |
| | | VisionUseInfo inf; |
| | | inf.isVisionUse = (1 == m_btnVisionUse[i].GetCheck()); |
| | | inf.isLocUse = (1 == m_btnLocUse[i].GetCheck()); |
| | | inf.isDistUse = (1 == m_btnDistUse[i].GetCheck()); |
| | | inf.isRcutUse = (1 == m_btnRcutUse[i].GetCheck()); |
| | | inf.isGrindUse = (1 == m_btnGrindUse[i].GetCheck()); |
| | | inf.isCutUse = (1 == m_btnCutUse[i].GetCheck()); |
| | | inf.isThresUse = (1 == m_btnThresUse[i].GetCheck()); |
| | | inf.isHoleUse = (1 == m_btnHoleUse[i].GetCheck()); |
| | | pInstance->setVisionUse(inf, (DimensionDir)i); |
| | | } |
| | | |
| | | KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo(); |
| | | info.isDebugTool = (1 == m_btnDebugKey[0].GetCheck()); |
| | | info.isInspectKey = (1 == m_btnDebugKey[1].GetCheck()); |
| | | info.isLocKey = (1 == m_btnDebugKey[2].GetCheck()); |
| | | info.isGrindKey = (1 == m_btnDebugKey[3].GetCheck()); |
| | | info.isDistKey = (1 == m_btnDebugKey[4].GetCheck()); |
| | | info.isCutLineKey = (1 == m_btnDebugKey[5].GetCheck()); |
| | | info.isRcutKey = (1 == m_btnDebugKey[6].GetCheck()); |
| | | pInstance->setKeyInfo(info); |
| | | |
| | | pInstance->saveVisionConfig(); |
| | | } |
| | | |
| | | |
| | | BOOL CKeyVisionSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | void CKeyVisionSetDlg::OnBnClickedButtonSaveRecipe() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | //std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\"; |
| | | //CVisionRecipe::getInstance()->setWorkDir(filePath.c_str()); |
| | | //std::string strName = "Test"; |
| | | //CVisionRecipe::getInstance()->setVisionName(strName.c_str()); |
| | | CVisionRecipe::getInstance()->save(); |
| | | } |
| | | |
| | | |
| | | void CKeyVisionSetDlg::OnBnClickedButtonLoadRecipe() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | //std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\"; |
| | | //CVisionRecipe::getInstance()->setWorkDir(filePath.c_str()); |
| | | //std::string strName = "Test"; |
| | | //CVisionRecipe::getInstance()->setVisionName(strName.c_str()); |
| | | CVisionRecipe::getInstance()->open(); |
| | | } |
| | | |
| | | |
| | | void CKeyVisionSetDlg::OnBnClickedButtonProcessKey() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | for (int i = 0; i < 1000; i++) { |
| | | Log_GetDebug()->TraceInfo("Start Save Recipe %d: %d", i, __LINE__); |
| | | { |
| | | //std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\"; |
| | | //CVisionRecipe::getInstance()->setWorkDir(filePath.c_str()); |
| | | //std::string strName = "Test"; |
| | | //CVisionRecipe::getInstance()->setVisionName(strName.c_str()); |
| | | CVisionRecipe::getInstance()->save(); |
| | | } |
| | | Log_GetDebug()->TraceInfo("End Save Recipe %d: %d", i, __LINE__); |
| | | Sleep(1000); |
| | | |
| | | Log_GetDebug()->TraceInfo("Start Load Recipe %d: %d", i, __LINE__); |
| | | { |
| | | //std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\"; |
| | | //CVisionRecipe::getInstance()->setWorkDir(filePath.c_str()); |
| | | //std::string strName = "Test"; |
| | | //CVisionRecipe::getInstance()->setVisionName(strName.c_str()); |
| | | CVisionRecipe::getInstance()->open(); |
| | | } |
| | | Log_GetDebug()->TraceInfo("Start End Recipe %d: %d", i, __LINE__); |
| | | Sleep(1000); |
| | | |
| | | Log_GetDebug()->TraceInfo("Start Vision Inspect %d: %d", i, __LINE__); |
| | | for (int i = 0; i < 8; i++) { |
| | | NgInfo ngInf[NG_INF_NUM]; |
| | | CSoftVisionApp::getInstance()->Execute(i, ngInf); |
| | | } |
| | | Log_GetDebug()->TraceInfo("End Vision Inspect %d: %d", i, __LINE__); |
| | | Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CKeyVisionSetDlg::OnBnClickedCheckDebugToolKey() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | UpdateData(TRUE); |
| | | SaveUiParam(); |
| | | |
| | | LockBtn(!m_btnDebugKey[0].GetCheck()); |
| | | } |
| | | |
| | | void CKeyVisionSetDlg::LockBtn(BOOL isLock) { |
| | | /* code */ |
| | | if (isLock) { |
| | | for (int i = 1; i < 7; i++) { |
| | | m_btnDebugKey[i].ShowWindow(SW_HIDE); |
| | | } |
| | | GetDlgItem(IDC_BUTTON_SAVE_RECIPE)->ShowWindow(SW_HIDE); |
| | | GetDlgItem(IDC_BUTTON_LOAD_RECIPE)->ShowWindow(SW_HIDE); |
| | | GetDlgItem(IDC_BUTTON_PROCESS_KEY)->ShowWindow(SW_HIDE); |
| | | GetDlgItem(IDC_STATIC_DEBUG_GROUND)->ShowWindow(SW_HIDE); |
| | | |
| | | } |
| | | else { |
| | | for (int i = 1; i < 7; i++) { |
| | | m_btnDebugKey[i].ShowWindow(SW_SHOW); |
| | | } |
| | | GetDlgItem(IDC_BUTTON_SAVE_RECIPE)->ShowWindow(SW_SHOW); |
| | | GetDlgItem(IDC_BUTTON_LOAD_RECIPE)->ShowWindow(SW_SHOW); |
| | | GetDlgItem(IDC_BUTTON_PROCESS_KEY)->ShowWindow(SW_SHOW); |
| | | GetDlgItem(IDC_STATIC_DEBUG_GROUND)->ShowWindow(SW_SHOW); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CKeyVisionSetDlg::OnBnClickedButtonDebugModeKey() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | UpdateData(TRUE); |
| | | if (m_strPassword != _T("31415926535")) { |
| | | GetDlgItem(IDC_CHECK_DEBUG_TOOL_KEY)->ShowWindow(SW_HIDE); |
| | | return; |
| | | } |
| | | |
| | | GetDlgItem(IDC_CHECK_DEBUG_TOOL_KEY)->ShowWindow(SW_SHOW); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CKeyVisionSetDlg å¯¹è¯æ¡ |
| | | #include "VisionRecipe.h" |
| | | |
| | | class CKeyVisionSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CKeyVisionSetDlg) |
| | | |
| | | public: |
| | | CKeyVisionSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CKeyVisionSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { |
| | | IDD = IDD_DIALOG_KEY_SET |
| | | }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | //1. åå§åæ¾ç¤º |
| | | void ShowUiParams(void); |
| | | |
| | | //2. è·åä¿¡æ¯ |
| | | void SaveUiParam(void); |
| | | |
| | | //3. å é |
| | | void LockBtn(BOOL isLock); |
| | | |
| | | private: |
| | | CButton m_btnVisionUse[8]; |
| | | CButton m_btnLocUse[8]; |
| | | CButton m_btnDistUse[9]; |
| | | CButton m_btnRcutUse[9]; |
| | | CButton m_btnGrindUse[9]; |
| | | CButton m_btnCutUse[9]; |
| | | CButton m_btnVisionDisplay; |
| | | CButton m_btnThresUse[9]; |
| | | CButton m_btnHoleUse[9]; |
| | | |
| | | CButton m_btnDebugKey[7]; |
| | | |
| | | CString m_strPassword; |
| | | |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnClose(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | afx_msg void OnBnClickedButtonSaveRecipe(); |
| | | afx_msg void OnBnClickedButtonLoadRecipe(); |
| | | afx_msg void OnBnClickedButtonProcessKey(); |
| | | afx_msg void OnBnClickedCheckDebugToolKey(); |
| | | afx_msg void OnBnClickedButtonDebugModeKey(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // LocSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "LocSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "SoftVisionApp.h" |
| | | #include "Bspline.h" |
| | | |
| | | |
| | | // CLocSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CLocSetDlg, CDialogEx) |
| | | |
| | | CLocSetDlg::CLocSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_LOC_SET, pParent) |
| | | , m_topScore(0.5) |
| | | , m_botScore(0.5) |
| | | { |
| | | m_dot = NULL; |
| | | m_dotTop = nullptr; |
| | | m_dotBot = nullptr; |
| | | m_topMark.x = 0; |
| | | m_topMark.y = 0; |
| | | m_botMark.x = 0; |
| | | m_botMark.y = 0; |
| | | |
| | | HalconCpp::GenEmptyObj(&m_dispResultObject.hDispObject); |
| | | HalconCpp::GenEmptyObj(&m_dispResultObject.hDispObject); |
| | | } |
| | | |
| | | CLocSetDlg::~CLocSetDlg() |
| | | { |
| | | m_dispResultObject.hDispObject.Clear(); |
| | | m_dispResultObject.hDispRegion.Clear(); |
| | | } |
| | | |
| | | void CLocSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_TOP_MARK_X_LOC, m_topMark.x); |
| | | DDX_Text(pDX, IDC_EDIT_TOP_MARK_Y_LOC, m_topMark.y); |
| | | DDX_Text(pDX, IDC_EDIT_BOT_MARK_X_LOC, m_botMark.x); |
| | | DDX_Text(pDX, IDC_EDIT_BOT_MARK_Y_LOC, m_botMark.y); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_TOP_SCORE_LOC, m_topScore); |
| | | DDX_Text(pDX, IDC_EDIT_BOT_SCORE_LOC, m_botScore); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CLocSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_SET_POSE_LOC, &CLocSetDlg::OnBnClickedButtonSetPoseLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_TOP_REFRESH_LOC, &CLocSetDlg::OnBnClickedButtonTopRefreshLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_BOT_REFRESH_LOC, &CLocSetDlg::OnBnClickedButtonBotRefreshLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_TOP_DELETE_LOC, &CLocSetDlg::OnBnClickedButtonTopDeleteLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_BOT_DELETE_LOC, &CLocSetDlg::OnBnClickedButtonBotDeleteLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_EXECUTE_LOC, &CLocSetDlg::OnBnClickedButtonExecuteLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_LOCK_LOCK, &CLocSetDlg::OnBnClickedButtonLockLock) |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_LOC, &CLocSetDlg::OnBnClickedButtonSaveLoc) |
| | | ON_BN_CLICKED(IDC_BUTTON_NORCH, &CLocSetDlg::OnBnClickedButtonNorch) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CLocSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | void CLocSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | if (nullptr != m_displayTop) { |
| | | ClsDisplay_Free(m_displayTop); |
| | | m_displayTop = nullptr; |
| | | } |
| | | |
| | | if (nullptr != m_displayBot) { |
| | | ClsDisplay_Free(m_displayBot); |
| | | m_displayBot = nullptr; |
| | | } |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | BOOL CLocSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitDisplay(); |
| | | |
| | | m_isLock = TRUE; |
| | | LockPose(m_isLock); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CLocSetDlg::LockPose(BOOL isLock){ |
| | | /* code */ |
| | | if (isLock) { |
| | | GetDlgItem(IDC_BUTTON_SET_POSE_LOC)->EnableWindow(FALSE); |
| | | GetDlgItem(IDC_BUTTON_LOCK_LOCK)->SetWindowTextW(L"UnLock"); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_BUTTON_SET_POSE_LOC)->EnableWindow(TRUE); |
| | | GetDlgItem(IDC_BUTTON_LOCK_LOCK)->SetWindowTextW(L"Lock"); |
| | | } |
| | | } |
| | | |
| | | int CLocSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | void CLocSetDlg::InitDisplay(void) { |
| | | /* code */ |
| | | m_displayTop = ClsDisplay_Create(); |
| | | if (nullptr != m_displayTop) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_IMAGE_LOC); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_displayTop->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_displayTop->SetOperFlag(DEFAULT_OPER_FLAG); |
| | | m_displayTop->SetDraw("fill", DISP_OBJECT); |
| | | m_displayTop->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_displayTop->SetDraw("fill", DISP_REGION); |
| | | std::string color = ClsVision::Rgb2Color(255, 0, 0); |
| | | m_displayTop->SetColor(color, DISP_REGION); |
| | | |
| | | m_displayTop->SetDraw("fill", DISP_CROSS); |
| | | color = ClsVision::Rgb2Color(224, 224, 224); |
| | | m_displayTop->SetColor(color, DISP_CROSS); |
| | | |
| | | m_displayTop->SetDraw("fill", DISP_SELECT); |
| | | m_displayTop->SetColor("yellow", DISP_SELECT); |
| | | color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_displayTop->SetBackgroundColor(color); |
| | | } |
| | | |
| | | m_displayBot = ClsDisplay_Create(); |
| | | if (nullptr != m_displayBot) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_IMAGE_LOC); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_displayBot->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_displayBot->SetOperFlag(DEFAULT_OPER_FLAG); |
| | | m_displayBot->SetDraw("fill", DISP_OBJECT); |
| | | m_displayBot->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_displayBot->SetDraw("fill", DISP_REGION); |
| | | std::string color = ClsVision::Rgb2Color(255, 0, 0); |
| | | m_displayBot->SetColor(color, DISP_REGION); |
| | | |
| | | m_displayBot->SetDraw("fill", DISP_CROSS); |
| | | color = ClsVision::Rgb2Color(224, 224, 224); |
| | | m_displayBot->SetColor(color, DISP_CROSS); |
| | | |
| | | m_displayBot->SetDraw("fill", DISP_SELECT); |
| | | m_displayBot->SetColor("yellow", DISP_SELECT); |
| | | color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_displayBot->SetBackgroundColor(color); |
| | | } |
| | | } |
| | | |
| | | void CLocSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveLocParams(); |
| | | |
| | | LockPose(TRUE); |
| | | |
| | | //æ¾ç¤ºå½åçåæ° |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getLocProcess(eDir); |
| | | ShowLocParams(); |
| | | |
| | | SaveNccDotProcess(); |
| | | |
| | | if (NULL != m_dot) { |
| | | m_dotTop = m_dot->getDot(0); |
| | | m_dotBot = m_dot->getDot(1); |
| | | } |
| | | ShowNccDotProcess(); |
| | | } |
| | | |
| | | void CLocSetDlg::ShowNccDotProcess(void) { |
| | | /* code */ |
| | | if (NULL != m_dotTop) { |
| | | m_topScore = m_dotTop->m_score; |
| | | |
| | | ClsVision::GenEmptyObject(m_displayTop->GetImage()); |
| | | m_displayTop->SetImage(m_dotTop->getImage()); |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_displayTop->GetImage(), width, height); |
| | | if (width >= 1 && height >= 1) { |
| | | m_displayTop->AutoWindowSize(width, height); |
| | | } |
| | | |
| | | if (width >= 1 && height >= 1) { |
| | | HalconCpp::GenEmptyObj(&m_displayTop->GetRegion()); |
| | | HalconCpp::HObject hRegion, hRegion1, hRegion2; |
| | | HalconCpp::GenRegionLine(&hRegion1, 0, 0.5 * (width - 1), height - 1, 0.5 * (width - 1)); |
| | | HalconCpp::GenRegionLine(&hRegion2, 0.5 * (height - 1), 0, 0.5 * (height - 1), width - 1); |
| | | HalconCpp::ConcatObj(hRegion1, hRegion2, &hRegion); |
| | | m_displayTop->SetRegion(hRegion); |
| | | } |
| | | |
| | | m_displayTop->ClearWindow(); |
| | | m_displayTop->DispImage(); |
| | | m_displayTop->DispRegion(); |
| | | } |
| | | |
| | | if (NULL != m_dotBot) { |
| | | m_botScore = m_dotBot->m_score; |
| | | |
| | | ClsVision::GenEmptyObject(m_displayBot->GetImage()); |
| | | m_displayBot->SetImage(m_dotBot->getImage()); |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_displayBot->GetImage(), width, height); |
| | | if (width >= 1 && height >= 1) { |
| | | m_displayBot->AutoWindowSize(width, height); |
| | | } |
| | | |
| | | if (width >= 1 && height >= 1) { |
| | | HalconCpp::GenEmptyObj(&m_displayBot->GetRegion()); |
| | | HalconCpp::HObject hRegion, hRegion1, hRegion2; |
| | | HalconCpp::GenRegionLine(&hRegion1, 0, 0.5 * (width - 1), height - 1, 0.5 * (width - 1)); |
| | | HalconCpp::GenRegionLine(&hRegion2, 0.5 * (height - 1), 0, 0.5 * (height - 1), width - 1); |
| | | HalconCpp::ConcatObj(hRegion1, hRegion2, &hRegion); |
| | | m_displayBot->SetRegion(hRegion); |
| | | } |
| | | |
| | | m_displayBot->ClearWindow(); |
| | | m_displayBot->DispImage(); |
| | | m_displayBot->DispRegion(); |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CLocSetDlg::SaveNccDotProcess(void) { |
| | | /* code */ |
| | | UpdateData(TRUE); |
| | | if (NULL != m_dotTop) { |
| | | m_dotTop->m_score = m_topScore; |
| | | } |
| | | |
| | | if (NULL != m_dotBot) { |
| | | m_dotBot->m_score = m_botScore; |
| | | } |
| | | } |
| | | |
| | | void CLocSetDlg::ShowLocParams(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | m_topMark = m_dot->getPose(0); |
| | | m_botMark = m_dot->getPose(1); |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CLocSetDlg::SaveLocParams(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | m_dot->setPose(m_topMark, 0); |
| | | m_dot->setPose(m_botMark, 1); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonSetPoseLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return; |
| | | if (pSideData->m_bTopMark_Find) { |
| | | m_topMark = pSideData->m_mTopMark; |
| | | if (nullptr != m_dot) { |
| | | m_dot->setPose(m_topMark, 0); |
| | | } |
| | | } |
| | | |
| | | if (pSideData->m_bBotMark_Find) { |
| | | m_botMark = pSideData->m_mBotMark; |
| | | if (NULL != m_dot) { |
| | | m_dot->setPose(m_botMark, 1); |
| | | } |
| | | } |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonTopRefreshLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (NULL == m_dotTop) return; |
| | | |
| | | //1. åéä¿¡æ¯ |
| | | CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); |
| | | |
| | | //2. è·åä½ç½®ä¿¡æ¯ |
| | | int x1 = 0; |
| | | int y1 = 0; |
| | | int x2 = 0; |
| | | int y2 = 0; |
| | | if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; |
| | | |
| | | //æªå¾ |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) return; |
| | | |
| | | Point2I pose; |
| | | pose.x = (int)(0.5 * (x1 + x2)); |
| | | pose.y = (int)(0.5 * (y1 + y2)); |
| | | m_dotTop->setPose(pose); |
| | | |
| | | m_dotTop->setImage(hImage); |
| | | |
| | | if (NULL == m_displayTop) return; |
| | | |
| | | ShowNccDotProcess(); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonBotRefreshLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (NULL == m_dotBot) return; |
| | | |
| | | //1. åéä¿¡æ¯ |
| | | CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); |
| | | |
| | | //2. è·åä½ç½®ä¿¡æ¯ |
| | | int x1 = 0; |
| | | int y1 = 0; |
| | | int x2 = 0; |
| | | int y2 = 0; |
| | | if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; |
| | | |
| | | //æªå¾ |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) return; |
| | | |
| | | Point2I pose; |
| | | pose.x = (int)(0.5 * (x1 + x2)); |
| | | pose.y = (int)(0.5 * (y1 + y2)); |
| | | m_dotBot->setPose(pose); |
| | | |
| | | m_dotBot->setImage(hImage); |
| | | |
| | | if (NULL == m_displayBot) return; |
| | | |
| | | ShowNccDotProcess(); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonTopDeleteLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (NULL == m_dotTop) return; |
| | | |
| | | HalconCpp::HObject hImage; |
| | | HalconCpp::GenEmptyObj(&hImage); |
| | | |
| | | m_dotTop->setImage(hImage); |
| | | |
| | | ShowNccDotProcess(); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonBotDeleteLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (NULL == m_dotBot) return; |
| | | |
| | | HalconCpp::HObject hImage; |
| | | HalconCpp::GenEmptyObj(&hImage); |
| | | |
| | | m_dotBot->setImage(hImage); |
| | | |
| | | ShowNccDotProcess(); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonExecuteLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { |
| | | pSideData->m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | SaveLocParams(); |
| | | SaveNccDotProcess(); |
| | | if (NULL == m_dot) return; |
| | | |
| | | m_dot->execute(m_eDir); |
| | | |
| | | DispAllResult(); |
| | | } |
| | | |
| | | void CLocSetDlg::DispAllResult(void) { |
| | | /* code */ |
| | | CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonLockLock() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (m_isLock) { |
| | | m_isLock = FALSE; |
| | | } |
| | | else { |
| | | m_isLock = TRUE; |
| | | } |
| | | LockPose(m_isLock); |
| | | } |
| | | |
| | | |
| | | BOOL CLocSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonSaveLoc() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveLocParams(); |
| | | SaveNccDotProcess(); |
| | | } |
| | | |
| | | |
| | | void CLocSetDlg::OnBnClickedButtonNorch() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 0 : (1414, 3577), (1358, 3588), (1370, 3586) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 1 : (1506, 4215), (1448, 4219), (1460, 4218) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 2 : (1521, 4461), (1463, 4464), (1476, 4463) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 3 : (1526, 4584), (1468, 4584), (1480, 4584) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 4 : (1547, 4668), (1469, 4636), (1482, 4642) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 5 : (1546, 4748), (1474, 4740), (1488, 4741) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 6 : (1528, 4831), (1469, 4869), (1482, 4860) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 7 : (1525, 4951), (1468, 4925), (1481, 4931) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 8 : (1511, 5176), (1454, 5171), (1466, 5172) |
| | | //[INFO] 11 : 21 : 43 : 701 Norch 9 : (1415, 5856), (1359, 5845), (1371, 5847) |
| | | return; |
| | | #if 0 |
| | | Point2D aryPoints[10]; |
| | | aryPoints[0].x = 1370; |
| | | aryPoints[0].y = 3586; |
| | | aryPoints[1].x = 1460; |
| | | aryPoints[1].y = 4218; |
| | | aryPoints[2].x = 1476; |
| | | aryPoints[2].y = 4463; |
| | | aryPoints[3].x = 1480; |
| | | aryPoints[3].y = 4584; |
| | | aryPoints[4].x = 1482; |
| | | aryPoints[4].y = 4668; |
| | | aryPoints[5].x = 1488; |
| | | aryPoints[5].y = 4741; |
| | | aryPoints[6].x = 1482; |
| | | aryPoints[6].y = 4831; |
| | | aryPoints[7].x = 1481; |
| | | aryPoints[7].y = 4951; |
| | | aryPoints[8].x = 1466; |
| | | aryPoints[8].y = 5172; |
| | | aryPoints[9].x = 1371; |
| | | aryPoints[9].y = 5847; |
| | | CRect roiRect; |
| | | roiRect.left = 1017; |
| | | roiRect.top = 3456; |
| | | roiRect.right = 1573; |
| | | roiRect.bottom = 5970; |
| | | std::vector<Point2D> vPoints; |
| | | for (int i = 0; i < 10; i++) { |
| | | Point2D point = aryPoints[i]; |
| | | vPoints.push_back(point); |
| | | } |
| | | CRect rectResult[100]; |
| | | int nRet = CVisionBufferPro::findNorchDefect(m_eDir, vPoints, roiRect, 30, 5, 45, 1, 10, 10, rectResult); |
| | | #endif |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "LocProcess.h" |
| | | |
| | | // CLocSetDlg å¯¹è¯æ¡ |
| | | |
| | | class CLocSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CLocSetDlg) |
| | | |
| | | public: |
| | | CLocSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CLocSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_LOC_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | IClsDisplay *m_displayTop; |
| | | IClsDisplay *m_displayBot; |
| | | |
| | | CLocProcess *m_dot; |
| | | CNccDotProcess *m_dotTop; |
| | | CNccDotProcess *m_dotBot; |
| | | |
| | | Point2I m_topMark; |
| | | Point2I m_botMark; |
| | | double m_topScore; |
| | | double m_botScore; |
| | | |
| | | BOOL m_isLock; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | void InitDisplay(void); |
| | | |
| | | //2. æ§è¡ |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | |
| | | //3. ä¿åå½åçæ°æ® |
| | | void SaveLocParams(void); |
| | | void ShowLocParams(void); |
| | | |
| | | //3. ä¿åå½åç¶æ |
| | | void SaveNccDotProcess(void); |
| | | void ShowNccDotProcess(void); |
| | | |
| | | //4. å éæä½ |
| | | void LockPose(BOOL isLock); |
| | | |
| | | //5. æ¾ç¤ºææ |
| | | void DispAllResult(void); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | DispResultObject m_dispResultObject; |
| | | |
| | | public: |
| | | afx_msg void OnClose(); |
| | | virtual BOOL OnInitDialog(); |
| | | int setDimensionDir(DimensionDir eDir); |
| | | afx_msg void OnBnClickedButtonSetPoseLoc(); |
| | | afx_msg void OnBnClickedButtonTopRefreshLoc(); |
| | | afx_msg void OnBnClickedButtonBotRefreshLoc(); |
| | | afx_msg void OnBnClickedButtonTopDeleteLoc(); |
| | | afx_msg void OnBnClickedButtonBotDeleteLoc(); |
| | | afx_msg void OnBnClickedButtonExecuteLoc(); |
| | | afx_msg void OnBnClickedButtonLockLock(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | afx_msg void OnBnClickedButtonSaveLoc();; |
| | | afx_msg void OnBnClickedButtonNorch(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // LockSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "LockSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | #define TIMER_ID_LOCK_ID 6001 |
| | | // CLockSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CLockSetDlg, CDialogEx) |
| | | |
| | | CLockSetDlg::CLockSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_LOCK_SET, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CLockSetDlg::~CLockSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CLockSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CLockSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_WM_TIMER() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CLockSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CLockSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | BOOL CLockSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | m_nLockTime = 0; |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
| | | |
| | | SetTimer(TIMER_ID_LOCK_ID, 1000, NULL); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CLockSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | KillTimer(TIMER_ID_LOCK_ID); |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | void CLockSetDlg::OnTimer(UINT_PTR nIDEvent) |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | switch (nIDEvent) |
| | | { |
| | | case TIMER_ID_LOCK_ID: |
| | | ShowLockTime(); |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | CDialogEx::OnTimer(nIDEvent); |
| | | } |
| | | |
| | | void CLockSetDlg::ShowLockTime(void) { |
| | | /* code */ |
| | | CString strTime; |
| | | strTime.Format(_T("Lock: %d sec"), m_nLockTime); |
| | | GetDlgItem(IDC_STATIC_LOCK_TIME)->SetWindowText(strTime); |
| | | |
| | | m_nLockTime += 1; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CLockSetDlg å¯¹è¯æ¡ |
| | | |
| | | class CLockSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CLockSetDlg) |
| | | |
| | | public: |
| | | CLockSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CLockSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_LOCK_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnClose(); |
| | | afx_msg void OnTimer(UINT_PTR nIDEvent); |
| | | |
| | | private: |
| | | int m_nLockTime; |
| | | |
| | | private: |
| | | void ShowLockTime(void); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // MeasureSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "MeasureSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | |
| | | |
| | | // CMeasureSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CMeasureSetDlg, CDialogEx) |
| | | |
| | | CMeasureSetDlg::CMeasureSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_MEASURE_SET, pParent) |
| | | { |
| | | m_dot = NULL; |
| | | for (int i = 0; i < 4; i++) { |
| | | m_inf[i].idxRefer = 0; |
| | | m_inf[i].typePoint = 0; |
| | | m_inf[i].modePoint = 0; |
| | | m_inf[i].pointThres = 30; |
| | | m_inf[i].modeNear = 0; |
| | | m_inf[i].nearThres = 30; |
| | | } |
| | | |
| | | m_firstPoint.x = 0; |
| | | m_firstPoint.y = 0; |
| | | |
| | | m_secondPoint.x = 0; |
| | | m_secondPoint.y = 0; |
| | | } |
| | | |
| | | CMeasureSetDlg::~CMeasureSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CMeasureSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE, m_combPointRefer[0]); |
| | | DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE, m_combPointType[0]); |
| | | DDX_Control(pDX, IDC_COMBO_START_MODE, m_combStartMode[0]); |
| | | DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE, m_combEndMode[0]); |
| | | |
| | | DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE2, m_combPointRefer[1]); |
| | | DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE2, m_combPointType[1]); |
| | | DDX_Control(pDX, IDC_COMBO_START_MODE2, m_combStartMode[1]); |
| | | DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE2, m_combEndMode[1]); |
| | | |
| | | DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE3, m_combPointRefer[2]); |
| | | DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE3, m_combPointType[2]); |
| | | DDX_Control(pDX, IDC_COMBO_START_MODE3, m_combStartMode[2]); |
| | | DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE3, m_combEndMode[2]); |
| | | |
| | | DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE4, m_combPointRefer[3]); |
| | | DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE4, m_combPointType[3]); |
| | | DDX_Control(pDX, IDC_COMBO_START_MODE4, m_combStartMode[3]); |
| | | DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE4, m_combEndMode[3]); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE, m_inf[0].pointThres); |
| | | DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE, m_inf[0].nearThres); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE2, m_inf[1].pointThres); |
| | | DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE2, m_inf[1].nearThres); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE3, m_inf[2].pointThres); |
| | | DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE3, m_inf[2].nearThres); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE4, m_inf[3].pointThres); |
| | | DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE4, m_inf[3].nearThres); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_POSE_X_MEASURE, m_firstPoint.x); |
| | | DDX_Text(pDX, IDC_EDIT_POSE_Y_MEASURE, m_firstPoint.y); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_BOT_X_MEASURE, m_secondPoint.x); |
| | | DDX_Text(pDX, IDC_EDIT_BOT_Y_MEASURE, m_secondPoint.y); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CMeasureSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_SET_TOP_MEASURE, &CMeasureSetDlg::OnBnClickedButtonSetTopMeasure) |
| | | ON_BN_CLICKED(IDC_BUTTON_DEL_TOP_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDelTopMeasure) |
| | | ON_BN_CLICKED(IDC_BUTTON_SET_BOT_MEASURE, &CMeasureSetDlg::OnBnClickedButtonSetBotMeasure) |
| | | ON_BN_CLICKED(IDC_BUTTON_DEL_BOT_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDelBotMeasure) |
| | | ON_BN_CLICKED(IDC_BUTTON_DRAW_ROI_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure) |
| | | ON_BN_CLICKED(IDC_BUTTON_DRAW_ROI_MEASURE2, &CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure2) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CMeasureSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CMeasureSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | BOOL CMeasureSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitControl(); |
| | | |
| | | ShowParamUi(); |
| | | |
| | | LockROI(-1); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CMeasureSetDlg::SetDot(CCornerDistProcess *dot) { |
| | | /* code */ |
| | | m_dot = dot; |
| | | } |
| | | |
| | | void CMeasureSetDlg::InitControl(void) { |
| | | /* code */ |
| | | for (int i = 0; i < 4; i++) { |
| | | m_combPointRefer[i].InsertString(0, _T("Affine")); |
| | | m_combPointRefer[i].InsertString(1, _T("Top Point")); |
| | | m_combPointRefer[i].InsertString(2, _T("Bot Point")); |
| | | m_combPointRefer[i].SetCurSel(0); |
| | | |
| | | m_combPointType[i].InsertString(0, _T("Start Point")); |
| | | m_combPointType[i].InsertString(1, _T("End Point")); |
| | | m_combPointType[i].SetCurSel(0); |
| | | |
| | | m_combStartMode[i].InsertString(0, _T("All")); |
| | | m_combStartMode[i].InsertString(1, _T("W_T_B")); |
| | | m_combStartMode[i].InsertString(2, _T("B_T_W")); |
| | | m_combStartMode[i].SetCurSel(0); |
| | | |
| | | m_combEndMode[i].InsertString(0, _T("All")); |
| | | m_combEndMode[i].InsertString(1, _T("W_T_B")); |
| | | m_combEndMode[i].InsertString(2, _T("B_T_W")); |
| | | m_combEndMode[i].SetCurSel(0); |
| | | } |
| | | } |
| | | |
| | | void CMeasureSetDlg::ShowParamUi(void) { |
| | | /* code */ |
| | | if (NULL == m_dot) return; |
| | | |
| | | m_firstPoint = m_dot->getPoint(4); |
| | | m_secondPoint = m_dot->getPoint(5); |
| | | |
| | | MeasureInfo inf; |
| | | for (int i = 0; i < 4; i++) { |
| | | inf = m_dot->getMeasureInfo(i); |
| | | m_inf[i] = inf; |
| | | |
| | | m_combPointRefer[i].SetCurSel(inf.idxRefer); |
| | | m_combPointType[i].SetCurSel(inf.typePoint); |
| | | m_combStartMode[i].SetCurSel(inf.modePoint); |
| | | m_combEndMode[i].SetCurSel(inf.modeNear); |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CMeasureSetDlg::SaveCornerParam(void) { |
| | | /* code */ |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | m_dot->setPoint(m_firstPoint, 4); |
| | | m_dot->setPoint(m_secondPoint, 5); |
| | | |
| | | MeasureInfo inf; |
| | | for (int i = 0; i < 4; i++) { |
| | | inf = m_inf[i]; |
| | | inf.idxRefer = m_combPointRefer[i].GetCurSel(); |
| | | inf.typePoint = m_combPointType[i].GetCurSel(); |
| | | inf.modePoint = m_combStartMode[i].GetCurSel(); |
| | | inf.modeNear = m_combEndMode[i].GetCurSel(); |
| | | m_dot->setMeasureInfo(inf, i); |
| | | } |
| | | } |
| | | |
| | | void CMeasureSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | SaveCornerParam(); |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | void CMeasureSetDlg::OnBnClickedButtonSetTopMeasure() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | |
| | | void CMeasureSetDlg::OnBnClickedButtonDelTopMeasure() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | m_firstPoint.x = 0; |
| | | m_firstPoint.y = 0; |
| | | m_dot->setPoint(m_firstPoint, 4); |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | |
| | | void CMeasureSetDlg::OnBnClickedButtonSetBotMeasure() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | |
| | | void CMeasureSetDlg::OnBnClickedButtonDelBotMeasure() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | m_secondPoint.x = 0; |
| | | m_secondPoint.y = 0; |
| | | m_dot->setPoint(m_secondPoint, 5); |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | |
| | | void CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg()); |
| | | if (NULL == pMainDlg) return; |
| | | |
| | | LockROI(1); |
| | | } |
| | | |
| | | void CMeasureSetDlg::LockROI(int nType) { |
| | | /* code */ |
| | | if (1 == nType) { |
| | | GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(TRUE); |
| | | GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(FALSE); |
| | | } |
| | | else if (2 == nType) { |
| | | GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(FALSE); |
| | | GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(TRUE); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(FALSE); |
| | | GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(FALSE); |
| | | } |
| | | } |
| | | |
| | | void CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure2() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg()); |
| | | if (NULL == pMainDlg) return; |
| | | |
| | | LockROI(2); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | // CMeasureSetDlg å¯¹è¯æ¡ |
| | | #include "CornerDistProcess.h" |
| | | #include "afxwin.h" |
| | | |
| | | class CMeasureSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CMeasureSetDlg) |
| | | |
| | | public: |
| | | CMeasureSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CMeasureSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_MEASURE_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | CCornerDistProcess *m_dot; |
| | | |
| | | MeasureInfo m_inf[4]; |
| | | |
| | | CComboBox m_combPointRefer[4]; |
| | | CComboBox m_combPointType[4]; |
| | | CComboBox m_combStartMode[4]; |
| | | CComboBox m_combEndMode[4]; |
| | | |
| | | Point2I m_firstPoint; |
| | | Point2I m_secondPoint; |
| | | |
| | | private: |
| | | //1. åå§åç©ºé´ |
| | | void InitControl(void); |
| | | |
| | | //2. æ¾ç¤ºåæ° |
| | | void ShowParamUi(void); |
| | | |
| | | //3. ä¿ååæ° |
| | | void SaveCornerParam(void); |
| | | |
| | | void LockROI(int nType); |
| | | |
| | | public: |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | virtual BOOL OnInitDialog(); |
| | | void SetDot(CCornerDistProcess *dot); |
| | | |
| | | afx_msg void OnClose(); |
| | | afx_msg void OnBnClickedButtonSetTopMeasure(); |
| | | afx_msg void OnBnClickedButtonDelTopMeasure(); |
| | | afx_msg void OnBnClickedButtonSetBotMeasure(); |
| | | afx_msg void OnBnClickedButtonDelBotMeasure(); |
| | | afx_msg void OnBnClickedButtonDrawRoiMeasure(); |
| | | afx_msg void OnBnClickedButtonDrawRoiMeasure2(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // OpRoiDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "OpRoiDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionSetDlg.h" |
| | | |
| | | |
| | | // COpRoiDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(COpRoiDlg, CDialogEx) |
| | | |
| | | COpRoiDlg::COpRoiDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_ROI_SET, pParent) |
| | | , m_stepX(2) |
| | | , m_stepY(2) |
| | | { |
| | | m_isLock = TRUE; |
| | | } |
| | | |
| | | COpRoiDlg::~COpRoiDlg() |
| | | { |
| | | } |
| | | |
| | | void COpRoiDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Text(pDX, IDC_EDIT_X_STEP_ROI, m_stepX); |
| | | DDX_Text(pDX, IDC_EDIT_Y_STEP_ROI, m_stepY); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(COpRoiDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_MOVE_RIGHT_ROI, &COpRoiDlg::OnBnClickedButtonMoveRightRoi) |
| | | ON_BN_CLICKED(IDC_BUTTON_MOVE_UP_ROI, &COpRoiDlg::OnBnClickedButtonMoveUpRoi) |
| | | ON_BN_CLICKED(IDC_BUTTON_MOVE_LEFT_ROI, &COpRoiDlg::OnBnClickedButtonMoveLeftRoi) |
| | | ON_BN_CLICKED(IDC_BUTTON_MOVE_DOWN_ROI, &COpRoiDlg::OnBnClickedButtonMoveDownRoi) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // COpRoiDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | void COpRoiDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | m_isLock = TRUE; |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | BOOL COpRoiDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | BOOL COpRoiDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitBitICON(); |
| | | |
| | | ::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 1200, 200, 0, 0, SWP_NOSIZE); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void COpRoiDlg::InitBitICON(void) { |
| | | /* code */ |
| | | { |
| | | CButton *pTop = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_UP_ROI)); |
| | | HICON iconTop = AfxGetApp()->LoadIcon(IDI_ICON_UP); |
| | | pTop->SetIcon(iconTop); |
| | | } |
| | | |
| | | { |
| | | CButton *pDown = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_DOWN_ROI)); |
| | | HICON iconDown = AfxGetApp()->LoadIcon(IDI_ICON_DOWN); |
| | | pDown->SetIcon(iconDown); |
| | | } |
| | | |
| | | { |
| | | CButton *pBtnRight = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_RIGHT_ROI)); |
| | | HICON iconRight = AfxGetApp()->LoadIcon(IDI_ICON_RIGHT); |
| | | pBtnRight->SetIcon(iconRight); |
| | | } |
| | | |
| | | { |
| | | CButton *pBtnLeft = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_LEFT_ROI)); |
| | | HICON iconLeft = AfxGetApp()->LoadIcon(IDI_ICON_LEFT); |
| | | pBtnLeft->SetIcon(iconLeft); |
| | | } |
| | | } |
| | | |
| | | void COpRoiDlg::MoveRegion(int nType) { |
| | | /* code */ |
| | | } |
| | | |
| | | |
| | | void COpRoiDlg::OnBnClickedButtonMoveRightRoi() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | MoveRegion(0); |
| | | } |
| | | |
| | | |
| | | void COpRoiDlg::OnBnClickedButtonMoveUpRoi() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | MoveRegion(1); |
| | | } |
| | | |
| | | |
| | | void COpRoiDlg::OnBnClickedButtonMoveLeftRoi() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | MoveRegion(2); |
| | | } |
| | | |
| | | |
| | | void COpRoiDlg::OnBnClickedButtonMoveDownRoi() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | MoveRegion(3); |
| | | } |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // COpRoiDlg å¯¹è¯æ¡ |
| | | |
| | | class COpRoiDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(COpRoiDlg) |
| | | |
| | | public: |
| | | COpRoiDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~COpRoiDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_ROI_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | int m_stepX; |
| | | int m_stepY; |
| | | |
| | | BOOL m_isLock; |
| | | |
| | | private: |
| | | //åºå |
| | | void MoveRegion(int nType); |
| | | |
| | | // |
| | | void InitBitICON(void); |
| | | |
| | | public: |
| | | afx_msg void OnClose(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnBnClickedButtonMoveRightRoi(); |
| | | afx_msg void OnBnClickedButtonMoveUpRoi(); |
| | | afx_msg void OnBnClickedButtonMoveLeftRoi(); |
| | | afx_msg void OnBnClickedButtonMoveDownRoi(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // RcutSetDLg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "RcutSetDLg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "VisionRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | // CRcutSetDLg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CRcutSetDLg, CDialogEx) |
| | | |
| | | CRcutSetDLg::CRcutSetDLg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_RCUT_SET, pParent) |
| | | { |
| | | /* code */ |
| | | m_dotTop = NULL; |
| | | m_dotBot = NULL; |
| | | } |
| | | |
| | | CRcutSetDLg::~CRcutSetDLg() |
| | | { |
| | | } |
| | | |
| | | void CRcutSetDLg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_PANEL_KDIST_INFO, m_PanelRcut); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CRcutSetDLg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCESS_RCUT, &CRcutSetDLg::OnBnClickedButtonProcessRcut) |
| | | ON_COMMAND(ID_EDITROI_IMAGEROI, &CRcutSetDLg::OnEditroiImageroi) |
| | | ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT, &CRcutSetDLg::OnBnClickedButtonSetImageRcut) |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_RCUT, &CRcutSetDLg::OnBnClickedButtonSaveRcut) |
| | | ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT2, &CRcutSetDLg::OnBnClickedButtonSetImageRcut2) |
| | | ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN, &CRcutSetDLg::OnBnClickedButtonTopTrain) |
| | | ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN2, &CRcutSetDLg::OnBnClickedButtonTopTrain2) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CRcutSetDLg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | void CRcutSetDLg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | if (NULL != m_displayTop1) { |
| | | ClsDisplay_Free(m_displayTop1); |
| | | m_displayTop1 = NULL; |
| | | } |
| | | |
| | | if (NULL != m_displayTop2) { |
| | | ClsDisplay_Free(m_displayTop2); |
| | | m_displayTop2 = NULL; |
| | | } |
| | | |
| | | |
| | | if (NULL != m_displayBot1) { |
| | | ClsDisplay_Free(m_displayBot1); |
| | | m_displayBot1 = NULL; |
| | | } |
| | | if (NULL != m_displayBot2) { |
| | | ClsDisplay_Free(m_displayBot2); |
| | | m_displayBot2 = NULL; |
| | | } |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | int CRcutSetDLg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | BOOL CRcutSetDLg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitDisplay(); |
| | | |
| | | InitMenu(); |
| | | |
| | | InitPanel(); |
| | | |
| | | m_eDir = DIMENSION_NONE; |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CRcutSetDLg::InitDisplay(void) { |
| | | /* code */ |
| | | m_displayTop1 = ClsDisplay_Create(); |
| | | if (nullptr != m_displayTop1) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_displayTop1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_displayTop1->SetOperFlag(SELECT_OPER_FLAG); |
| | | m_displayTop1->SetDraw("fill", DISP_OBJECT); |
| | | m_displayTop1->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_displayTop1->SetDraw("fill", DISP_REGION); |
| | | m_displayTop1->SetColor("red", DISP_REGION); |
| | | |
| | | m_displayTop1->SetDraw("fill", DISP_CROSS); |
| | | m_displayTop1->SetColor("green", DISP_CROSS); |
| | | |
| | | m_displayTop1->SetDraw("fill", DISP_SELECT); |
| | | m_displayTop1->SetColor("red", DISP_SELECT); |
| | | |
| | | std::string color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_displayTop1->SetBackgroundColor(color); |
| | | } |
| | | |
| | | m_displayTop2 = ClsDisplay_Create(); |
| | | if (nullptr != m_displayTop2) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT_CHIP); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_displayTop2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_displayTop2->SetOperFlag(SELECT_OPER_FLAG); |
| | | m_displayTop2->SetDraw("fill", DISP_OBJECT); |
| | | m_displayTop2->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_displayTop2->SetDraw("fill", DISP_REGION); |
| | | m_displayTop2->SetColor("red", DISP_REGION); |
| | | |
| | | m_displayTop2->SetDraw("fill", DISP_CROSS); |
| | | m_displayTop2->SetColor("green", DISP_CROSS); |
| | | |
| | | m_displayTop2->SetDraw("fill", DISP_SELECT); |
| | | m_displayTop2->SetColor("red", DISP_SELECT); |
| | | |
| | | std::string color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_displayTop2->SetBackgroundColor(color); |
| | | } |
| | | |
| | | m_displayBot1 = ClsDisplay_Create(); |
| | | if (nullptr != m_displayBot1) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT2); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_displayBot1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_displayBot1->SetOperFlag(SELECT_OPER_FLAG); |
| | | m_displayBot1->SetDraw("fill", DISP_OBJECT); |
| | | m_displayBot1->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_displayBot1->SetDraw("fill", DISP_REGION); |
| | | m_displayBot1->SetColor("red", DISP_REGION); |
| | | |
| | | m_displayBot1->SetDraw("fill", DISP_CROSS); |
| | | m_displayBot1->SetColor("green", DISP_CROSS); |
| | | |
| | | m_displayBot1->SetDraw("fill", DISP_SELECT); |
| | | m_displayBot1->SetColor("red", DISP_SELECT); |
| | | |
| | | std::string color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_displayBot1->SetBackgroundColor(color); |
| | | } |
| | | |
| | | m_displayBot2 = ClsDisplay_Create(); |
| | | if (nullptr != m_displayBot2) { |
| | | CRect rect; |
| | | CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT_CHIP); |
| | | pDispWnd->GetWindowRect(rect); |
| | | m_displayBot2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); |
| | | m_displayBot2->SetOperFlag(SELECT_OPER_FLAG); |
| | | m_displayBot2->SetDraw("fill", DISP_OBJECT); |
| | | m_displayBot2->SetColor("red", DISP_OBJECT); |
| | | |
| | | m_displayBot2->SetDraw("fill", DISP_REGION); |
| | | m_displayBot2->SetColor("red", DISP_REGION); |
| | | |
| | | m_displayBot2->SetDraw("fill", DISP_CROSS); |
| | | m_displayBot2->SetColor("green", DISP_CROSS); |
| | | |
| | | m_displayBot2->SetDraw("fill", DISP_SELECT); |
| | | m_displayBot2->SetColor("red", DISP_SELECT); |
| | | |
| | | std::string color = ClsVision::Rgb2Color(0, 0, 100); |
| | | m_displayBot2->SetBackgroundColor(color); |
| | | } |
| | | } |
| | | |
| | | void CRcutSetDLg::InitMenu(void) { |
| | | /* code */ |
| | | m_visionMenu.LoadMenu(IDR_MENU1); |
| | | } |
| | | |
| | | BOOL CRcutSetDLg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | void CRcutSetDLg::OnBnClickedButtonProcessRcut() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { |
| | | pSideData->m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | SaveRcutParam(); |
| | | if (NULL == m_dot) return; |
| | | |
| | | // Log_GetDebug()->TraceInfo("Start: %d", __LINE__); |
| | | m_dot->execute(m_eDir); |
| | | // Log_GetDebug()->TraceInfo("End: %d", __LINE__); |
| | | |
| | | ShowRcutImage(); |
| | | |
| | | DispResult(); |
| | | } |
| | | |
| | | void CRcutSetDLg::DispResult(void) { |
| | | /* code */ |
| | | CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); |
| | | |
| | | DispAllResult(); |
| | | } |
| | | |
| | | void CRcutSetDLg::DispAllResult(void) { |
| | | /* code */ |
| | | int nCount = 2; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CRcutDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | bool isDo = true; |
| | | if (1 != dot->m_nUse) isDo = false; |
| | | if (!isDo) { |
| | | int id = dot->getID(); |
| | | m_PanelRcut.SetItemText(id, 12, _T("NAN")); |
| | | } |
| | | else { //æ¾ç¤ºç»æ |
| | | CString strResult; |
| | | strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size()); |
| | | int id = dot->getID(); |
| | | m_PanelRcut.SetItemText(id, 12, strResult); |
| | | } |
| | | } |
| | | |
| | | m_PanelRcut.Invalidate(FALSE); |
| | | } |
| | | |
| | | void CRcutSetDLg::InitPanel(void) { |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | |
| | | CString strText; |
| | | //1. ID |
| | | strText = _T("ID."); |
| | | m_vParams.push_back(strText); |
| | | //2. name |
| | | strText = _T("Name"); |
| | | m_vParams.push_back(strText); |
| | | //3. use |
| | | strText = _T("use"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | //4. Chamfer Size |
| | | strText = _T("Chamber Size"); |
| | | m_vParams.push_back(strText); |
| | | //5. Bin Thres |
| | | strText = _T("Edge Thres"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | //6. Chip Range |
| | | strText = _T("Chip Range"); |
| | | m_vParams.push_back(strText); |
| | | //7. Chip Thres |
| | | strText = _T("Chip Thres"); |
| | | m_vParams.push_back(strText); |
| | | //8. Chip Smooth |
| | | strText = _T("Chip Smooth"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | //9. Start Da |
| | | strText = _T("Start Da"); |
| | | m_vParams.push_back(strText); |
| | | //10.End Da |
| | | strText = _T("End Da"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | // 11.Dx |
| | | strText = _T("Dx(um)"); |
| | | m_vParams.push_back(strText); |
| | | // 12.Dy |
| | | strText = _T("Dy(um)"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | // 13.Result |
| | | strText = _T("Result"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | int nRows = 3; |
| | | int nCols = (int)(m_vParams.size()); |
| | | int nFixRows = 1; |
| | | int nFixCols = 0; |
| | | int nRowIdx = 0; |
| | | int nColIdx = 0; |
| | | |
| | | m_PanelRcut.DeleteAllItems(); |
| | | m_PanelRcut.SetVirtualMode(FALSE); |
| | | m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); |
| | | m_PanelRcut.SetFixedTextColor(_gGridFixFontColor); |
| | | |
| | | m_PanelRcut.SetRowCount(nRows); |
| | | m_PanelRcut.SetColumnCount(nCols); |
| | | m_PanelRcut.SetFixedRowCount(nFixRows); |
| | | m_PanelRcut.SetFixedColumnCount(1); |
| | | m_PanelRcut.SetFixedColumnCount(nFixCols); |
| | | |
| | | CFont *pFont = m_PanelRcut.GetFont(); |
| | | if (pFont) { |
| | | LOGFONT lf; |
| | | pFont->GetLogFont(&lf); |
| | | lf.lfItalic = 0; |
| | | lf.lfHeight = 14; |
| | | lf.lfWeight = FW_BOLD; |
| | | _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); |
| | | |
| | | m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); |
| | | m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); |
| | | m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); |
| | | m_PanelRcut.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); |
| | | } |
| | | |
| | | // Col |
| | | for (int i = 0; i < nCols; i++) { |
| | | if (1 == i) { |
| | | m_PanelRcut.SetColumnWidth(nColIdx, 115); |
| | | } |
| | | else if (0 == i) { |
| | | m_PanelRcut.SetColumnWidth(nColIdx, 50); |
| | | } |
| | | else if (2 == i) { |
| | | m_PanelRcut.SetColumnWidth(nColIdx, 60); |
| | | } |
| | | else { |
| | | m_PanelRcut.SetColumnWidth(nColIdx, 75); |
| | | } |
| | | strText = m_vParams[i]; |
| | | m_PanelRcut.SetItemText(nRowIdx, nColIdx++, strText); |
| | | } |
| | | |
| | | for (int i = 1; i < nRows; i++) { |
| | | m_PanelRcut.GetCell(i, 0)->SetState(GVIS_READONLY); |
| | | } |
| | | } |
| | | |
| | | void CRcutSetDLg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveRcutParam(); |
| | | |
| | | //m_dotRCUT = NULL; |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getCornerRcutProcess(eDir); |
| | | m_dotTop = m_dot->m_dots[0]; |
| | | m_dotBot = m_dot->m_dots[1]; |
| | | |
| | | ShowRcutParam(); |
| | | ShowRcutImage(); |
| | | } |
| | | |
| | | void CRcutSetDLg::SaveRcutParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | UpdateData(TRUE); |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 2; i++) { |
| | | CRcutDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_strName = strText; |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nUse = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //4. Chamfer Size |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nChamferSize = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //5. bin Thres |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nBinThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //6. Chip Range |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nChipRange = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //7. Chip Thres |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nChipThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //8. Smooth |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nEdgeSmooth = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //9.Start Da |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nStartAngle = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //10.End Da |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nEndAngle = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //11. Dx |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nDx = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //12. Dy |
| | | strText = m_PanelRcut.GetItemText(idRow, idx); |
| | | dot->m_nDy = _wtoi(strText); |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | void CRcutSetDLg::ShowRcutParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 2; i++) { |
| | | CRcutDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = dot->m_strName; |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText.Format(_T("%d"), dot->m_nUse); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //4. Chamfer Size |
| | | strText.Format(_T("%d"), dot->m_nChamferSize); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //5. Edge Thres |
| | | strText.Format(_T("%d"), dot->m_nBinThres); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //6. Chip Range |
| | | strText.Format(_T("%d"), dot->m_nChipRange); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //7. Chip Thres |
| | | strText.Format(_T("%d"), dot->m_nChipThres); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //8. Chip Smooth |
| | | strText.Format(_T("%d"), dot->m_nEdgeSmooth); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //9. Start Da |
| | | strText.Format(_T("%d"), dot->m_nStartAngle); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //10. End Da |
| | | strText.Format(_T("%d"), dot->m_nEndAngle); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //11. Dx |
| | | strText.Format(_T("%d"), dot->m_nDx); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //12. Dy |
| | | strText.Format(_T("%d"), dot->m_nDy); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //13. Result |
| | | strText.Format(_T("%d"), (int)(dot->m_nNgInfo.size())); |
| | | m_PanelRcut.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CRcutSetDLg::OnEditroiImageroi() |
| | | { |
| | | // TODO: 卿¤æ·»å å½ä»¤å¤çç¨åºä»£ç |
| | | CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg()); |
| | | if (NULL == pMainDlg) return; |
| | | } |
| | | |
| | | void CRcutSetDLg::ShowRcutImage(void) { |
| | | /* code */ |
| | | if (NULL != m_dotTop) { |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_dotTop->getImage(), width, height); |
| | | |
| | | if (NULL != m_displayTop1 && width > 1 && height > 1) { |
| | | HalconCpp::GenEmptyObj(&m_displayTop1->GetImage()); |
| | | HalconCpp::GenEmptyObj(&m_displayTop1->GetRegion()); |
| | | HalconCpp::GenEmptyObj(&m_displayTop1->GetCross()); |
| | | HalconCpp::GenEmptyObj(&m_displayTop1->GetSelect()); |
| | | |
| | | m_displayTop1->UnableFlush(); |
| | | m_displayTop1->ClearWindow(); |
| | | m_displayTop1->AutoWindowSize(width, height); |
| | | m_displayTop1->SetImage(m_dotTop->getImage()); |
| | | m_displayTop1->SetRegion(m_dotTop->getRoiRegion()); |
| | | m_displayTop1->DispImage(); |
| | | m_displayTop1->DispRegion(); |
| | | m_displayTop1->AbleFlush(); |
| | | } |
| | | else { |
| | | if (NULL != m_displayTop1) { |
| | | m_displayTop1->UnableFlush(); |
| | | m_displayTop1->ClearWindow(); |
| | | m_displayTop1->DispImage(); |
| | | m_displayTop1->DispRegion();; |
| | | m_displayTop1->AbleFlush(); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (NULL != m_displayTop2 && width > 1 && height > 1) { |
| | | HalconCpp::GenEmptyObj(&m_displayTop2->GetImage()); |
| | | HalconCpp::GenEmptyObj(&m_displayTop2->GetRegion()); |
| | | HalconCpp::GenEmptyObj(&m_displayTop2->GetCross()); |
| | | HalconCpp::GenEmptyObj(&m_displayTop2->GetSelect()); |
| | | |
| | | m_displayTop2->UnableFlush(); |
| | | m_displayTop2->ClearWindow(); |
| | | m_displayTop2->AutoWindowSize(width, height); |
| | | m_displayTop2->SetImage(m_dotTop->getImage()); |
| | | m_displayTop2->SetRegion(m_dotTop->getChipRegion()); |
| | | m_displayTop2->DispImage(); |
| | | m_displayTop2->DispRegion(); |
| | | m_displayTop2->AbleFlush(); |
| | | } |
| | | else { |
| | | if (NULL != m_displayTop2) { |
| | | m_displayTop2->UnableFlush(); |
| | | m_displayTop2->ClearWindow(); |
| | | m_displayTop2->DispImage(); |
| | | m_displayTop2->DispRegion();; |
| | | m_displayTop2->AbleFlush(); |
| | | } |
| | | } |
| | | |
| | | |
| | | CString strChamber; |
| | | strChamber.Format(_T("Chamber: (%.0f, %.0f)"), m_dotTop->m_fMinChamber, m_dotTop->m_fMaxChamber); |
| | | GetDlgItem(IDC_STATIC_TOP_CHAMBER_RCUT)->SetWindowText(strChamber); |
| | | } |
| | | |
| | | if (NULL != m_dotBot) { |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_dotBot->getImage(), width, height); |
| | | |
| | | |
| | | if (NULL != m_displayBot1 && width > 1 && height > 1) { |
| | | HalconCpp::GenEmptyObj(&m_displayBot1->GetImage()); |
| | | HalconCpp::GenEmptyObj(&m_displayBot1->GetRegion()); |
| | | HalconCpp::GenEmptyObj(&m_displayBot1->GetCross()); |
| | | HalconCpp::GenEmptyObj(&m_displayBot1->GetSelect()); |
| | | |
| | | m_displayBot1->UnableFlush(); |
| | | m_displayBot1->ClearWindow(); |
| | | m_displayBot1->AutoWindowSize(width, height); |
| | | m_displayBot1->SetImage(m_dotBot->getImage()); |
| | | m_displayBot1->SetRegion(m_dotBot->getRoiRegion()); |
| | | m_displayBot1->DispImage(); |
| | | m_displayBot1->DispRegion(); |
| | | m_displayBot1->AbleFlush(); |
| | | } |
| | | else { |
| | | if (NULL != m_displayBot1) { |
| | | m_displayBot1->UnableFlush(); |
| | | m_displayBot1->ClearWindow(); |
| | | m_displayBot1->DispImage(); |
| | | m_displayBot1->DispRegion();; |
| | | m_displayBot1->AbleFlush(); |
| | | } |
| | | } |
| | | |
| | | if (NULL != m_displayBot2 && width > 1 && height > 1) { |
| | | HalconCpp::GenEmptyObj(&m_displayBot2->GetImage()); |
| | | HalconCpp::GenEmptyObj(&m_displayBot2->GetRegion()); |
| | | HalconCpp::GenEmptyObj(&m_displayBot2->GetCross()); |
| | | HalconCpp::GenEmptyObj(&m_displayBot2->GetSelect()); |
| | | |
| | | m_displayBot2->UnableFlush(); |
| | | m_displayBot2->ClearWindow(); |
| | | m_displayBot2->AutoWindowSize(width, height); |
| | | m_displayBot2->SetImage(m_dotBot->getImage()); |
| | | m_displayBot2->SetRegion(m_dotBot->getChipRegion()); |
| | | m_displayBot2->DispImage(); |
| | | m_displayBot2->DispRegion(); |
| | | m_displayBot2->AbleFlush(); |
| | | } |
| | | else { |
| | | if (NULL != m_displayBot2) { |
| | | m_displayBot2->UnableFlush(); |
| | | m_displayBot2->ClearWindow(); |
| | | m_displayBot2->DispImage(); |
| | | m_displayBot2->DispRegion();; |
| | | m_displayBot2->AbleFlush(); |
| | | } |
| | | } |
| | | |
| | | CString strChamber; |
| | | strChamber.Format(_T("Chamber: (%.0f, %.0f)"), m_dotBot->m_fMinChamber, m_dotBot->m_fMaxChamber); |
| | | GetDlgItem(IDC_STATIC_BOT_CHAMBER_RCUT)->SetWindowText(strChamber); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CRcutSetDLg::OnBnClickedButtonSetImageRcut() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveRcutParam(); |
| | | if (NULL == m_dot) return; |
| | | if (NULL == m_dotTop) return; |
| | | |
| | | //1. åéä¿¡æ¯ |
| | | CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); |
| | | |
| | | //2. è·åä½ç½®ä¿¡æ¯ |
| | | int x1 = 0; |
| | | int y1 = 0; |
| | | int x2 = 0; |
| | | int y2 = 0; |
| | | if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; |
| | | |
| | | m_dotTop->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1); |
| | | |
| | | m_dotTop->TechImage(); |
| | | |
| | | ShowRcutImage(); |
| | | } |
| | | |
| | | |
| | | void CRcutSetDLg::OnBnClickedButtonSaveRcut() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveRcutParam(); |
| | | } |
| | | |
| | | |
| | | void CRcutSetDLg::OnBnClickedButtonSetImageRcut2() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveRcutParam(); |
| | | if (NULL == m_dot) return; |
| | | if (NULL == m_dotBot) return; |
| | | |
| | | //1. åéä¿¡æ¯ |
| | | CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); |
| | | |
| | | //2. è·åä½ç½®ä¿¡æ¯ |
| | | int x1 = 0; |
| | | int y1 = 0; |
| | | int x2 = 0; |
| | | int y2 = 0; |
| | | if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; |
| | | |
| | | m_dotBot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1); |
| | | |
| | | m_dotBot->TechImage(); |
| | | |
| | | ShowRcutImage(); |
| | | |
| | | #if 0 |
| | | int nPosX = (int)(0.5 * (x1 + x2)); |
| | | int nPosY = (int)(0.5 * (y1 + y2)); |
| | | Point2I pose; |
| | | pose.x = nPosX; |
| | | pose.y = nPosY; |
| | | Point2I ptResult, ptTop, ptBot; |
| | | CSoftVisionApp::getInstance()->transformToStandard(m_eDir, pose, ptResult, ptTop, ptBot); |
| | | |
| | | Point2I point = ptBot; |
| | | int width = x2 - x1 + 1; |
| | | int height = y2 - y1 + 1; |
| | | m_dotBot->setRegion(point.x, point.y, width, height); |
| | | m_dotBot->TechImage(); |
| | | |
| | | ShowRcutImage(); |
| | | #endif |
| | | } |
| | | |
| | | |
| | | void CRcutSetDLg::OnBnClickedButtonTopTrain() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveRcutParam(); |
| | | if (NULL == m_dot) return; |
| | | if (NULL == m_dotTop) return; |
| | | |
| | | Point2I offset; |
| | | offset.x = 0; |
| | | offset.y = 0; |
| | | // Log_GetDebug()->TraceInfo("Start Inspect: %d", __LINE__); |
| | | m_dotTop->Execute(m_eDir, offset); |
| | | // Log_GetDebug()->TraceInfo("End Inspect: %d", __LINE__); |
| | | ShowRcutImage(); |
| | | |
| | | DispResult(); |
| | | } |
| | | |
| | | |
| | | void CRcutSetDLg::OnBnClickedButtonTopTrain2() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveRcutParam(); |
| | | |
| | | if (NULL == m_dot) return; |
| | | if (NULL == m_dotBot) return; |
| | | Point2I offset; |
| | | offset.x = 0; |
| | | offset.y = 0; |
| | | |
| | | m_dotBot->Execute(m_eDir, offset); |
| | | |
| | | ShowRcutImage(); |
| | | |
| | | DispResult(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CRcutSetDLg å¯¹è¯æ¡ |
| | | #include "VisionRecipe.h" |
| | | #include "afxwin.h" |
| | | |
| | | #include "CornerRcutProcess.h" |
| | | #include "RcutDotProcess.h" |
| | | #include "afxcmn.h" |
| | | |
| | | class CRcutSetDLg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CRcutSetDLg) |
| | | |
| | | public: |
| | | CRcutSetDLg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CRcutSetDLg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_RCUT_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | CMenu m_visionMenu; |
| | | IClsDisplay *m_displayTop1; |
| | | IClsDisplay *m_displayTop2; |
| | | |
| | | IClsDisplay *m_displayBot1; |
| | | IClsDisplay *m_displayBot2; |
| | | |
| | | CGridCtrl m_PanelRcut; |
| | | CCornerRcutProcess *m_dot; |
| | | CRcutDotProcess *m_dotTop; |
| | | CRcutDotProcess *m_dotBot; |
| | | |
| | | std::vector<CString> m_vParams; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | void InitDisplay(void); |
| | | |
| | | //2. åå§åèå |
| | | void InitMenu(void); |
| | | |
| | | //3. åå§å |
| | | void InitPanel(void); |
| | | |
| | | //4. //ä¿åæ°æ® |
| | | void SaveRcutParam(void); |
| | | |
| | | //6. æ¾ç¤ºåæ° |
| | | void ShowRcutParam(void); |
| | | |
| | | //7. æ¾ç¤ºç»é¢ |
| | | void ShowRcutImage(void); |
| | | |
| | | //8. æ¾ç¤ºç»æ |
| | | void DispResult(void); |
| | | |
| | | //4. æ¾ç¤ºåºå |
| | | void DispAllResult(void); |
| | | |
| | | public: |
| | | afx_msg void OnClose(); |
| | | int setDimensionDir(DimensionDir eDir); |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnBnClickedButtonProcessRcut(); |
| | | afx_msg void OnEditroiImageroi(); |
| | | afx_msg void OnBnClickedButtonSetImageRcut();; |
| | | afx_msg void OnBnClickedButtonSaveRcut(); |
| | | afx_msg void OnBnClickedButtonSetImageRcut2(); |
| | | afx_msg void OnBnClickedButtonTopTrain(); |
| | | afx_msg void OnBnClickedButtonTopTrain2(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ScanSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "ScanSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "TranformCoordinate.h" |
| | | |
| | | |
| | | // CScanSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CScanSetDlg, CDialogEx) |
| | | |
| | | CScanSetDlg::CScanSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_SCAN_SET, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CScanSetDlg::~CScanSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CScanSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_COMBO_STD_POINT_SCAN, m_combStdPoint); |
| | | DDX_Control(pDX, IDC_COMBO_POINT1_SCAN, m_combScanPoint1); |
| | | DDX_Control(pDX, IDC_COMBO_POINT2_SCAN, m_combScanPoint2); |
| | | DDX_Control(pDX, IDC_COMBO_POINT3_SCAN, m_combScanPoint3); |
| | | DDX_Control(pDX, IDC_COMBO_POINT4_SCAN, m_combScanPoint4); |
| | | DDX_Control(pDX, IDC_COMBO_LENTH_SCAN, m_combLengthScan); |
| | | DDX_Control(pDX, IDC_COMBO_SHORT_SCAN, m_combShortScan); |
| | | DDX_Control(pDX, IDC_COMBO1, m_combScanEdge); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CScanSetDlg, CDialogEx) |
| | | ON_BN_CLICKED(IDC_BUTTON_CANCEL_SCAN, &CScanSetDlg::OnBnClickedButtonCancelScan) |
| | | ON_BN_CLICKED(IDC_BUTTON_SAVE_SCAN, &CScanSetDlg::OnBnClickedButtonSaveScan) |
| | | ON_WM_CLOSE() |
| | | ON_BN_CLICKED(IDC_BUTTON_TEST_SCAN, &CScanSetDlg::OnBnClickedButtonTestScan) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CScanSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CScanSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | BOOL CScanSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitWindowUi(); |
| | | |
| | | SetParamsUi(); |
| | | |
| | | this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CScanSetDlg::InitWindowUi(void) { |
| | | /* code */ |
| | | m_combStdPoint.InsertString(0, _T("C1")); |
| | | m_combStdPoint.InsertString(1, _T("C2")); |
| | | m_combStdPoint.InsertString(2, _T("C3")); |
| | | m_combStdPoint.InsertString(3, _T("C4")); |
| | | |
| | | m_combScanPoint1.InsertString(0, _T("C1")); |
| | | m_combScanPoint1.InsertString(1, _T("C2")); |
| | | m_combScanPoint1.InsertString(2, _T("C3")); |
| | | m_combScanPoint1.InsertString(3, _T("C4")); |
| | | |
| | | m_combScanPoint2.InsertString(0, _T("C1")); |
| | | m_combScanPoint2.InsertString(1, _T("C2")); |
| | | m_combScanPoint2.InsertString(2, _T("C3")); |
| | | m_combScanPoint2.InsertString(3, _T("C4")); |
| | | |
| | | m_combScanPoint3.InsertString(0, _T("C1")); |
| | | m_combScanPoint3.InsertString(1, _T("C2")); |
| | | m_combScanPoint3.InsertString(2, _T("C3")); |
| | | m_combScanPoint3.InsertString(3, _T("C4")); |
| | | |
| | | m_combScanPoint4.InsertString(0, _T("C1")); |
| | | m_combScanPoint4.InsertString(1, _T("C2")); |
| | | m_combScanPoint4.InsertString(2, _T("C3")); |
| | | m_combScanPoint4.InsertString(3, _T("C4")); |
| | | |
| | | m_combLengthScan.InsertString(0, _T("Move Left")); |
| | | m_combLengthScan.InsertString(1, _T("Move Right")); |
| | | |
| | | m_combShortScan.InsertString(0, _T("Move Down")); |
| | | m_combShortScan.InsertString(1, _T("Move Up")); |
| | | |
| | | m_combScanEdge.InsertString(0, _T("TopA")); |
| | | m_combScanEdge.InsertString(1, _T("TopB")); |
| | | m_combScanEdge.InsertString(2, _T("TopC")); |
| | | m_combScanEdge.InsertString(3, _T("TopD")); |
| | | m_combScanEdge.InsertString(4, _T("BotA")); |
| | | m_combScanEdge.InsertString(5, _T("BotB")); |
| | | m_combScanEdge.InsertString(6, _T("BotC")); |
| | | m_combScanEdge.InsertString(7, _T("BotD")); |
| | | m_combScanEdge.SetCurSel(1); |
| | | SetDlgItemInt(IDC_EDIT_POSX_SCAN, 100); |
| | | SetDlgItemInt(IDC_EDIT_POSY_SCAN, 50); |
| | | } |
| | | |
| | | void CScanSetDlg::SetParamsUi(void) { |
| | | /* code */ |
| | | ScanSetting inf = CVisionRecipe::getInstance()->getScanSetting(); |
| | | |
| | | m_combStdPoint.SetCurSel(inf.nStdIndex); |
| | | m_combScanPoint1.SetCurSel(inf.nIndex0); |
| | | m_combScanPoint2.SetCurSel(inf.nIndex1); |
| | | m_combScanPoint3.SetCurSel(inf.nIndex2); |
| | | m_combScanPoint4.SetCurSel(inf.nIndex3); |
| | | m_combLengthScan.SetCurSel(inf.nLengthScan); |
| | | m_combShortScan.SetCurSel(inf.nShortScan); |
| | | SetDlgItemInt(IDC_EDIT_LENGTH_PRODUCT, inf.lengthSize); |
| | | SetDlgItemInt(IDC_EDIT_SHORT_PRODUCT, inf.shortSize); |
| | | } |
| | | |
| | | |
| | | void CScanSetDlg::OnBnClickedButtonCancelScan() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SetParamsUi(); |
| | | } |
| | | |
| | | void CScanSetDlg::SaveParams(void) { |
| | | /* code */ |
| | | ScanSetting inf; |
| | | inf.nStdIndex = m_combStdPoint.GetCurSel(); |
| | | inf.nIndex0 = m_combScanPoint1.GetCurSel(); |
| | | inf.nIndex1 = m_combScanPoint2.GetCurSel(); |
| | | inf.nIndex2 = m_combScanPoint3.GetCurSel(); |
| | | inf.nIndex3 = m_combScanPoint4.GetCurSel(); |
| | | inf.nLengthScan = m_combLengthScan.GetCurSel(); |
| | | inf.nShortScan = m_combShortScan.GetCurSel(); |
| | | inf.lengthSize = GetDlgItemInt(IDC_EDIT_LENGTH_PRODUCT); |
| | | inf.shortSize = GetDlgItemInt(IDC_EDIT_SHORT_PRODUCT); |
| | | CVisionRecipe::getInstance()->setScanSetting(inf); |
| | | } |
| | | |
| | | |
| | | void CScanSetDlg::OnBnClickedButtonSaveScan() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveParams(); |
| | | |
| | | CVisionRecipe::getInstance()->saveVisionConfig(); |
| | | } |
| | | |
| | | |
| | | void CScanSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | |
| | | void CScanSetDlg::OnBnClickedButtonTestScan() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveParams(); |
| | | Point2I pose; |
| | | pose.x = GetDlgItemInt(IDC_EDIT_POSX_SCAN); |
| | | pose.y = GetDlgItemInt(IDC_EDIT_POSY_SCAN); |
| | | CTranformCoordinate tf; |
| | | Point2I result = tf.tfPose((DimensionDir)m_combScanEdge.GetCurSel(), pose); |
| | | Log_GetDebug()->TraceInfo("Result %d: (%d, %d), %d", m_combScanEdge.GetCurSel(), result.x, result.y, __LINE__); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxwin.h" |
| | | |
| | | |
| | | // CScanSetDlg å¯¹è¯æ¡ |
| | | |
| | | class CScanSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CScanSetDlg) |
| | | |
| | | public: |
| | | CScanSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CScanSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_SCAN_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | CComboBox m_combStdPoint; |
| | | CComboBox m_combScanPoint1; |
| | | CComboBox m_combScanPoint2; |
| | | CComboBox m_combScanPoint3; |
| | | CComboBox m_combScanPoint4; |
| | | CComboBox m_combLengthScan; |
| | | CComboBox m_combShortScan; |
| | | |
| | | |
| | | CComboBox m_combScanEdge; |
| | | |
| | | private: |
| | | //1. åå§åçªä½ |
| | | void InitWindowUi(void); |
| | | |
| | | //2. è®¾ç½®åæ° |
| | | void SetParamsUi(void); |
| | | |
| | | //3. ä¿ååæ° |
| | | void SaveParams(void); |
| | | |
| | | public: |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | virtual BOOL OnInitDialog(); |
| | | |
| | | afx_msg void OnBnClickedButtonCancelScan(); |
| | | afx_msg void OnBnClickedButtonSaveScan(); |
| | | afx_msg void OnClose(); |
| | | afx_msg void OnBnClickedButtonTestScan(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ThresSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "ThresSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | |
| | | // CThresSetDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CThresSetDlg, CDialogEx) |
| | | |
| | | CThresSetDlg::CThresSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_THRES_SET, pParent) |
| | | { |
| | | m_dot = NULL; |
| | | m_eDir = DIMENSION_NONE; |
| | | } |
| | | |
| | | CThresSetDlg::~CThresSetDlg() |
| | | { |
| | | } |
| | | |
| | | void CThresSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | |
| | | DDX_Control(pDX, IDC_PANEL_THRES_INFO, m_PanelThres); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CThresSetDlg, CDialogEx) |
| | | ON_WM_DESTROY() |
| | | ON_BN_CLICKED(IDC_BUTTON_THRES_SAVE, &CThresSetDlg::OnBnClickedButtonThresSave) |
| | | ON_BN_CLICKED(IDC_BUTTON_THRES_ROI_SET, &CThresSetDlg::OnBnClickedButtonThresRoiSet) |
| | | ON_BN_CLICKED(IDC_BUTTON_THRES_PROCESS, &CThresSetDlg::OnBnClickedButtonThresProcess) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CThresSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CThresSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitPanel(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | BOOL CThresSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | void CThresSetDlg::OnDestroy() |
| | | { |
| | | CDialogEx::OnDestroy(); |
| | | |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | int CThresSetDlg::setDimensionDir(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionType(eDir); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CThresSetDlg::InitPanel(void) { |
| | | /* code */ |
| | | m_vParams.clear(); |
| | | |
| | | CString strText; |
| | | //1. ID |
| | | strText = _T("ID."); |
| | | m_vParams.push_back(strText); |
| | | //2. Name |
| | | strText = _T("Name"); |
| | | m_vParams.push_back(strText); |
| | | //3. use |
| | | strText = _T("use"); |
| | | m_vParams.push_back(strText); |
| | | //4. use |
| | | strText = _T("Pos type"); |
| | | m_vParams.push_back(strText); |
| | | //5. Min Thres |
| | | strText = _T("Min Thres"); |
| | | m_vParams.push_back(strText); |
| | | //6. Max Thres |
| | | strText = _T("Max Thres"); |
| | | m_vParams.push_back(strText); |
| | | //7. Max Thres |
| | | strText = _T("Smooth"); |
| | | m_vParams.push_back(strText); |
| | | //8. Pos X |
| | | strText = _T("X Size(um)"); |
| | | m_vParams.push_back(strText); |
| | | //9. Pos Y |
| | | strText = _T("Y Size(um)"); |
| | | m_vParams.push_back(strText); |
| | | //10.Result |
| | | strText = _T("Result"); |
| | | m_vParams.push_back(strText); |
| | | |
| | | int nRows = 13; |
| | | int nCols = (int)(m_vParams.size()); |
| | | int nFixRows = 1; |
| | | int nFixCols = 0; |
| | | int nRowIdx = 0; |
| | | int nColIdx = 0; |
| | | |
| | | m_PanelThres.DeleteAllItems(); |
| | | m_PanelThres.SetVirtualMode(FALSE); |
| | | m_PanelThres.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelThres.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); |
| | | m_PanelThres.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); |
| | | m_PanelThres.SetFixedTextColor(_gGridFixFontColor); |
| | | |
| | | m_PanelThres.SetRowCount(nRows); |
| | | m_PanelThres.SetColumnCount(nCols); |
| | | m_PanelThres.SetFixedRowCount(nFixRows); |
| | | m_PanelThres.SetFixedColumnCount(nFixCols); |
| | | |
| | | CFont *pFont = m_PanelThres.GetFont(); |
| | | if (pFont) { |
| | | LOGFONT lf; |
| | | pFont->GetLogFont(&lf); |
| | | lf.lfItalic = 0; |
| | | lf.lfHeight = 14; |
| | | lf.lfWeight = FW_BOLD; |
| | | _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); |
| | | |
| | | m_PanelThres.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); |
| | | m_PanelThres.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); |
| | | m_PanelThres.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); |
| | | m_PanelThres.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); |
| | | } |
| | | |
| | | // Col |
| | | for (int i = 0; i < nCols; i++) { |
| | | if (1 == i) { |
| | | m_PanelThres.SetColumnWidth(nColIdx, 115); |
| | | } |
| | | else { |
| | | m_PanelThres.SetColumnWidth(nColIdx, 75); |
| | | } |
| | | strText = m_vParams[i]; |
| | | m_PanelThres.SetItemText(nRowIdx, nColIdx++, strText); |
| | | } |
| | | |
| | | for (int i = 1; i < nRows; i++) { |
| | | m_PanelThres.GetCell(i, 0)->SetState(GVIS_READONLY); |
| | | } |
| | | } |
| | | |
| | | void CThresSetDlg::ChangeVisionType(DimensionDir eDir) { |
| | | /* code */ |
| | | SaveThresParam(); |
| | | |
| | | m_eDir = eDir; |
| | | m_dot = CVisionRecipe::getInstance()->getThresProcess(eDir); |
| | | |
| | | ShowThresParam(); |
| | | } |
| | | |
| | | void CThresSetDlg::ShowThresParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 12; i++) { |
| | | CThresDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText.Format(_T("%d"), dot->getID()); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = dot->m_strName; |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //3. USE |
| | | strText.Format(_T("%d"), dot->m_nUse); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //4. pose type |
| | | strText.Format(_T("%d"), dot->m_poseType); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //5. Min Thres |
| | | strText.Format(_T("%d"), dot->m_minThres); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //6. Max Thres |
| | | strText.Format(_T("%d"), dot->m_maxThres); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //7. smooth |
| | | strText.Format(_T("%d"), dot->m_nSmoothSize); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //8. Min SizeX |
| | | strText.Format(_T("%d"), dot->m_minSizeX); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //9. Min SizeY |
| | | strText.Format(_T("%d"), dot->m_minSizeY); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | |
| | | //10. Result |
| | | strText.Format(_T("%.1f"), (int)(dot->m_nNgInfo.size())); |
| | | m_PanelThres.SetItemText(idRow, idx, strText); |
| | | idx += 1; |
| | | } |
| | | |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | void CThresSetDlg::SaveThresParam(void) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == m_eDir) return; |
| | | if (NULL == m_dot) return; |
| | | |
| | | CString strText; |
| | | for (int i = 0; i < 12; i++) { |
| | | CThresDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | //1. ID |
| | | int idRow = dot->getID(); |
| | | int idx = 0; |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | idx += 1; |
| | | |
| | | //2. Name |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_strName = strText; |
| | | idx += 1; |
| | | |
| | | //3. Use |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_nUse = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //4. pose type |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_poseType = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //5.Min Thres |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_minThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //6. Max Thres |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_maxThres = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //7.smooth |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_nSmoothSize = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //8. Min SizeX |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_minSizeX = _wtoi(strText); |
| | | idx += 1; |
| | | |
| | | //9. Max SizeX |
| | | strText = m_PanelThres.GetItemText(idRow, idx); |
| | | dot->m_minSizeY = _wtoi(strText); |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | void CThresSetDlg::OnBnClickedButtonThresSave() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | SaveThresParam(); |
| | | } |
| | | |
| | | |
| | | void CThresSetDlg::OnBnClickedButtonThresRoiSet() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | if (NULL == m_dot) return; |
| | | |
| | | CCellID selCell = m_PanelThres.GetFocusCell(); |
| | | int id = selCell.row; |
| | | if (id < 1) return; |
| | | |
| | | CThresDotProcess *dot = m_dot->m_dots[id - 1]; |
| | | if (nullptr == dot) return; |
| | | |
| | | //1. åéä¿¡æ¯ |
| | | CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); |
| | | |
| | | //2. è·åä½ç½®ä¿¡æ¯ |
| | | int x1 = 0; |
| | | int y1 = 0; |
| | | int x2 = 0; |
| | | int y2 = 0; |
| | | if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; |
| | | |
| | | dot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1); |
| | | } |
| | | |
| | | |
| | | void CThresSetDlg::OnBnClickedButtonThresProcess() |
| | | { |
| | | // TODO: 卿¤æ·»å æ§ä»¶éç¥å¤çç¨åºä»£ç |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { |
| | | pSideData->m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | SaveThresParam(); |
| | | if (nullptr == m_dot) return; |
| | | |
| | | m_dot->execute(m_eDir); |
| | | |
| | | DispResult(); |
| | | } |
| | | |
| | | void CThresSetDlg::DispResult(void) { |
| | | /* code */ |
| | | CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); |
| | | |
| | | DispAllResult(); |
| | | } |
| | | |
| | | void CThresSetDlg::DispAllResult(void) { |
| | | /* code */ |
| | | int nCount = 12; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CThresDotProcess *dot = m_dot->m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | bool isDo = true; |
| | | if (1 != dot->m_nUse) isDo = false; |
| | | if (!isDo) { |
| | | int id = dot->getID(); |
| | | m_PanelThres.SetItemText(id, 9, _T("NAN")); |
| | | } |
| | | else { //æ¾ç¤ºç»æ |
| | | CString strResult; |
| | | strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size()); |
| | | int id = dot->getID(); |
| | | m_PanelThres.SetItemText(id, 9, strResult); |
| | | } |
| | | } |
| | | |
| | | m_PanelThres.Invalidate(FALSE); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CThresSetDlg å¯¹è¯æ¡ |
| | | #include "ThresProcess.h" |
| | | |
| | | class CThresSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CThresSetDlg) |
| | | |
| | | public: |
| | | CThresSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CThresSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_THRES_SET }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | afx_msg void OnDestroy(); |
| | | |
| | | int setDimensionDir(DimensionDir eDir); |
| | | void ChangeVisionType(DimensionDir eDir); |
| | | |
| | | private: |
| | | CGridCtrl m_PanelThres; |
| | | std::vector<CString> m_vParams; |
| | | CThresProcess *m_dot; |
| | | DimensionDir m_eDir; |
| | | |
| | | private: |
| | | //1. åå§åPanel |
| | | void InitPanel(void); |
| | | |
| | | //2. ä¿åæ°æ® |
| | | void SaveThresParam(void); |
| | | |
| | | //3. æ¾ç¤ºæ°æ® |
| | | void ShowThresParam(void); |
| | | |
| | | //4. æ¾ç¤ºç»æ |
| | | void DispResult(void); |
| | | |
| | | //5. æ¾ç¤ºææçç»æ |
| | | void DispAllResult(void); |
| | | |
| | | public: |
| | | afx_msg void OnBnClickedButtonThresSave(); |
| | | afx_msg void OnBnClickedButtonThresRoiSet(); |
| | | afx_msg void OnBnClickedButtonThresProcess(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // VisionSetDlg.cpp : å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "BlVisionPro.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "CornerDistSetDlg.h" |
| | | #include "RcutSetDLg.h" |
| | | #include "ScanSetDlg.h" |
| | | #include "KeyVisionSetDlg.h" |
| | | #include "LocSetDlg.h" |
| | | #include "CutSetDlg.h" |
| | | #include "KDistSetDlg.h" |
| | | #include <WinUser.h> |
| | | #include "GrindSetDlg.h" |
| | | #include "LockSetDlg.h" |
| | | #include "ChipInspectDlg.h" |
| | | #include "ThresSetDlg.h" |
| | | #include "HoleSetDlg.h" |
| | | |
| | | // CVisionSetDlg å¯¹è¯æ¡ |
| | | #define BUTTON_WIDTH 100 // æé®ç宽度 |
| | | #define BUTTON_HEIGHT 30 // æé®çé«åº¦ |
| | | #define BUTTON_PADDING 1 // æé®ä¹é´çé´è· |
| | | |
| | | IMPLEMENT_DYNAMIC(CVisionSetDlg, CDialogEx) |
| | | |
| | | CVisionSetDlg::CVisionSetDlg(CWnd* pParent /*=NULL*/) |
| | | : CDialogEx(IDD_DIALOG_VISION_SET, pParent) |
| | | { |
| | | m_pOpRoiDlg = NULL; |
| | | m_drawOperator.isDrawing = false; |
| | | } |
| | | |
| | | CVisionSetDlg::~CVisionSetDlg() |
| | | { |
| | | /* code */ |
| | | int sz = (int)(m_pages.size()); |
| | | for (int i = 0; i < sz; i++) { |
| | | delete m_pages[i]; |
| | | m_pages[i] = nullptr; |
| | | } |
| | | m_pages.clear(); |
| | | |
| | | if (m_pOpRoiDlg != NULL) { |
| | | m_pOpRoiDlg->DestroyWindow(); |
| | | delete m_pOpRoiDlg; |
| | | m_pOpRoiDlg = NULL; |
| | | } |
| | | } |
| | | |
| | | void CVisionSetDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CVisionSetDlg, CDialogEx) |
| | | ON_WM_CLOSE() |
| | | ON_WM_MOVE() |
| | | ON_WM_CTLCOLOR() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CVisionSetDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | void CVisionSetDlg::OnClose() |
| | | { |
| | | // TODO: 卿¤æ·»å æ¶æ¯å¤çç¨åºä»£ç å/æè°ç¨é»è®¤å¼ |
| | | int sz = (int)(m_pages.size()); |
| | | for (int i = 0; i < sz; i++) { |
| | | m_pages[i]->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | CVisionRecipe::getInstance()->setVisionSetOpen(FALSE); |
| | | |
| | | CDialogEx::OnClose(); |
| | | } |
| | | |
| | | void CVisionSetDlg::InitCreateWnd(void) { |
| | | /* code */ |
| | | CStatic *pMainPanel = (CStatic *)GetDlgItem(IDC_STATIC_UI_V); |
| | | |
| | | CVisionRecipe::getInstance()->SetMainDlg(this); |
| | | |
| | | //1. å建LOC |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CLocSetDlg *pDlg = new CLocSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_LOC_SET, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | //2. Grind |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CGrindSetDlg *pDlg = new CGrindSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_GRIND_SET, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | //3. KDist |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CKDistSetDlg *pDlg = new CKDistSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_DIST_SET, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | //4. CCUT |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CCutSetDlg *pDlg = new CCutSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_CUTLINE_SET, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | //5. RCUT |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CRcutSetDLg *pDlg = new CRcutSetDLg(); |
| | | pDlg->Create(IDD_DIALOG_RCUT_SET, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | //6. å建ThresSet |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CThresSetDlg *pDlg = new CThresSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_THRES_SET, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | //7. å建Hole |
| | | { |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CHoleSetDlg* pDlg = new CHoleSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_HOLE_INSPECT, pMainPanel); |
| | | m_pages.push_back((CDialogEx*)(pDlg)); |
| | | pDlg->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | Resize(); |
| | | } |
| | | |
| | | #define PAGE_MARGIN_LEFT 12 |
| | | #define PAGE_MARGIN_TOP 0 |
| | | #define PAGE_MARGIN_RIGHT 12 |
| | | #define PAGE_MARGIN_BOTTOM 12 |
| | | void CVisionSetDlg::Resize(void) { |
| | | /* code */ |
| | | CStatic *pMainPanel = (CStatic *)GetDlgItem(IDC_STATIC_UI_V); |
| | | if (NULL == pMainPanel) return; |
| | | |
| | | CRect rcRect; |
| | | pMainPanel->GetWindowRect(rcRect); |
| | | |
| | | for (auto item : m_pages) { |
| | | if (NULL == item) continue; |
| | | |
| | | item->MoveWindow(rcRect.left + PAGE_MARGIN_LEFT, rcRect.top + PAGE_MARGIN_TOP, |
| | | rcRect.Width() - PAGE_MARGIN_LEFT - PAGE_MARGIN_RIGHT, |
| | | rcRect.Height() - PAGE_MARGIN_TOP - PAGE_MARGIN_BOTTOM); |
| | | } |
| | | } |
| | | |
| | | void CVisionSetDlg::SetButtonsSize(std::vector<CButton*>& buttons) |
| | | { |
| | | for (CButton* pButton : buttons) |
| | | { |
| | | if (pButton) |
| | | { |
| | | CRect rect; |
| | | pButton->GetWindowRect(&rect); |
| | | ScreenToClient(&rect); |
| | | |
| | | pButton->MoveWindow(rect.left, rect.top, BUTTON_WIDTH, BUTTON_HEIGHT); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionSetDlg::UpdateButtonsLayout(std::vector<CButton*>& buttons, const std::vector<bool>& states) |
| | | { |
| | | if (buttons.empty() || states.empty() || buttons.size() != states.size()) return; // ç¡®ä¿æé®æ°ç»é空 |
| | | |
| | | // è·å第ä¸ä¸ªæé®çåå§ä½ç½® |
| | | CRect initialRect; |
| | | buttons[0]->GetWindowRect(&initialRect); |
| | | ScreenToClient(&initialRect); // å°å±å¹åæ 转æ¢ä¸ºå®¢æ·åºåæ |
| | | |
| | | int currentX = initialRect.left; // 以第ä¸ä¸ªæé®çXä½ç½®ä¸ºèµ·ç¹ |
| | | int currentY = initialRect.top; // 以第ä¸ä¸ªæé®çYä½ç½®ä¸ºèµ·ç¹ |
| | | |
| | | // éåæé®ï¼æ ¹æ®ç¶ææ¾ç¤ºæéè |
| | | for (size_t i = 0; i < buttons.size(); ++i) |
| | | { |
| | | CButton* pButton = buttons[i]; |
| | | if (pButton) |
| | | { |
| | | if (states[i]) // å¦æç¶æä¸º trueï¼æ¾ç¤ºæé® |
| | | { |
| | | // æ¾ç¤ºæé®å¹¶è°æ´å®çä½ç½® |
| | | pButton->ShowWindow(SW_SHOW); |
| | | pButton->MoveWindow(currentX, currentY, BUTTON_WIDTH, BUTTON_HEIGHT); |
| | | |
| | | // æ´æ°ä¸ä¸æé®çä½ç½® |
| | | currentX += BUTTON_WIDTH + BUTTON_PADDING; |
| | | } |
| | | else // å¦æç¶æä¸º falseï¼éèæé® |
| | | { |
| | | pButton->ShowWindow(SW_HIDE); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | BOOL CVisionSetDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | InitCreateWnd(); |
| | | |
| | | m_eDir = DIMENSION_NONE; |
| | | m_eVisionType = VISION_NONE; |
| | | ChangeVisionPro(DIMENSION_A, VISION_LOC); |
| | | |
| | | CButton* pMain = (CButton*)GetDlgItem(IDC_RDO_SIDE_A_TOP); |
| | | if (pMain && pMain->GetSafeHwnd()) |
| | | pMain->SetCheck(1); |
| | | |
| | | CButton* pVision = (CButton*)GetDlgItem(IDC_RDO_INSTYPE_LOC); |
| | | if (pVision && pVision->GetSafeHwnd()) |
| | | pVision->SetCheck(1); |
| | | |
| | | // æ·»å æé®ç» |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_LOC)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_GRIND)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_KDIST)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_CUT)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_RCUT)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_THRES)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_HOLE)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_IN_CHAMFER)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_TOP_CORNER)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_BOT_CORNER)); |
| | | |
| | | // 设置ä¸ç»æé®çå¤§å° |
| | | SetButtonsSize(m_buttons); |
| | | |
| | | ShowVisionType(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CVisionSetDlg::ShowVisionType(void) { |
| | | /* code */ |
| | | VisionDisplayInfo inf = CVisionRecipe::getInstance()->getVisionDisplay(); |
| | | if (inf.isGrindDisplay) { |
| | | GetDlgItem(IDC_RDO_INSTYPE_GRIND)->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_RDO_INSTYPE_GRIND)->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | if (inf.isDistDisplay) { |
| | | GetDlgItem(IDC_RDO_INSTYPE_KDIST)->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_RDO_INSTYPE_KDIST)->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | if (inf.isCutDisplay) { |
| | | GetDlgItem(IDC_RDO_INSTYPE_CUT)->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_RDO_INSTYPE_CUT)->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | if (inf.isRcutDisplay) { |
| | | GetDlgItem(IDC_RDO_INSTYPE_RCUT)->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_RDO_INSTYPE_RCUT)->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | if (inf.isThresDisplay) { |
| | | GetDlgItem(IDC_RDO_INSTYPE_THRES)->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_RDO_INSTYPE_THRES)->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | if (inf.isHoleDisplay) { |
| | | GetDlgItem(IDC_RDO_INSTYPE_HOLE)->ShowWindow(SW_SHOW); |
| | | } |
| | | else { |
| | | GetDlgItem(IDC_RDO_INSTYPE_HOLE)->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | /* |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_IN_CHAMFER)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_TOP_CORNER)); |
| | | m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_BOT_CORNER));*/ |
| | | |
| | | std::vector<bool> states; |
| | | states.push_back(true); |
| | | states.push_back(inf.isGrindDisplay); |
| | | states.push_back(inf.isDistDisplay); |
| | | states.push_back(inf.isCutDisplay); |
| | | states.push_back(inf.isRcutDisplay); |
| | | states.push_back(inf.isThresDisplay); |
| | | states.push_back(inf.isHoleDisplay); |
| | | states.push_back(false); |
| | | states.push_back(false); |
| | | states.push_back(false); |
| | | UpdateButtonsLayout(m_buttons, states); |
| | | } |
| | | |
| | | void CVisionSetDlg::OnMove(int x, int y) |
| | | { |
| | | CDialogEx::OnMove(x, y); |
| | | |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | Resize(); |
| | | } |
| | | |
| | | void CVisionSetDlg::ChangeDimension(DimensionDir eDir) { |
| | | /* code */ |
| | | ChangeVisionPro(eDir, m_eVisionType); |
| | | } |
| | | |
| | | void CVisionSetDlg::ChangeVisionPro(DimensionDir eDir, VISION_TYPE eVision) { |
| | | /* code */ |
| | | ChangeImage(eDir); |
| | | |
| | | ChangeVisionType(eVision); |
| | | } |
| | | |
| | | void CVisionSetDlg::ChangeImage(DimensionDir eDir) { |
| | | /* code */ |
| | | if (eDir == m_eDir) { |
| | | return; |
| | | } |
| | | |
| | | m_eDir = eDir; |
| | | } |
| | | |
| | | void CVisionSetDlg::ChangeVisionType(VISION_TYPE eVision) { |
| | | /* code */ |
| | | int sz = (int)(m_pages.size()); |
| | | if (sz < 1) return; |
| | | for (int i = 0; i < sz; i++) { |
| | | m_pages[i]->ShowWindow(SW_HIDE); |
| | | } |
| | | |
| | | |
| | | m_eVisionType = eVision; |
| | | switch (eVision) { |
| | | case VISION_LOC: { |
| | | CLocSetDlg *pDlg = (CLocSetDlg *)(m_pages[0]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_GRIND: { |
| | | CGrindSetDlg *pDlg = (CGrindSetDlg *)(m_pages[1]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_KDIST: { |
| | | CKDistSetDlg *pDlg = (CKDistSetDlg *)(m_pages[2]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_CUT: { |
| | | CCutSetDlg *pDlg = (CCutSetDlg *)(m_pages[3]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_RCUT: { |
| | | CRcutSetDLg *pDlg = (CRcutSetDLg *)(m_pages[4]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_THRES: { |
| | | CThresSetDlg* pDlg = (CThresSetDlg *)(m_pages[5]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_HOLE: { |
| | | CHoleSetDlg* pDlg = (CHoleSetDlg *)(m_pages[6]); |
| | | pDlg->setDimensionDir(m_eDir); |
| | | pDlg->ShowWindow(SW_SHOW); |
| | | break; |
| | | } |
| | | |
| | | case VISION_NONE: |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | HBRUSH CVisionSetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | | HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor); |
| | | |
| | | // TODO: 卿¤æ´æ¹ DC çä»»ä½ç¹æ§ |
| | | |
| | | // TODO: 妿é»è®¤ç䏿¯æéç»ç¬ï¼åè¿åå¦ä¸ä¸ªç»ç¬ |
| | | return hbr; |
| | | } |
| | | BEGIN_EVENTSINK_MAP(CVisionSetDlg, CDialogEx) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_LOC, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeLoc, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_RCUT, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeRcut, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_SCAN_SET, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionScanSet, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_KEY_SET, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionKeySet, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_OP_ROI, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionOpRoi, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_CUT, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeCut, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_KDIST, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeKdist, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_GRIND, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeGrind, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_THRES, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeThres, VTS_NONE) |
| | | ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_HOLE, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeHole, VTS_NONE) |
| | | END_EVENTSINK_MAP() |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeLoc() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | /* code */ |
| | | ChangeVisionPro(m_eDir, VISION_LOC); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeRcut() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | ChangeVisionPro(m_eDir, VISION_RCUT); |
| | | } |
| | | |
| | | void CVisionSetDlg::ClickButtonVisionScanSet() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | CScanSetDlg dlg; |
| | | dlg.DoModal(); |
| | | |
| | | ShowVisionType(); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickButtonVisionKeySet() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | CKeyVisionSetDlg dlg; |
| | | dlg.DoModal(); |
| | | |
| | | ShowVisionType(); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickButtonVisionOpRoi() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | //if (m_pOpRoiDlg == NULL) { |
| | | // m_pOpRoiDlg = new COpRoiDlg(this); |
| | | // m_pOpRoiDlg->Create(IDD_DIALOG_ROI_SET, this); |
| | | // m_pOpRoiDlg->ShowWindow(SW_SHOW); |
| | | //} |
| | | //else { |
| | | // m_pOpRoiDlg->ShowWindow(SW_SHOW); |
| | | //} |
| | | CLockSetDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeCut() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | ChangeVisionPro(m_eDir, VISION_CUT); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeKdist() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | ChangeVisionPro(m_eDir, VISION_KDIST); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeGrind() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | ChangeVisionPro(m_eDir, VISION_GRIND); |
| | | } |
| | | |
| | | |
| | | BOOL CVisionSetDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | // TODO: 卿¤æ·»å ä¸ç¨ä»£ç å/æè°ç¨åºç±» |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeThres() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | ChangeVisionPro(m_eDir, VISION_THRES); |
| | | } |
| | | |
| | | |
| | | void CVisionSetDlg::ClickRdoInstypeHole() |
| | | { |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | ChangeVisionPro(m_eDir, VISION_HOLE); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxwin.h" |
| | | #include "EiVisionType.h" |
| | | |
| | | // CVisionSetDlg å¯¹è¯æ¡ |
| | | #include "VisionRecipe.h" |
| | | #include "OpRoiDlg.h" |
| | | |
| | | class CVisionSetDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CVisionSetDlg) |
| | | |
| | | typedef struct _DrawOperator { |
| | | DimensionDir eDir; //ģʽ |
| | | VISION_TYPE eVisionType; //ç®æ³ç±»å |
| | | int nID; //ID |
| | | int nType; //ç±»å |
| | | bool isDrawing; //æ¯å¦ |
| | | }DrawOperator; |
| | | |
| | | public: |
| | | CVisionSetDlg(CWnd* pParent = NULL); // æ åæé 彿° |
| | | virtual ~CVisionSetDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { |
| | | IDD = IDD_DIALOG_VISION_SET |
| | | }; |
| | | #endif |
| | | |
| | | private: |
| | | std::vector<CDialogEx*> m_pages; |
| | | DimensionDir m_eDir; |
| | | VISION_TYPE m_eVisionType; |
| | | DrawOperator m_drawOperator; |
| | | COpRoiDlg *m_pOpRoiDlg; |
| | | CMenu m_visionMenu; |
| | | std::vector<CButton*> m_buttons; |
| | | |
| | | private: |
| | | //2. åå§åçªä½ |
| | | void InitCreateWnd(void); |
| | | |
| | | //3. ä½ç½®ç§»å¨ |
| | | void Resize(void); |
| | | |
| | | //4. 设置æé®å¤§å° |
| | | void SetButtonsSize(std::vector<CButton*>& buttons); |
| | | |
| | | //5. 设置æé®ä½ç½® |
| | | void UpdateButtonsLayout(std::vector<CButton*>& buttons, const std::vector<bool>& states); |
| | | |
| | | //6. å·æ°å¾å |
| | | void ChangeImage(DimensionDir eDir); |
| | | |
| | | //7. å¾åç®æ³ |
| | | void ChangeVisionType(VISION_TYPE eVision); |
| | | |
| | | //8. æ¹åè§è§å¤ç |
| | | void ChangeVisionPro(DimensionDir eDir, VISION_TYPE eVision); |
| | | |
| | | //9. æ¾ç¤ºç®æ³ç±»å |
| | | void ShowVisionType(void); |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | public: |
| | | void ChangeDimension(DimensionDir eDir); |
| | | |
| | | |
| | | |
| | | public: |
| | | afx_msg void OnClose(); |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnMove(int x, int y); |
| | | |
| | | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); |
| | | DECLARE_EVENTSINK_MAP() |
| | | void ClickRdoInstypeLoc(); |
| | | void ClickRdoInstypeRcut(); |
| | | void ClickButtonVisionScanSet(); |
| | | void ClickButtonVisionKeySet(); |
| | | void ClickButtonVisionOpRoi(); |
| | | void ClickRdoInstypeCut(); |
| | | void ClickRdoInstypeKdist(); |
| | | void ClickRdoInstypeGrind(); |
| | | virtual BOOL PreTranslateMessage(MSG* pMsg); |
| | | void ClickRdoInstypeThres(); |
| | | void ClickRdoInstypeHole(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "BlSideData.h" |
| | | |
| | | CBlSideData::CBlSideData() |
| | | { |
| | | m_dPixelSizeX = 0.0f; |
| | | m_dPixelSizeY = 0.0f; |
| | | m_bBotMark_Find = FALSE; |
| | | m_bTopMark_Find = FALSE; |
| | | m_mTopMark.x = 0; |
| | | m_mTopMark.y = 0; |
| | | m_mBotMark.x = 0; |
| | | m_mBotMark.y = 0; |
| | | |
| | | m_bTopPoint_Find = FALSE; |
| | | m_mTopPoint.x = 0; |
| | | m_mTopPoint.y = 0; |
| | | m_bBotPoint_Find = FALSE; |
| | | m_mBotPoint.x = 0; |
| | | m_mBotPoint.y = 0; |
| | | |
| | | m_mapSideLineInf.clear(); |
| | | m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | CBlSideData::~CBlSideData() |
| | | { |
| | | m_mapSideLineInf.clear(); |
| | | m_vDispVisionResult.clear(); |
| | | } |
| | | |
| | | void CBlSideData::Reset(void) { |
| | | /* code */ |
| | | m_bInspection_Complete = FALSE; |
| | | m_bBotMark_Find = FALSE; |
| | | m_bTopMark_Find = FALSE; |
| | | m_mTopMark.x = 0; |
| | | m_mTopMark.y = 0; |
| | | m_mBotMark.x = 0; |
| | | m_mBotMark.y = 0; |
| | | } |
| | | |
| | | Point2I CBlSideData::getPose(int nType) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | |
| | | if (0 == nType) { |
| | | if (m_bTopMark_Find) { |
| | | result = m_mTopMark; |
| | | } |
| | | } |
| | | else if (1 == nType) { |
| | | if (m_bBotMark_Find) { |
| | | result = m_mBotMark; |
| | | } |
| | | } |
| | | else if (2 == nType) { |
| | | if (m_bTopPoint_Find) { |
| | | result = m_mTopPoint; |
| | | } |
| | | } |
| | | else if (3 == nType) { |
| | | if (m_bBotPoint_Find) { |
| | | result = m_mBotPoint; |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "BlVisionLib.h" |
| | | #include "VisionRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | #define BLVISION_VERSION _T("1.0.1.1") |
| | | int BlVision_GetVersion(char *pszVersion, int nBufferSize) { |
| | | /* code */ |
| | | // å°ANSIå符串转æ¢ä¸ºå®½å符串 |
| | | CString cStr = BLVISION_VERSION; |
| | | // è·åCStringé¿åº¦ï¼ä»¥å符为åä½ï¼ |
| | | int len = cStr.GetLength(); |
| | | |
| | | // 使ç¨CW2Aå®è¿è¡å®½å符å°å¤åèå符éçè½¬æ¢ |
| | | // CW2Aé»è®¤ä½¿ç¨å½åç³»ç»çANSI代ç 页è¿è¡è½¬æ¢ |
| | | CW2A pszConvertedAnsiString(cStr); |
| | | |
| | | // 使ç¨strncpyç¡®ä¿ä¸ä¼è¶
åºcharArrayçå¤§å° |
| | | // -1 ç¡®ä¿å符串æ«å°¾æç©ºå符 |
| | | strncpy_s(pszVersion, nBufferSize, pszConvertedAnsiString, _TRUNCATE); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | IVisionRecipe* BlVision_GetVisionRecipe(void) { |
| | | /* code */ |
| | | CVisionRecipe *pRecipe = CVisionRecipe::getInstance(); |
| | | return pRecipe; |
| | | } |
| | | |
| | | ISoftVisionApp* BlVision_GetSoftVisionApp(void) { |
| | | /* code */ |
| | | CSoftVisionApp *pApp = CSoftVisionApp::getInstance(); |
| | | return pApp; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "Bspline.h" |
| | | |
| | | |
| | | CBspline::CBspline() { |
| | | /* code */ |
| | | |
| | | } |
| | | |
| | | CBspline::CBspline(std::vector<vec>pt) { |
| | | /* code */ |
| | | int num = (int)(pt.size()); |
| | | m_nPoints = num - 1; |
| | | |
| | | if (num < 4) { |
| | | m_nNumber = num - 1; |
| | | } |
| | | else { |
| | | m_nNumber = 3; |
| | | } |
| | | |
| | | m_vControlpoint.resize(num); |
| | | memcpy(&m_vControlpoint[0], &pt[0], num * sizeof(vec)); |
| | | m_uData.resize(m_nPoints + m_nNumber + 2); |
| | | } |
| | | |
| | | CBspline::~CBspline(void) { |
| | | /* code */ |
| | | } |
| | | |
| | | void CBspline::execute(void) { |
| | | /* code */ |
| | | m_vPtResults.clear(); |
| | | getNode(); |
| | | |
| | | std::vector<vec>relevantPoint; |
| | | std::vector<float>relevantU; |
| | | relevantPoint.resize(m_nNumber + 1);//ç¸å
³æ§å¶é¡¶ç¹ |
| | | relevantU.resize(2 * m_nNumber);//ç¸å
³èç¹ç¢é |
| | | |
| | | //ç¸å
³æ§å¶é¡¶ç¹æ·è´ |
| | | float u = 0; |
| | | int i = m_nNumber; //m表示u弿å¨çèç¹,åæ§å¶é¡¶ç¹ä¸ºm_controlpoint[i-k]\m_controlpoint[i] |
| | | float a = 0.0f; |
| | | int m = 0; |
| | | int n = 0; |
| | | int num = 0; |
| | | int sz = (int)(m_nNumber); |
| | | for (int j = 0; j < 500; j++) { |
| | | n = 0; |
| | | m = 0; |
| | | u = (float)(1.0f * j / 500); |
| | | |
| | | if (u > m_uData[i + 1]) { |
| | | i++; |
| | | } |
| | | |
| | | for (m = i - sz; m <= i; m++) { |
| | | relevantPoint[n] = m_vControlpoint[m]; |
| | | n++; |
| | | } |
| | | |
| | | //ç¸å
³èç¹ç¢éæ·è´ |
| | | n = 0; |
| | | for (m = i - sz + 1; m <= i + sz; m++) { |
| | | relevantU[n] = m_uData[m]; |
| | | n++; |
| | | } |
| | | //å¼å§æå¼è®¡ |
| | | num = (int)(relevantPoint.size()); |
| | | for (n = 1; n < num; n++) { |
| | | for (m = 0; m < num - n; m++) { |
| | | a = relevantU[sz + m] - relevantU[m + n - 1]; |
| | | if (fabs(a) < 1e-5) { |
| | | a = 0.0; |
| | | } |
| | | else { |
| | | a = (u - relevantU[m + n - 1]) / a; |
| | | } |
| | | relevantPoint[m] = (1 - a)*relevantPoint[m] + a*relevantPoint[m + 1]; |
| | | } |
| | | } |
| | | m_vPtResults.push_back(relevantPoint[0]); |
| | | } |
| | | } |
| | | |
| | | void CBspline::getNode(void) { |
| | | /* code */ |
| | | int sz = (int)(m_nNumber); |
| | | for (int i = 0; i <= sz; i++) { |
| | | m_uData[i] = 0; |
| | | } |
| | | |
| | | for (int i = 1; i <= sz + 1; i++) { |
| | | m_uData[i + m_nPoints] = 1; |
| | | } |
| | | |
| | | hartley(); |
| | | } |
| | | |
| | | void CBspline::hartley(void) { |
| | | /* code */ |
| | | std::vector<float> vLength(m_nPoints); |
| | | std::vector<float> vData; |
| | | vData.push_back(0.0); |
| | | |
| | | vec fValue; |
| | | int fzNum = (int)(m_nPoints); |
| | | for (int i = 0; i < fzNum; i++) { |
| | | fValue = m_vControlpoint[i + 1] - m_vControlpoint[i]; |
| | | vLength[i] = len(fValue); |
| | | } |
| | | |
| | | float sum = 0.0f; |
| | | float fTemp = 0.0f; |
| | | int num = (int)(vLength.size()); |
| | | int szNum = (int)(m_nNumber); |
| | | for (int i = 0; i <= num - szNum; i++) { |
| | | fTemp = 0; |
| | | for (int j = 0; j < szNum; j++) { |
| | | fTemp += vLength[i + j]; |
| | | } |
| | | sum += fTemp; |
| | | vData.push_back(fTemp); |
| | | } |
| | | |
| | | int count = (int)(vData.size()); |
| | | for (int i = 1; i < count; i++) { |
| | | vData[i] = vData[i - 1] + vData[i]; |
| | | m_uData[i + szNum] = vData[i] / sum; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef BSP_LINE_H |
| | | #define BSP_LINE_H |
| | | |
| | | #include "Vec.h" |
| | | #include <vector> |
| | | |
| | | class CBspline |
| | | { |
| | | public: |
| | | CBspline(); |
| | | CBspline(std::vector<vec>pt); |
| | | virtual ~CBspline(); |
| | | |
| | | |
| | | public: |
| | | //1 æµè¯ |
| | | void execute(void); |
| | | |
| | | std::vector<vec> m_vPtResults; |
| | | private: |
| | | unsigned int m_nNumber;//次æ°ãæ§å¶é¡¶ç¹ä¸ªæ° |
| | | |
| | | unsigned int m_nPoints; //æ§å¶é¡¶ç¹æ° |
| | | std::vector<vec> m_vControlpoint;//æ§å¶é¡¶ç¹ |
| | | std::vector<float> m_uData;//èç¹ç¢é |
| | | |
| | | public: |
| | | void hartley(void); |
| | | |
| | | //1. 计ç®èç¹ç¢é |
| | | void getNode(void); |
| | | }; |
| | | |
| | | #endif |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "ConfigVision.h" |
| | | #include <iostream> |
| | | #include <atlstr.h> // å
å«CString头æä»¶ |
| | | #include <time.h> |
| | | #include <stdarg.h> |
| | | #include <direct.h> |
| | | #include <vector> |
| | | #include <Dbghelp.h> |
| | | #include "FileRecipe.h" |
| | | #pragma comment(lib,"Dbghelp.lib") |
| | | |
| | | CConfigVision::CConfigVision(){ |
| | | /* code */ |
| | | } |
| | | |
| | | CConfigVision::~CConfigVision(){ |
| | | /* code */ |
| | | } |
| | | |
| | | void CConfigVision::SetWorkDir(const char *pszPath, const char *pszName) { |
| | | /* code */ |
| | | std::string filePath = pszPath; |
| | | std::string strName = pszName; |
| | | init(filePath, pszName); |
| | | } |
| | | |
| | | void CConfigVision::init(std::string filePath, std::string strName) { |
| | | /* code */ |
| | | std::string fileName = filePath + "\\" + strName; |
| | | if (!CFileRecipe::fileIsExist(fileName)) { |
| | | MakeSureDirectoryPathExists(fileName.c_str()); |
| | | } |
| | | |
| | | std::string str = fileName + "\\Config.ini"; |
| | | m_strFileName = CA2T(str.c_str()); |
| | | CStdioFile file; |
| | | if (!file.Open(m_strFileName, CFile::modeCreate | CFile::modeReadWrite | CFile::modeNoTruncate)) return; |
| | | file.Close(); |
| | | } |
| | | |
| | | bool CConfigVision::WriteText(const char *pszSection, const char *pszName, const char *pszValue) { |
| | | /* code */ |
| | | CString strSection = CString(pszSection); |
| | | CString strName = CString(pszName); |
| | | CString strValue = CString(pszValue); |
| | | BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName); |
| | | if (!isRes) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | std::string CConfigVision::ReadText(const char *pszSection, const char *pszName, const char *pszDefault) { |
| | | /* code */ |
| | | std::string strRes = pszDefault; |
| | | CString strValue; |
| | | CString strSection = CString(pszSection); |
| | | CString strName = CString(pszName); |
| | | CString strDefault = CString(pszName); |
| | | GetPrivateProfileString(strSection, strName, strDefault, strValue.GetBuffer(MAX_PATH), MAX_PATH, m_strFileName); |
| | | strRes = CT2A(strValue); |
| | | return strRes; |
| | | } |
| | | |
| | | bool CConfigVision::WriteInt(const char *pszSection, const char *pszName, int intValue) { |
| | | /* code */ |
| | | CString strSection = CString(pszSection); |
| | | CString strName = CString(pszName); |
| | | CString strValue; |
| | | strValue.Format(_T("%d"), intValue); |
| | | BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName); |
| | | if (!isRes) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | int CConfigVision::ReadInt(const char *pszSection, const char *pszName, int defaultValue) { |
| | | /* code */ |
| | | int intRes = defaultValue; |
| | | CString strSection = CString(pszSection); |
| | | CString strName = CString(pszName); |
| | | intRes = GetPrivateProfileInt(strSection, strName, defaultValue, m_strFileName); |
| | | return intRes; |
| | | } |
| | | |
| | | bool CConfigVision::WriteBool(const char *pszSection, const char *pszName, int bValue) { |
| | | /* code */ |
| | | int iValue = 0; |
| | | if (bValue) iValue = 1; |
| | | |
| | | return WriteInt(pszSection, pszName, iValue); |
| | | } |
| | | |
| | | bool CConfigVision::ReadBool(const char *pszSection, const char *pszName, bool deaultBool) { |
| | | /* code */ |
| | | int defaultInt = 0; |
| | | if (deaultBool) defaultInt = 1; |
| | | int nRet = ReadInt(pszSection, pszName, defaultInt); |
| | | |
| | | bool res = (1 == nRet); |
| | | return res; |
| | | } |
| | | |
| | | bool CConfigVision::WriteFloat(const char *pszSection, const char *pszName, double fValue) { |
| | | /* code */ |
| | | CString strSection = CString(pszSection); |
| | | CString strName = CString(pszName); |
| | | CString strValue; |
| | | strValue.Format(_T("%.6f"), fValue); |
| | | BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName); |
| | | if (!isRes) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | double CConfigVision::ReadFloat(const char *pszSection, const char *pszName, double defaultValue) { |
| | | /* code */ |
| | | CString strSection = CString(pszSection); |
| | | CString strName = CString(pszName); |
| | | CString strDefault; |
| | | strDefault.Format(_T("%.6f"), defaultValue); |
| | | CString strValue; |
| | | GetPrivateProfileString(strSection, strName, strDefault, strValue.GetBuffer(MAX_PATH), MAX_PATH, m_strFileName); |
| | | std::string strRes = CT2A(strValue); |
| | | double fValue = atof(strRes.c_str()); |
| | | return fValue; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef CONFIG_VISION_H |
| | | #define CONFIG_VISION_H |
| | | |
| | | class CConfigVision |
| | | { |
| | | public: |
| | | CConfigVision(); |
| | | ~CConfigVision(); |
| | | |
| | | public: |
| | | //1. 设置工ä½è·¯å¾ |
| | | void SetWorkDir(const char *pszPath, const char *pszName); |
| | | |
| | | //2. åå
¥è¯»ååæ° |
| | | bool WriteText(const char *pszSection, const char *pszName, const char *pszValue); |
| | | std::string ReadText(const char *pszSection, const char *pszName, const char *pszDefault); |
| | | |
| | | //3. åå
¥è¯»ååæ° |
| | | bool WriteInt(const char *pszSection, const char *pszName, int intValue); |
| | | int ReadInt(const char *pszSection, const char *pszName, int defaultValue); |
| | | |
| | | //4. åå
¥è¯»ååæ° |
| | | bool WriteBool(const char *pszSection, const char *pszName, int bValue); |
| | | bool ReadBool(const char *pszSection, const char *pszName, bool deaultBool); |
| | | |
| | | //5. åå
¥è¯»ååæ° |
| | | bool WriteFloat(const char *pszSection, const char *pszName, double fValue); |
| | | double ReadFloat(const char *pszSection, const char *pszName, double defaultValue); |
| | | |
| | | private: |
| | | CString m_strFileName; |
| | | |
| | | private: |
| | | //1. åå§åå建æä»¶ |
| | | void init(std::string filePath, std::string strName); |
| | | }; |
| | | |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CornerDistProcess.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "VisionRecipe.h" |
| | | |
| | | CCornerDistProcess::CCornerDistProcess(){ |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | init(); |
| | | } |
| | | |
| | | CCornerDistProcess::~CCornerDistProcess(){ |
| | | /* code */ |
| | | release(); |
| | | } |
| | | |
| | | int CCornerDistProcess::init(void) { |
| | | /* code */ |
| | | release(); |
| | | |
| | | m_isTfConvert = FALSE; |
| | | |
| | | for (int i = 0; i < 6; i++) { |
| | | m_stdPoint[i].x = 0; |
| | | m_stdPoint[i].y = 0; |
| | | } |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | m_aryMeasure[i].idxRefer = 0; |
| | | m_aryMeasure[i].typePoint = 0; |
| | | m_aryMeasure[i].modePoint = 0; |
| | | m_aryMeasure[i].pointThres = 30; |
| | | m_aryMeasure[i].modeNear = 0; |
| | | m_aryMeasure[i].nearThres = 30; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CCornerDistProcess::release(void) { |
| | | /* code */ |
| | | int nCount = (int)(m_vDosts.size()); |
| | | if (nCount > 0) { |
| | | for (int i = 0; i < nCount; i++) { |
| | | CDistDotProcess *dot = m_vDosts.at(i); |
| | | if (NULL == dot) continue; |
| | | delete dot; |
| | | dot = NULL; |
| | | } |
| | | } |
| | | m_vDosts.clear(); |
| | | } |
| | | |
| | | CDistDotProcess* CCornerDistProcess::getDot(int index) { |
| | | /* code */ |
| | | int nCount = (int)(m_vDosts.size()); |
| | | if (index < 0 || index > nCount - 1) return nullptr; |
| | | |
| | | CDistDotProcess *dot = m_vDosts.at(index); |
| | | return dot; |
| | | } |
| | | |
| | | int CCornerDistProcess::addDot(void) { |
| | | /* code */ |
| | | int nCount = (int)(m_vDosts.size()); |
| | | int id = -MAXINT; |
| | | if (nCount < 1) { |
| | | id = 0; |
| | | } |
| | | else { |
| | | for (int i = 0; i < nCount; i++) { |
| | | CDistDotProcess *dot = m_vDosts.at(i); |
| | | if (NULL == dot) continue; |
| | | if (dot->getID() <= id) continue; |
| | | id = dot->getID(); |
| | | } |
| | | id += 1; |
| | | } |
| | | |
| | | CDistDotProcess *dot = new CDistDotProcess(m_eDir, id); |
| | | m_vDosts.push_back(dot); |
| | | return id; |
| | | } |
| | | |
| | | Point2I CCornerDistProcess::getPoint(int nType) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | if (nType < 0 || nType > 5) return result; |
| | | |
| | | result = m_stdPoint[nType]; |
| | | return result; |
| | | } |
| | | |
| | | void CCornerDistProcess::setPoint(Point2I pos, int nType) { |
| | | /* code */ |
| | | if (nType < 0 || nType > 5) return; |
| | | |
| | | m_stdPoint[nType] = pos; |
| | | } |
| | | |
| | | int CCornerDistProcess::execute(DimensionDir eDir) { |
| | | /* code */ |
| | | m_isTfConvert = FALSE; |
| | | if (m_eDir != eDir) return -1; |
| | | |
| | | int nCount = (int)(m_vDosts.size()); |
| | | if (nCount < 1) return 0; |
| | | |
| | | Point2I offset; |
| | | Point2I pose; |
| | | int idxType = 0; |
| | | MeasureInfo inf; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CDistDotProcess *dot = m_vDosts.at(i); |
| | | if (NULL == dot) continue; |
| | | |
| | | idxType = dot->m_idxRefer; |
| | | if (idxType < 0 || idxType > 3) continue; |
| | | inf = m_aryMeasure[idxType]; |
| | | |
| | | pose = dot->getPose(); |
| | | offset = getOffset(inf.idxRefer, pose); |
| | | |
| | | dot->setPoint(m_stdPoint[0], 0); |
| | | dot->setPoint(m_stdPoint[1], 1); |
| | | dot->setPoint(tfCoordinate(m_stdPoint[4]), 2); |
| | | dot->setPoint(tfCoordinate(m_stdPoint[5]), 3); |
| | | dot->Execute(m_eDir, inf, offset); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CCornerDistProcess::Serialized(void* pBuffer, int size) { |
| | | /* code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | int useSize = 0; |
| | | int nRet = 0; |
| | | |
| | | #if 0 |
| | | //1. ä¿åmark |
| | | int iValue = (int)(m_eDir); |
| | | SERIALIZER_INT_32(iValue, pTemp, remainSize, useSize); //Type |
| | | |
| | | for (int i = 0; i < 6; i++) { |
| | | SERIALIZER_INT_32(m_stdPoint[i].x, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_stdPoint[i].y, pTemp, remainSize, useSize); |
| | | } |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | SERIALIZER_INT_32(m_aryMeasure[i].idxRefer, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_aryMeasure[i].typePoint, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_aryMeasure[i].modePoint, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_aryMeasure[i].pointThres, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_aryMeasure[i].modeNear, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_aryMeasure[i].nearThres, pTemp, remainSize, useSize); |
| | | } |
| | | |
| | | //2. ä¿åç¹çæ°é |
| | | int nCount = (int)(m_vDosts.size()); |
| | | SERIALIZER_INT_32(nCount, pTemp, remainSize, useSize); |
| | | |
| | | if (nCount > 0) { |
| | | for (int i = 0; i < nCount; i++) { |
| | | CDistDotProcess *pDot = m_vDosts.at(i); |
| | | if (NULL == pDot) continue; |
| | | nRet = pDot->Serialized(pTemp, remainSize); |
| | | if (nRet < 0) continue; |
| | | pTemp += nRet; |
| | | remainSize -= nRet; |
| | | useSize += nRet; |
| | | } |
| | | } |
| | | #endif |
| | | |
| | | return useSize; |
| | | } |
| | | |
| | | int CCornerDistProcess::Deserialized(void* pBuffer, int size) { |
| | | /* code */ |
| | | release(); |
| | | |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | int useSize = 0; |
| | | int nRet = 0; |
| | | |
| | | #if 0 |
| | | //1. å è½½Mark |
| | | int iValue = 0; |
| | | DESERIALIZER_INT_32(iValue, pTemp, remainSize, useSize); //Type |
| | | m_eDir = (DimensionDir)(iValue); |
| | | |
| | | for (int i = 0; i < 6; i++) { |
| | | DESERIALIZER_INT_32(m_stdPoint[i].x, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_stdPoint[i].y, pTemp, remainSize, useSize); |
| | | } |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | DESERIALIZER_INT_32(m_aryMeasure[i].idxRefer, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_aryMeasure[i].typePoint, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_aryMeasure[i].modePoint, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_aryMeasure[i].pointThres, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_aryMeasure[i].modeNear, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_aryMeasure[i].nearThres, pTemp, remainSize, useSize); |
| | | } |
| | | |
| | | //2. ä¿åç¹çæ°é |
| | | int nCount = 0; |
| | | DESERIALIZER_INT_32(nCount, pTemp, remainSize, useSize); |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CDistDotProcess *dot = new CDistDotProcess(); |
| | | nRet = dot->Deserialized(pTemp, remainSize); |
| | | if (nRet < 0) continue; |
| | | m_vDosts.push_back(dot); |
| | | |
| | | pTemp += nRet; |
| | | remainSize -= nRet; |
| | | useSize += nRet; |
| | | } |
| | | |
| | | #endif |
| | | |
| | | |
| | | return useSize; |
| | | } |
| | | |
| | | std::vector<CDistDotProcess*>& CCornerDistProcess::getDots(void) { |
| | | /* code */ |
| | | return m_vDosts; |
| | | } |
| | | |
| | | int CCornerDistProcess::delDot(int id) { |
| | | /* code */ |
| | | int nCount = (int)(m_vDosts.size()); |
| | | if (nCount < 1) return -1; |
| | | bool isFind = false; |
| | | for (auto iter = m_vDosts.begin(); iter != m_vDosts.end(); iter++) { |
| | | CDistDotProcess *dot = (*iter); |
| | | if (id == (*iter)->getID()) { |
| | | isFind = true; |
| | | m_vDosts.erase(iter); |
| | | break; |
| | | } |
| | | } |
| | | if (!isFind) return -1; |
| | | |
| | | nCount = (int)(m_vDosts.size()); |
| | | if (nCount < 1) return -1; |
| | | |
| | | CDistDotProcess *dot = m_vDosts.at(0); |
| | | return dot->getID(); |
| | | } |
| | | |
| | | Point2I CCornerDistProcess::getOffset(int nType, Point2I pt) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | |
| | | switch (nType){ |
| | | case 1: |
| | | result = getTopPointOffset(pt); |
| | | break; |
| | | |
| | | case 2: |
| | | result = getBotPointOffset(pt); |
| | | break; |
| | | |
| | | default: |
| | | result = getAffineOffset(pt); |
| | | break; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | MeasureInfo CCornerDistProcess::getMeasureInfo(int index) { |
| | | /* code */ |
| | | MeasureInfo inf; |
| | | inf.idxRefer = 0; |
| | | inf.typePoint = 0; |
| | | inf.modePoint = 0; |
| | | inf.pointThres = 30; |
| | | inf.modeNear = 0; |
| | | inf.nearThres = 30; |
| | | if (index < 0 || index > 3) return inf; |
| | | |
| | | inf = m_aryMeasure[index]; |
| | | return inf; |
| | | } |
| | | |
| | | void CCornerDistProcess::setMeasureInfo(MeasureInfo inf, int index) { |
| | | /* code */ |
| | | if (index < 0 || index > 3) return; |
| | | |
| | | m_aryMeasure[index] = inf; |
| | | } |
| | | |
| | | Point2I CCornerDistProcess::getAffineOffset(Point2I pt) { |
| | | /* code */ |
| | | Point2I result; |
| | | Point2I ptTarget = tfCoordinate(pt); |
| | | |
| | | result.x = (int)(ptTarget.x - pt.x); |
| | | result.y = (int)(ptTarget.y - pt.y); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | Point2I CCornerDistProcess::tfCoordinate(Point2I pt) { |
| | | /* code */ |
| | | tfProcess(); |
| | | |
| | | Point2D pose; |
| | | pose.x = pt.x; |
| | | pose.y = pt.y; |
| | | Point2D ptTarget = ClsVision::CoordinateTransform(pose, m_affine); |
| | | Point2I result; |
| | | result.x = (int)(ptTarget.x); |
| | | result.y = (int)(ptTarget.y); |
| | | return result; |
| | | } |
| | | |
| | | void CCornerDistProcess::tfProcess(void){ |
| | | /* code */ |
| | | if (m_isTfConvert) return; |
| | | |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) { |
| | | Point2D pose; |
| | | pose.x = 0.0f; |
| | | pose.y = 0.0f; |
| | | m_affine = ClsVision::VectorAngleToRigid(pose, 0.0f, pose, 0.0f); |
| | | return; |
| | | } |
| | | |
| | | std::vector<Point2D> vPtOrg, vPtTgt; |
| | | Point2D pose; |
| | | pose.x = m_stdPoint[0].x; |
| | | pose.y = m_stdPoint[0].y; |
| | | vPtOrg.push_back(pose); |
| | | pose.x = m_stdPoint[1].x; |
| | | pose.y = m_stdPoint[1].y; |
| | | vPtOrg.push_back(pose); |
| | | |
| | | pose.x = pSideData->m_mTopMark.x; |
| | | pose.y = pSideData->m_mTopMark.y; |
| | | vPtTgt.push_back(pose); |
| | | pose.x = pSideData->m_mBotMark.x; |
| | | pose.y = pSideData->m_mBotMark.y; |
| | | vPtTgt.push_back(pose); |
| | | |
| | | m_affine = ClsVision::VectorToSimilarity(vPtOrg, vPtTgt); |
| | | m_isTfConvert = TRUE; |
| | | } |
| | | |
| | | Point2I CCornerDistProcess::getTopPointOffset(Point2I pt) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return result; |
| | | |
| | | if (!pSideData->m_bTopPoint_Find) return result; |
| | | |
| | | result.x = pSideData->m_mTopPoint.x - m_stdPoint[2].x; |
| | | result.y = pSideData->m_mTopPoint.y - m_stdPoint[2].y; |
| | | |
| | | return result; |
| | | } |
| | | |
| | | Point2I CCornerDistProcess::getBotPointOffset(Point2I pt) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return result; |
| | | |
| | | if (!pSideData->m_bBotPoint_Find) return result; |
| | | |
| | | result.x = pSideData->m_mBotPoint.x - m_stdPoint[3].x; |
| | | result.y = pSideData->m_mBotPoint.y - m_stdPoint[3].y; |
| | | |
| | | return result; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef CORNER_DIST_PROCESS_H |
| | | #define CORNER_DIST_PROCESS_H |
| | | |
| | | #include "DistDotProcess.h" |
| | | |
| | | class CVisionRecipe; |
| | | |
| | | class CCornerDistProcess |
| | | { |
| | | public: |
| | | CCornerDistProcess(); |
| | | ~CCornerDistProcess(); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | |
| | | public: |
| | | //1. get set dot |
| | | CDistDotProcess* getDot(int index); |
| | | std::vector<CDistDotProcess*>& getDots(void); |
| | | int addDot(void); |
| | | int delDot(int id); |
| | | |
| | | //2. get/set UpMark |
| | | Point2I getPoint(int nType); |
| | | void setPoint(Point2I pos, int nType); |
| | | |
| | | //3. æ§è¡ |
| | | int execute(DimensionDir eDir); |
| | | |
| | | //4. åºåååæ°åååºåå·åæ° |
| | | int Serialized(void* pBuffer, int size); |
| | | int Deserialized(void* pBuffer, int size); |
| | | |
| | | //5. è·ååç§»å¼ |
| | | Point2I getOffset(int nType, Point2I pt); |
| | | |
| | | //6. è·åæµéæ°æ® |
| | | MeasureInfo getMeasureInfo(int index); |
| | | void setMeasureInfo(MeasureInfo inf, int index); |
| | | |
| | | private: |
| | | std::vector<CDistDotProcess*> m_vDosts; |
| | | |
| | | Point2I m_stdPoint[6]; |
| | | MeasureInfo m_aryMeasure[4]; |
| | | BOOL m_isTfConvert; |
| | | ParaAffine2D m_affine; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | int init(void); |
| | | |
| | | //2. éæ¾ |
| | | void release(void); |
| | | |
| | | //3. è·ååç§» |
| | | Point2I getAffineOffset(Point2I pt); |
| | | |
| | | //4. è·åTopMark |
| | | Point2I getTopPointOffset(Point2I pt); |
| | | |
| | | //5. è·åBotMark |
| | | Point2I getBotPointOffset(Point2I pt); |
| | | |
| | | //6. åæ è½¬æ¢ |
| | | Point2I tfCoordinate(Point2I pt); |
| | | |
| | | //7. åæ è½¬æ¢ |
| | | void tfProcess(void); |
| | | }; |
| | | |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CornerRcutProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CCornerRcutProcess::CCornerRcutProcess(){ |
| | | /* code */ |
| | | for (int i = 0; i < 2; i++) { |
| | | m_dots[i] = NULL; |
| | | } |
| | | m_eDir = DIMENSION_NONE; |
| | | init(); |
| | | } |
| | | |
| | | CCornerRcutProcess::CCornerRcutProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | for (int i = 0; i < 2; i++) { |
| | | m_dots[i] = NULL; |
| | | } |
| | | m_eDir = eDir; |
| | | init(); |
| | | } |
| | | |
| | | CCornerRcutProcess::~CCornerRcutProcess(){ |
| | | /* code */ |
| | | release(); |
| | | } |
| | | |
| | | int CCornerRcutProcess::init(void) { |
| | | /* code */ |
| | | release(); |
| | | |
| | | for (int i = 0; i < 2; i++) { |
| | | m_dots[i] = new CRcutDotProcess(m_eDir, i + 1); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CCornerRcutProcess::release(void) { |
| | | /* code */ |
| | | int nCount = 2; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CRcutDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dots[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | int CCornerRcutProcess::execute(DimensionDir eDir) { |
| | | /* code */ |
| | | if (m_eDir != eDir) return -1; |
| | | |
| | | int nCount = 2; |
| | | Point2I offset; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CRcutDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | if (1 != dot->m_nUse) continue; |
| | | |
| | | offset.x = i; |
| | | offset.y = i; |
| | | dot->Execute(m_eDir, offset); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | Json::Value CCornerRcutProcess::WriteToJson(void) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["type"] = RCUT_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | |
| | | for (int i = 0; i < 2; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dots[i]->WriteToJson(); |
| | | } |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CCornerRcutProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | for (int i = 0; i < 2; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dots[i]->DecodeJson(jsData); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef CORNER_RCUT_PROCESS |
| | | #define CORNER_RCUT_PROCESS |
| | | |
| | | #include "RcutDotProcess.h" |
| | | |
| | | class CCornerRcutProcess |
| | | { |
| | | public: |
| | | CCornerRcutProcess(); |
| | | CCornerRcutProcess(DimensionDir eDir); |
| | | ~CCornerRcutProcess(); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | CRcutDotProcess *m_dots[2]; |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | int execute(DimensionDir eDir); |
| | | |
| | | //2. ä¿åæ°æ® |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | private: |
| | | //1. åå§å |
| | | int init(void); |
| | | |
| | | //2. éæ¾ |
| | | void release(void); |
| | | }; |
| | | |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CutDotProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CCutDotProcess::CCutDotProcess(){ |
| | | /* code */ |
| | | m_poseType = 0; |
| | | m_eDir = DIMENSION_NONE; |
| | | m_id = 0; |
| | | |
| | | m_nUse = 0; |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | |
| | | m_nPosX = 0; |
| | | m_nPosY = 0; |
| | | m_nEdgeThres = 120; |
| | | |
| | | m_nInc = 0; |
| | | m_nMin = 0; |
| | | m_nMax = 0; |
| | | m_distResult = 0.0f; |
| | | } |
| | | |
| | | CCutDotProcess::CCutDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_poseType = 0; |
| | | m_eDir = eDir; |
| | | m_id = id; |
| | | |
| | | m_nUse = 0; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD_L%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P_L%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P_Cut_Dot%d"), m_id); |
| | | break; |
| | | } |
| | | |
| | | m_nPosX = 0; |
| | | m_nPosY = 0; |
| | | m_nEdgeThres = 120; |
| | | |
| | | m_nInc = 0; |
| | | m_nMin = 0; |
| | | m_nMax = 0; |
| | | |
| | | m_distResult = 0.0f; |
| | | } |
| | | |
| | | CCutDotProcess::~CCutDotProcess(){ |
| | | /* code */ |
| | | } |
| | | |
| | | int CCutDotProcess::Execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | m_ptNearResult.x = 0.0f; |
| | | m_ptNearResult.y = 0.0f; |
| | | m_ptMeasureResult.x = 0.0f; |
| | | m_ptMeasureResult.y = 0.0f; |
| | | m_distResult = 0.0f; |
| | | if (1 != m_nUse) return 0; |
| | | if (0 == m_nPosX && 0 == m_nPosY) return 0; |
| | | |
| | | //1. è·åè§£é度 |
| | | getMmvsp(eDir); |
| | | |
| | | //2. æ¥æ¾left |
| | | if (!FindLeftLine(eDir, offset)) return -1; |
| | | |
| | | //3. ç»æå¤æ |
| | | judgeResult(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | bool CCutDotProcess::FindLeftLine(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return false; |
| | | if (0 == m_poseType) { |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | } |
| | | else { |
| | | if (!pSideData->m_bTopPoint_Find) return false; |
| | | if (!pSideData->m_bBotPoint_Find) return false; |
| | | } |
| | | |
| | | Point2I ptOffset; |
| | | ptOffset.x = -1 * m_nPosX; |
| | | ptOffset.y = m_nPosY; |
| | | Point2I result; |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result)) return false; |
| | | m_locPointResult = result; |
| | | |
| | | double fzSearchRange = 500.0f; |
| | | int nSearchRange = (int)(fzSearchRange / pSideData->m_dPixelSizeX); |
| | | |
| | | Point2I cutResult; |
| | | if (!CVisionBufferPro::findCutLine(m_eDir, result, nSearchRange, m_nEdgeThres, cutResult)) return false; |
| | | |
| | | m_ptMeasureResult.x = cutResult.x; |
| | | m_ptMeasureResult.y = cutResult.y; |
| | | m_ptNearResult = m_ptMeasureResult; |
| | | |
| | | Line2D line; |
| | | line.pt0.x = 0.0f; // m_Points[0].x; |
| | | line.pt0.y = 0.0f; // m_Points[0].y; |
| | | line.pt1.x = m_xMmvsp * (m_Points[1].x - m_Points[0].x); |
| | | line.pt1.y = m_yMmvsp * (m_Points[1].y - m_Points[0].y); |
| | | Point2D ptEdge; |
| | | ptEdge.x = m_xMmvsp * (m_ptMeasureResult.x - m_Points[0].x); |
| | | ptEdge.y = m_yMmvsp * (m_ptMeasureResult.y - m_Points[0].y); |
| | | |
| | | Point2D pose = ClsVision::ProjectionPL(ptEdge, line); |
| | | Point2D posProject; |
| | | posProject.x = m_Points[0].x + pose.x / pSideData->m_dPixelSizeX; |
| | | posProject.y = m_Points[0].y + pose.y / pSideData->m_dPixelSizeY; |
| | | |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 3; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.strName = m_strName; |
| | | inf.eVision = (int)(VISION_CUT); |
| | | inf.rectX1 = (int)(cutResult.x); |
| | | inf.rectY1 = (int)(cutResult.y); |
| | | inf.rectX2 = (int)(posProject.x); |
| | | inf.rectY2 = (int)(posProject.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | int CCutDotProcess::getID(void) { |
| | | /* code */ |
| | | return m_id; |
| | | } |
| | | |
| | | void CCutDotProcess::getMmvsp(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | m_xMmvsp = pSideData->m_dPixelSizeX; |
| | | m_yMmvsp = pSideData->m_dPixelSizeY; |
| | | } |
| | | |
| | | void CCutDotProcess::judgeResult(void) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return; |
| | | if (NULL != pSideData) { |
| | | DispVisionResult inf; |
| | | inf.nType = 4; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.strName = m_strName; |
| | | inf.eVision = (int)(VISION_CUT); |
| | | inf.pointX = (int)(m_ptMeasureResult.x); |
| | | inf.pointY = (int)(m_ptMeasureResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = true; |
| | | ng.minValue = m_nMin; |
| | | ng.maxValue = m_nMax; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_OK; //缺é·ç±»å |
| | | ng.eVision = VISION_KDIST; |
| | | |
| | | ng.xPosPxl = m_locPointResult.x; |
| | | ng.yPosPxl = m_locPointResult.y; |
| | | ng.xResult = 0.0f; |
| | | ng.yResult = 0.0f; |
| | | ng.x1 = m_locPointResult.x - 40; |
| | | ng.y1 = m_locPointResult.y - 20; |
| | | ng.x2 = m_locPointResult.x + 40; |
| | | ng.y2 = m_locPointResult.y + 20; |
| | | |
| | | ng.ngType = DefectLoc_Dist_Cut; |
| | | Line2D line; |
| | | line.pt0.x = 0.0f; // m_Points[0].x; |
| | | line.pt0.y = 0.0f; // m_Points[0].y; |
| | | line.pt1.x = m_xMmvsp * (m_Points[1].x - m_Points[0].x); |
| | | line.pt1.y = m_yMmvsp * (m_Points[1].y - m_Points[0].y); |
| | | |
| | | Point2D ptEdge; |
| | | ptEdge.x = m_xMmvsp * (m_ptMeasureResult.x - m_Points[0].x); |
| | | ptEdge.y = m_yMmvsp * (m_ptMeasureResult.y - m_Points[0].y); |
| | | |
| | | Point2D pose = ClsVision::ProjectionPL(ptEdge, line); |
| | | double dx = (ptEdge.x - pose.x); |
| | | double dy = (ptEdge.y - pose.y); |
| | | m_distResult = sqrt(dx * dx + dy * dy); |
| | | |
| | | m_distResult += m_nInc; |
| | | ng.result = m_distResult; |
| | | |
| | | if (m_nMax < 0.5) { |
| | | m_nNgInfo.push_back(ng); |
| | | return; |
| | | } |
| | | |
| | | double dDist = m_distResult - abs(m_nPosX); |
| | | if (dDist < m_nMin || dDist > m_nMax) { |
| | | ng.isRes = false; |
| | | } |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | |
| | | void CCutDotProcess::setPoint(Point2I pose, int nType) { |
| | | /* code */ |
| | | if (0 == nType) { |
| | | m_Points[0] = pose; |
| | | } |
| | | else if (1 == nType) { |
| | | m_Points[1] = pose; |
| | | } |
| | | } |
| | | |
| | | Json::Value CCutDotProcess::WriteToJson(void) { |
| | | /* code */ |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = CUT_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["use"] = m_nUse; |
| | | jsValue["pos x"] = m_nPosX; |
| | | jsValue["pos y"] = m_nPosY; |
| | | jsValue["inc"] = m_nInc; |
| | | jsValue["min"] = m_nMin; |
| | | jsValue["max"] = m_nMax; |
| | | jsValue["pos type"] = m_poseType; |
| | | jsValue["line thres"] = m_nEdgeThres; |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CCutDotProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nUse = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //5. pos x |
| | | strName = "pos x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPosX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //6. pos y |
| | | strName = "pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPosY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //7. inc |
| | | strName = "inc"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nInc = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //8. min |
| | | strName = "min"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nMin = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //9. max |
| | | strName = "max"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nMax = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //10. pos type |
| | | strName = "pos type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_poseType = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //11. line width |
| | | strName = "line thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nEdgeThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef CUT_DOT_PROCESS_H |
| | | #define CUT_DOT_PROCESS_H |
| | | |
| | | #include "IncludeVision.h" |
| | | |
| | | class CCutDotProcess |
| | | { |
| | | public: |
| | | CCutDotProcess(); |
| | | CCutDotProcess(DimensionDir eDir, int id); |
| | | ~CCutDotProcess(); |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | int Execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | //2. è·åID |
| | | int getID(void); |
| | | void setPoint(Point2I pose, int nType); |
| | | |
| | | //3. ä¿åæä»¶ |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | public: |
| | | int m_nUse; |
| | | CString m_strName; |
| | | int m_nPosY; |
| | | int m_nPosX; |
| | | int m_poseType; |
| | | int m_nEdgeThres; |
| | | |
| | | int m_nInc; |
| | | int m_nMin; |
| | | int m_nMax; |
| | | |
| | | Point2D m_ptMeasureResult; |
| | | Point2D m_ptNearResult; |
| | | Point2I m_locPointResult; |
| | | double m_distResult; |
| | | |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | int m_id; |
| | | |
| | | double m_xMmvsp; |
| | | double m_yMmvsp; |
| | | Point2I m_Points[2]; |
| | | |
| | | private: |
| | | //1. è·åå辨ç |
| | | void getMmvsp(DimensionDir eDir); |
| | | |
| | | //1. å¤æç»æ |
| | | void judgeResult(void); |
| | | |
| | | //2. æ¥æ¾è¾¹ç |
| | | bool FindLeftLine(DimensionDir eDir, Point2I offset); |
| | | }; |
| | | |
| | | #endif |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CutProcess.h" |
| | | #include "BlSideData.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CCutProcess::CCutProcess() { |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | for (int i = 0; i < 50; i++) { |
| | | m_dots[i] = new CCutDotProcess(m_eDir, i + 1); |
| | | } |
| | | m_isUse = false; |
| | | } |
| | | |
| | | CCutProcess::CCutProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_isUse = false; |
| | | for (int i = 0; i < 50; i++) { |
| | | m_dots[i] = new CCutDotProcess(m_eDir, i + 1); |
| | | } |
| | | } |
| | | |
| | | CCutProcess::~CCutProcess() { |
| | | /* code */ |
| | | for (int i = 0; i < 50; i++) { |
| | | CCutDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dots[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | void CCutProcess::Execute(DimensionDir eDir) { |
| | | /* code */ |
| | | if (!m_isUse) return; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return; |
| | | |
| | | Point2I offset; |
| | | for (int i = 0; i < 50; i++) { |
| | | CCutDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | offset.x = i; |
| | | offset.y = i; |
| | | |
| | | dot->setPoint(pSideData->m_mTopMark, 0); |
| | | dot->setPoint(pSideData->m_mBotMark, 1); |
| | | |
| | | dot->Execute(m_eDir, offset); |
| | | } |
| | | } |
| | | |
| | | Json::Value CCutProcess::WriteToJson(void) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["type"] = CUT_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["use"] = m_isUse; |
| | | |
| | | for (int i = 0; i < 50; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dots[i]->WriteToJson(); |
| | | } |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CCutProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)jsValue.size(); |
| | | if (num < 1) return; |
| | | |
| | | //1. Side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) { |
| | | m_isUse = jsValue[strName.c_str()].asBool(); |
| | | } |
| | | |
| | | for (int i = 0; i < 50; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dots[i]->DecodeJson(jsData); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef CUT_PROCESS_H |
| | | #define CUT_PROCESS_H |
| | | |
| | | #include "CutDotProcess.h" |
| | | |
| | | class CCutProcess |
| | | { |
| | | public: |
| | | CCutProcess(); |
| | | CCutProcess(DimensionDir eDir); |
| | | ~CCutProcess(); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | bool m_isUse; //æ¯å¦å¯ç¨ |
| | | CCutDotProcess *m_dots[50]; |
| | | |
| | | public: |
| | | //1. æ§è¡æ£æµ |
| | | void Execute(DimensionDir eDir); |
| | | |
| | | //2. åå
¥æä»¶ |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "DistDotProcess.h" |
| | | #include "VisionBufferPro.h" |
| | | |
| | | CDistDotProcess::CDistDotProcess(){ |
| | | /* code */ |
| | | m_id = 0; |
| | | m_eDir = DIMENSION_A; |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | |
| | | m_idxRefer = 0; |
| | | m_nRef = 100; |
| | | m_nRef_ = 100; |
| | | |
| | | m_distMode = 1; |
| | | m_minValue = 0; |
| | | m_maxValue = 0; |
| | | |
| | | m_distMode2 = 5; |
| | | m_minValue2 = 0; |
| | | m_maxValue2 = 0; |
| | | |
| | | m_xPos = 0.0f; |
| | | m_yPos = 0.0f; |
| | | m_cx = 0.0f; |
| | | m_cy = 0.0f; |
| | | m_angle = 0.0f; |
| | | m_len1 = 0.0f; |
| | | m_len2 = 0.0f; |
| | | |
| | | m_xMmvsp = 0.0f; |
| | | m_yMmvsp = 0.0f; |
| | | m_ngType = DefectLoc_Grind; |
| | | m_ngType2 = DefectLoc_Dist_Cut; |
| | | m_incValue = 0; |
| | | m_incValue2 = 0; |
| | | |
| | | ClsVision::GenEmptyObject(m_hRegion); |
| | | ClsVision::GenEmptyObject(m_hLineRegion); |
| | | } |
| | | |
| | | CDistDotProcess::~CDistDotProcess(){ |
| | | /* code */ |
| | | } |
| | | |
| | | CDistDotProcess::CDistDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_id = id; |
| | | m_eDir = eDir; |
| | | switch (eDir){ |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | break; |
| | | } |
| | | |
| | | m_idxRefer = 0; |
| | | m_nRef = 100; |
| | | m_nRef_ = 100; |
| | | |
| | | m_distMode = 1; |
| | | m_minValue = 0; |
| | | m_maxValue = 0; |
| | | |
| | | m_distMode2 = 5; |
| | | m_minValue2 = 0; |
| | | m_maxValue2 = 0; |
| | | |
| | | m_xPos = 0.0f; |
| | | m_yPos = 0.0f; |
| | | m_cx = 0.0f; |
| | | m_cy = 0.0f; |
| | | m_angle = 0.0f; |
| | | m_len1 = 0.0f; |
| | | m_len2 = 0.0f; |
| | | |
| | | m_xMmvsp = 0.0f; |
| | | m_yMmvsp = 0.0f; |
| | | m_incValue = 0; |
| | | m_incValue2 = 0; |
| | | |
| | | ClsVision::GenEmptyObject(m_hRegion); |
| | | ClsVision::GenEmptyObject(m_hLineRegion); |
| | | |
| | | m_ngType = DefectLoc_Grind; |
| | | m_ngType2 = DefectLoc_Dist_Cut; |
| | | } |
| | | |
| | | int CDistDotProcess::getID(void) { |
| | | /* code */ |
| | | return m_id; |
| | | } |
| | | |
| | | int CDistDotProcess::Execute(DimensionDir eDir, MeasureInfo inf, Point2I offset) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | m_ptMatchResult.x = 0.0f; |
| | | m_ptMatchResult.y = 0.0f; |
| | | m_ptNearResult.x = 0.0f; |
| | | m_ptNearResult.y = 0.0f; |
| | | m_ptMeasureResult.x = 0.0f; |
| | | m_ptMeasureResult.y = 0.0f; |
| | | m_locPointResult.x = 0; |
| | | m_locPointResult.y = 0; |
| | | |
| | | getMmvsp(eDir); |
| | | |
| | | getKeyPose(offset); |
| | | |
| | | //æ¥æ¾è¾¹ç |
| | | int nRet = findPairEdge(eDir, inf, offset); |
| | | // if (0 != nRet) return nRet; |
| | | |
| | | JudgeResult(); |
| | | |
| | | return nRet; |
| | | } |
| | | |
| | | void CDistDotProcess::JudgeResult(void) { |
| | | /* code */ |
| | | JudgeFirstResult(); |
| | | |
| | | JudgeSecondResult(); |
| | | } |
| | | |
| | | void CDistDotProcess::JudgeFirstResult(void) { |
| | | /* code */ |
| | | if (0 == m_distMode) return; |
| | | |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = true; |
| | | ng.minValue = m_minValue; |
| | | ng.maxValue = m_maxValue; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_OK; //缺é·ç±»å |
| | | ng.eVision = VISION_NONE; // VISION_DIST; |
| | | |
| | | ng.xPosPxl = m_locPointResult.x; |
| | | ng.yPosPxl = m_locPointResult.y; |
| | | ng.xResult = 0.0f; |
| | | ng.yResult = 0.0f; |
| | | ng.x1 = m_locPointResult.x - 40; |
| | | ng.y1 = m_locPointResult.y - 20; |
| | | ng.x2 = m_locPointResult.x + 40; |
| | | ng.y2 = m_locPointResult.y + 20; |
| | | |
| | | if (1 == m_distMode) { //Grind Size |
| | | ng.ngType = m_ngType; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (2 == m_distMode) { //Top Point |
| | | ng.ngType = m_ngType; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_topPoint.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_topPoint.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (3 == m_distMode) { //Bot Point |
| | | ng.ngType = m_ngType; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_botPoint.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_botPoint.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (4 == m_distMode) { //Key Dist |
| | | ng.ngType = m_ngType; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptMatchResult.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptMatchResult.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (5 == m_distMode) { //Mark Line |
| | | Line2D line; |
| | | line.pt0.x = m_topMark.x; |
| | | line.pt0.y = m_topMark.y; |
| | | line.pt1.x = m_botMark.x; |
| | | line.pt1.y = m_botMark.y; |
| | | Point2D pose = ClsVision::ProjectionPL(m_ptMeasureResult, line); |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - pose.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - pose.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | ng.ngType = m_ngType; |
| | | } |
| | | if (ng.result + m_incValue > 0.0f) { |
| | | ng.result += m_incValue; |
| | | } |
| | | if (m_maxValue < 0.01f || m_maxValue <= m_minValue + 0.001) { |
| | | m_nNgInfo.push_back(ng); |
| | | return; |
| | | } |
| | | |
| | | if (ng.result < m_minValue || ng.result > m_maxValue) { |
| | | ng.isRes = false; |
| | | } |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | |
| | | void CDistDotProcess::JudgeSecondResult(void) { |
| | | /* code */ |
| | | if (0 == m_distMode2) return; |
| | | |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = true; |
| | | ng.minValue = m_minValue2; |
| | | ng.maxValue = m_maxValue2; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_OK; //缺é·ç±»å |
| | | ng.eVision = VISION_NONE; // VISION_DIST; |
| | | |
| | | ng.xPosPxl = m_locPointResult.x; |
| | | ng.yPosPxl = m_locPointResult.y; |
| | | ng.xResult = 0.0f; |
| | | ng.yResult = 0.0f; |
| | | ng.x1 = m_locPointResult.x - 40; |
| | | ng.y1 = m_locPointResult.y - 20; |
| | | ng.x2 = m_locPointResult.x + 40; |
| | | ng.y2 = m_locPointResult.y + 20; |
| | | |
| | | if (1 == m_distMode2) { //Grind Size |
| | | ng.ngType = m_ngType2; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (2 == m_distMode2) { //Top Point |
| | | ng.ngType = m_ngType2; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_topPoint.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_topPoint.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (3 == m_distMode2) { //Bot Point |
| | | ng.ngType = m_ngType2; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_botPoint.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_botPoint.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (4 == m_distMode2) { //Key Dist |
| | | ng.ngType = m_ngType2; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptMatchResult.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptMatchResult.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (5 == m_distMode2) { //Mark Line |
| | | Line2D line; |
| | | line.pt0.x = m_topMark.x; |
| | | line.pt0.y = m_topMark.y; |
| | | line.pt1.x = m_botMark.x; |
| | | line.pt1.y = m_botMark.y; |
| | | Point2D pose = ClsVision::ProjectionPL(m_ptMeasureResult, line); |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - pose.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - pose.y); |
| | | ng.result = sqrt(dx * dx + dy * dy); |
| | | ng.ngType = m_ngType2; |
| | | } |
| | | |
| | | if (ng.result + m_incValue2 > 0.0f) { |
| | | ng.result += m_incValue2; |
| | | } |
| | | if (m_maxValue2 < 0.01f || m_maxValue2 <= m_minValue2 + 0.001) { |
| | | m_nNgInfo.push_back(ng); |
| | | return; |
| | | } |
| | | |
| | | if (ng.result < m_minValue2 || ng.result > m_maxValue2) { |
| | | ng.isRes = false; |
| | | } |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | |
| | | |
| | | void CDistDotProcess::getMmvsp(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | m_xMmvsp = pSideData->m_dPixelSizeX; |
| | | m_yMmvsp = pSideData->m_dPixelSizeY; |
| | | } |
| | | |
| | | int CDistDotProcess::getKeyPose(Point2I offset) { |
| | | /* code */ |
| | | if (fabs(m_xPos) < 0.01 || fabs(m_yPos) < 0.01) return -1; |
| | | |
| | | m_ptMatchResult.x = m_xPos + offset.x; |
| | | m_ptMatchResult.y = m_yPos + offset.y; |
| | | return 0; |
| | | } |
| | | |
| | | int CDistDotProcess::findPairEdge(DimensionDir eDir, MeasureInfo infMeasure, Point2I offset) { |
| | | /* code */ |
| | | //1. å¾åé¢å¤ç |
| | | if (m_len1 < 0.01 || m_len2 < 0.01) return -3; |
| | | |
| | | Line2D line = GetTargeLine(); |
| | | line.pt0.x += offset.x; |
| | | line.pt0.y += offset.y; |
| | | line.pt1.x += offset.x; |
| | | line.pt1.y += offset.y; |
| | | |
| | | int x1 = (int)(line.pt0.x - 30); |
| | | if (line.pt0.x > line.pt1.x) x1 = (int)(line.pt1.x - 30); |
| | | int x2 = (int)(line.pt0.x + 30); |
| | | if (line.pt0.x < line.pt1.x) x2 = (int)(line.pt1.x + 30); |
| | | int y1 = (int)(line.pt0.y - 30); |
| | | if (line.pt0.y > line.pt1.y) y1 = (int)(line.pt1.y - 30); |
| | | int y2 = (int)(line.pt0.y + 30); |
| | | if (line.pt0.y < line.pt1.y) y2 = (int)(line.pt1.y + 30); |
| | | int leftPos = x1; |
| | | int topPos = y1; |
| | | |
| | | m_locPointResult.x = (int)(m_cx + offset.x); |
| | | m_locPointResult.y = (int)(m_cy + offset.y); |
| | | |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return -3; |
| | | line.pt0.x -= leftPos; |
| | | line.pt0.y -= topPos; |
| | | line.pt1.x -= leftPos; |
| | | line.pt1.y -= topPos; |
| | | |
| | | // HalconCpp::HObject hProcImage; |
| | | // HalconCpp::MedianImage(hImage, &hProcImage, "circle", 1, "mirrored"); |
| | | bool valid = false; |
| | | if (0 == infMeasure.typePoint) { |
| | | //valid = CVisionBufferPro::GetMeasurePos(hImage, line, |
| | | // infMeasure.typePoint, |
| | | // infMeasure.pointThres, infMeasure.modePoint, |
| | | // infMeasure.nearThres, infMeasure.modeNear, |
| | | // 5, m_ptMeasureResult, m_ptNearResult); |
| | | } |
| | | else { |
| | | //valid = CVisionBufferPro::GetMeasurePos(hImage, line, |
| | | // infMeasure.typePoint, |
| | | // infMeasure.pointThres, infMeasure.modePoint, |
| | | // infMeasure.nearThres, infMeasure.modeNear, |
| | | // 5, m_ptNearResult, m_ptMeasureResult); |
| | | } |
| | | if (!valid) { |
| | | m_ptMeasureResult.x = 0.0f; |
| | | m_ptMeasureResult.y = 0.0f; |
| | | m_ptNearResult.x = 0.0f; |
| | | m_ptNearResult.y = 0.0f; |
| | | } |
| | | else { |
| | | m_ptMeasureResult.x += leftPos; |
| | | m_ptMeasureResult.y += topPos; |
| | | m_ptNearResult.x += leftPos; |
| | | m_ptNearResult.y += topPos; |
| | | } |
| | | |
| | | if (!valid) { |
| | | return -4; |
| | | } |
| | | |
| | | m_locPointResult.x = (int)(m_ptMeasureResult.x); |
| | | m_locPointResult.y = (int)(m_ptMeasureResult.y); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | Line2D CDistDotProcess::GetTargeLine(void) { |
| | | /* code */ |
| | | Line2D lineResult; |
| | | double angle = m_angle; |
| | | double xa = m_len1; |
| | | double xb = m_len2; |
| | | double x = m_cx; |
| | | double y = m_cy; |
| | | Point2D ptCenter; |
| | | ptCenter.x = x; |
| | | ptCenter.y = y; |
| | | |
| | | double phi = ClsVision::DegreeToRad(angle); |
| | | double cosx = ClsVision::GetCos(phi); |
| | | double sinx = ClsVision::GetSin(phi); |
| | | |
| | | lineResult.pt0.x = ptCenter.x + xa * cosx; |
| | | lineResult.pt0.y = ptCenter.y - xa * sinx; |
| | | lineResult.pt1.x = 2 * ptCenter.x - lineResult.pt0.x; |
| | | lineResult.pt1.y = 2 * ptCenter.y - lineResult.pt0.y; |
| | | return lineResult; |
| | | } |
| | | |
| | | int CDistDotProcess::Serialized(void* pBuffer, int size) { |
| | | /* code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | int useSize = 0; |
| | | int nRet = 0; |
| | | |
| | | #if 0 |
| | | //1. ä¿åIDååç§° |
| | | int iValue = (int)(m_eDir); |
| | | SERIALIZER_INT_32(iValue, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_id, pTemp, remainSize, useSize); |
| | | std::string strName(CT2A(m_strName.GetString())); |
| | | SERIALIZER_STRING(strName, pTemp, remainSize, useSize); |
| | | |
| | | //2. ä¿ååºåèå´ |
| | | SERIALIZER_DOUBLE(m_xPos, pTemp, remainSize, useSize); |
| | | SERIALIZER_DOUBLE(m_yPos, pTemp, remainSize, useSize); |
| | | |
| | | SERIALIZER_DOUBLE(m_cx, pTemp, remainSize, useSize); |
| | | SERIALIZER_DOUBLE(m_cy, pTemp, remainSize, useSize); |
| | | SERIALIZER_DOUBLE(m_angle, pTemp, remainSize, useSize); |
| | | SERIALIZER_DOUBLE(m_len1, pTemp, remainSize, useSize); |
| | | SERIALIZER_DOUBLE(m_len2, pTemp, remainSize, useSize); |
| | | |
| | | SERIALIZER_INT_32(m_idxRefer, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_nRef, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_nRef_, pTemp, remainSize, useSize); |
| | | |
| | | SERIALIZER_INT_32(m_distMode, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_minValue, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_maxValue, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_ngType, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_incValue, pTemp, remainSize, useSize); |
| | | |
| | | SERIALIZER_INT_32(m_distMode2, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_minValue2, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_maxValue2, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_ngType2, pTemp, remainSize, useSize); |
| | | SERIALIZER_INT_32(m_incValue2, pTemp, remainSize, useSize); |
| | | #endif |
| | | |
| | | return useSize; |
| | | } |
| | | |
| | | int CDistDotProcess::Deserialized(void* pBuffer, int size) { |
| | | /* code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | int useSize = 0; |
| | | int nRet = 0; |
| | | |
| | | #if 0 |
| | | //1. ä¿åIDååç§° |
| | | int iValue = 0; |
| | | DESERIALIZER_INT_32(iValue, pTemp, remainSize, useSize); |
| | | m_eDir = (DimensionDir)(iValue); |
| | | DESERIALIZER_INT_32(m_id, pTemp, remainSize, useSize); |
| | | std::string strName; |
| | | DESERIALIZER_STRING(strName, pTemp, remainSize, useSize); |
| | | m_strName = CA2T(strName.c_str()); |
| | | |
| | | //2. ä¿ååºåèå´ |
| | | DESERIALIZER_DOUBLE(m_xPos, pTemp, remainSize, useSize); |
| | | DESERIALIZER_DOUBLE(m_yPos, pTemp, remainSize, useSize); |
| | | |
| | | DESERIALIZER_DOUBLE(m_cx, pTemp, remainSize, useSize); |
| | | DESERIALIZER_DOUBLE(m_cy, pTemp, remainSize, useSize); |
| | | DESERIALIZER_DOUBLE(m_angle, pTemp, remainSize, useSize); |
| | | DESERIALIZER_DOUBLE(m_len1, pTemp, remainSize, useSize); |
| | | DESERIALIZER_DOUBLE(m_len2, pTemp, remainSize, useSize); |
| | | |
| | | DESERIALIZER_INT_32(m_idxRefer, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_nRef, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_nRef_, pTemp, remainSize, useSize); |
| | | |
| | | DESERIALIZER_INT_32(m_distMode, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_minValue, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_maxValue, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_ngType, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_incValue, pTemp, remainSize, useSize); |
| | | |
| | | DESERIALIZER_INT_32(m_distMode2, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_minValue2, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_maxValue2, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_ngType2, pTemp, remainSize, useSize); |
| | | DESERIALIZER_INT_32(m_incValue2, pTemp, remainSize, useSize); |
| | | |
| | | if (m_xPos <= 0.001 && m_yPos <= 0.001) { |
| | | HalconCpp::GenEmptyObj(&m_hRegion); |
| | | } |
| | | else { |
| | | HalconCpp::GenCircle(&m_hRegion, m_yPos, m_xPos, 25); |
| | | } |
| | | |
| | | if (m_len1 < 0.01 || m_len2 < 0.01) { |
| | | HalconCpp::GenEmptyObj(&m_hRegion); |
| | | } |
| | | else { |
| | | HalconCpp::GenRectangle2(&m_hLineRegion, m_cy, m_cx, ClsVision::DegreeToRad(m_angle), m_len1, m_len2); |
| | | } |
| | | #endif |
| | | |
| | | return useSize; |
| | | } |
| | | |
| | | void CDistDotProcess::setRoiRegion(HalconCpp::HObject &hRegion) { |
| | | /* code */ |
| | | m_xPos = 0.0f; |
| | | m_yPos = 0.0f; |
| | | if (!ClsVision::RegionExist(hRegion)){ |
| | | HalconCpp::GenEmptyObj(&m_hRegion); |
| | | return; |
| | | } |
| | | |
| | | int nArea = 0; |
| | | ClsVision::AreaCenter(hRegion, nArea, m_xPos, m_yPos); |
| | | m_hRegion = hRegion; |
| | | } |
| | | |
| | | void CDistDotProcess::setLineRegion(HalconCpp::HObject &hRegion) { |
| | | /* code */ |
| | | m_cx = 0.0f; |
| | | m_cy = 0.0f; |
| | | m_angle = 0.0f; |
| | | m_len1 = 0.0f; |
| | | m_len2 = 0.0f; |
| | | if (!ClsVision::RegionExist(hRegion)) { |
| | | HalconCpp::GenEmptyObj(&m_hLineRegion); |
| | | return; |
| | | } |
| | | |
| | | ClsVision::SmallestRectangle2(hRegion, m_cx, m_cy, m_angle, m_len1, m_len2); |
| | | m_hLineRegion = hRegion; |
| | | } |
| | | |
| | | Point2I CDistDotProcess::getPose(void) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = (int)(m_cx); |
| | | result.y = (int)(m_cy); |
| | | return result; |
| | | } |
| | | |
| | | void CDistDotProcess::setPoint(Point2I pt, int nType) { |
| | | /* code */ |
| | | if (0 == nType) { |
| | | m_topMark = pt; |
| | | } |
| | | else if (1 == nType) { |
| | | m_botMark = pt; |
| | | } |
| | | else if (2 == nType) { |
| | | m_topPoint = pt; |
| | | } |
| | | else if (3 == nType) { |
| | | m_botPoint = pt; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef DIST_DOT_PROCESS |
| | | #define DIST_DOT_PROCESS |
| | | |
| | | class CDistDotProcess |
| | | { |
| | | public: |
| | | CDistDotProcess(); |
| | | CDistDotProcess(DimensionDir eDir, int id); |
| | | ~CDistDotProcess(); |
| | | |
| | | public: |
| | | //1. get id |
| | | int getID(void); |
| | | |
| | | //2. æ§è¡æ£æµ |
| | | int Execute(DimensionDir eDir, MeasureInfo inf, Point2I offset); |
| | | |
| | | //3. åºåååæ°åååºåå·åæ° |
| | | int Serialized(void* pBuffer, int size); |
| | | int Deserialized(void* pBuffer, int size); |
| | | |
| | | //4. 设置ROIåºå |
| | | void setRoiRegion(HalconCpp::HObject &hRegion); |
| | | |
| | | //5. 设置æµéç´çº¿ |
| | | void setLineRegion(HalconCpp::HObject &hRegion); |
| | | |
| | | //6. è·åä½ç½® |
| | | Point2I getPose(void); |
| | | |
| | | //7. 设置ä½ç½® |
| | | void setPoint(Point2I pt, int nType); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; // |
| | | CString m_strName; //Name |
| | | int m_idxRefer; //index |
| | | int m_nRef; //Pos+ |
| | | int m_nRef_; //Pos- |
| | | |
| | | int m_distMode; |
| | | int m_minValue; |
| | | int m_maxValue; |
| | | int m_ngType; |
| | | int m_incValue; |
| | | |
| | | int m_distMode2; |
| | | int m_minValue2; |
| | | int m_maxValue2; |
| | | int m_ngType2; |
| | | int m_incValue2; |
| | | |
| | | Point2D m_ptMeasureResult; |
| | | Point2D m_ptNearResult; |
| | | Point2D m_ptMatchResult; |
| | | Point2I m_locPointResult; |
| | | |
| | | HalconCpp::HObject m_hRegion; |
| | | HalconCpp::HObject m_hLineRegion; |
| | | |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | |
| | | private: |
| | | int m_id; //ID |
| | | |
| | | double m_xPos; |
| | | double m_yPos; |
| | | |
| | | double m_cx; |
| | | double m_cy; |
| | | double m_angle; |
| | | double m_len1; |
| | | double m_len2; |
| | | |
| | | double m_xMmvsp; |
| | | double m_yMmvsp; |
| | | Point2I m_topPoint; |
| | | Point2I m_botPoint; |
| | | Point2I m_topMark; |
| | | Point2I m_botMark; |
| | | |
| | | private: |
| | | //1. æ¥æ¾æ¥æ¾ |
| | | int findPairEdge(DimensionDir eDir, MeasureInfo infMeasure, Point2I offset); |
| | | |
| | | //2. åæåºå |
| | | Line2D GetTargeLine(void); |
| | | |
| | | //3. è·åç®æ ç¹çä½ç½® |
| | | int getKeyPose(Point2I offset); |
| | | |
| | | //4. ç»æå¤æ |
| | | void JudgeResult(void); |
| | | |
| | | //5. æ£æµç¬¬ä¸ä¸ªå¤æ |
| | | void JudgeFirstResult(void); |
| | | |
| | | //6. æ£æµç¬¬äºä¸ªç¼ºé· |
| | | void JudgeSecondResult(void); |
| | | |
| | | //7. è·åå辨ç |
| | | void getMmvsp(DimensionDir eDir); |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef EI_VISION_TYPE |
| | | #define EI_VISION_TYPE |
| | | |
| | | enum VISION_RECIPE_TYPE { |
| | | LOC_VISION_TYPE = 0, |
| | | LOC_VISION_PROCESS, |
| | | GRIND_VISION_TYPE, |
| | | GRIND_VISION_PROCESS, |
| | | CUT_VISION_TYPE, |
| | | CUT_VISION_PROCESS, |
| | | KDIST_VISION_TYPE, |
| | | KDIST_VISION_PROCESS, |
| | | RCUT_VISION_TYPE, |
| | | RCUT_VISION_PROCESS, |
| | | THRES_VISION_TYPE, |
| | | THRES_VISION_PROCESS, |
| | | HOLE_VISION_TYPE, |
| | | HOLE_VISION_PROCESS |
| | | }; |
| | | |
| | | enum VISION_TYPE { |
| | | VISION_LOC = 0, //DISTç®æ³ |
| | | VISION_CUT, //CUTè·ç¦» |
| | | VISION_GRIND, |
| | | VISION_KDIST, |
| | | VISION_RCUT, //RCUTç®æ³ |
| | | VISION_THRES, |
| | | VISION_HOLE, |
| | | VISION_NONE }; |
| | | |
| | | #define NG_INF_NUM 1000 |
| | | |
| | | enum DefectNgLoc { |
| | | DefectLoc_OK = 0, //OK |
| | | DefectLoc_Chip, //Chip |
| | | DefectLoc_Broken, //ç ´æ |
| | | DefectLoc_Grind, //ç 磨 |
| | | DefectLoc_Dist_Cut, //åå²ç²¾åº¦ |
| | | DefectLoc_Corner_Dist, //è§ç²¾åº¦ |
| | | DefectLoc_HOLE, //Hole |
| | | DefectLoc_Unknown //æé误 |
| | | }; |
| | | |
| | | static UINT _gGridFixCellColor = RGB(144, 200, 246); |
| | | static UINT _gGridFixFontColor = RGB(0, 0, 0); |
| | | static UINT _gGridCellColor = RGB(255, 255, 255); |
| | | static UINT _gGridCellColor_NonSelect = RGB(150, 150, 150); |
| | | static UINT _gGridCellReadyColor = RGB(255, 255, 0); |
| | | static UINT _gGridCellOnColor = RGB(255, 69, 0); |
| | | static UINT _gGridCellOffColor = RGB(128, 191, 255); |
| | | static UINT _gPropertyGridFixCellColor = RGB(150, 150, 150); |
| | | static UINT _gPropertyGridFixFontColor = RGB(0, 0, 0); |
| | | static UINT _gSequenceOffColor = RGB(0, 0, 0); |
| | | static UINT _gSequenceOnColor = RGB(0, 180, 0); |
| | | |
| | | typedef struct _NgDotInfo |
| | | { |
| | | int eDir; //æ£æµé¢ |
| | | int id; //æ£æµID |
| | | CString strName; //åç§° |
| | | int xPosPxl; //Xä½ç½® |
| | | int yPosPxl; //Yä½ç½® |
| | | double result; //ç»æ |
| | | double xResult; //Xç»æ |
| | | double yResult; //Yç»æ |
| | | double minValue; //ä¸é |
| | | double maxValue; //éå¶ |
| | | bool isRes; //æ£æµç»æ |
| | | int x1; //缺é·çæå°ç©å½¢ |
| | | int y1; //缺é·çæå°ç©å½¢ |
| | | int x2; //缺é·çæå°ç©å½¢ |
| | | int y2; //缺é·çæå°ç©å½¢ |
| | | int ngType; //缺é·ç±»å |
| | | int eVision; //è§è§ç®æ³ |
| | | }NgDotInfo; |
| | | |
| | | typedef struct _MeasureInfo |
| | | { |
| | | int idxRefer; |
| | | int typePoint; |
| | | int modePoint; |
| | | int pointThres; |
| | | int modeNear; |
| | | int nearThres; |
| | | }MeasureInfo; |
| | | |
| | | typedef struct _ScanSetting |
| | | { |
| | | int lengthSize; |
| | | int shortSize; |
| | | int nStdIndex; |
| | | int nIndex0; |
| | | int nIndex1; |
| | | int nIndex2; |
| | | int nIndex3; |
| | | int nLengthScan; |
| | | int nShortScan; |
| | | }ScanSetting; |
| | | |
| | | typedef struct _VisionDisplayInfo |
| | | { |
| | | bool isVisionDisplay; |
| | | bool isGrindDisplay; |
| | | bool isDistDisplay; |
| | | bool isCutDisplay; |
| | | bool isRcutDisplay; |
| | | bool isThresDisplay; |
| | | bool isHoleDisplay; |
| | | }VisionDisplayInfo; |
| | | |
| | | typedef struct _VisionUseInfo |
| | | { |
| | | bool isVisionUse; //è§è§ |
| | | bool isLocUse; //å®ä½ |
| | | bool isDistUse; //è·ç¦» |
| | | bool isCutUse; //åå²çº¿ |
| | | bool isGrindUse; //ç 磨é |
| | | bool isRcutUse; //RCUT |
| | | bool isThresUse; //Thres |
| | | bool isHoleUse; //Hole |
| | | }VisionUseInfo; |
| | | |
| | | typedef struct _DistIncInfo |
| | | { |
| | | int incGrind; |
| | | int incTop; |
| | | int incBot; |
| | | int incKey; |
| | | int incCut; |
| | | }DistIncInfo; |
| | | |
| | | typedef struct _DispResultObject |
| | | { |
| | | HalconCpp::HObject hDispRegion; |
| | | HalconCpp::HObject hDispObject; |
| | | }DispResultObject; |
| | | |
| | | typedef struct _KeyDebugInfo |
| | | { |
| | | bool isDebugTool; |
| | | bool isInspectKey; |
| | | bool isLocKey; |
| | | bool isGrindKey; |
| | | bool isCutLineKey; |
| | | bool isDistKey; |
| | | bool isRcutKey; |
| | | }KeyDebugInfo; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include <io.h> |
| | | #include "FileRecipe.h" |
| | | #include <time.h> |
| | | #include <stdarg.h> |
| | | #include <direct.h> |
| | | #include <vector> |
| | | #include <Dbghelp.h> |
| | | #pragma comment(lib,"Dbghelp.lib") |
| | | |
| | | CFileRecipe::CFileRecipe() |
| | | { |
| | | } |
| | | |
| | | CFileRecipe::~CFileRecipe() |
| | | { |
| | | } |
| | | |
| | | bool CFileRecipe::fileIsExist(std::string fileName) { |
| | | /* code */ |
| | | if (-1 != _access(fileName.c_str(), 0)) return true; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | void CFileRecipe::removeDir(std::string dirPath) { |
| | | /* code */ |
| | | struct _finddata_t fb; // æ¥æ¾ç¸å屿§æä»¶çåå¨ç»æä½ |
| | | string path; |
| | | long long handle; // æ³¨ææ¤å¤éè¦long*2 |
| | | int noFile; // 对系ç»éèæä»¶çå¤çæ è®° |
| | | |
| | | noFile = 0; |
| | | handle = 0; |
| | | |
| | | struct stat s; |
| | | if (stat(dirPath.c_str(), &s) == 0) { |
| | | if (s.st_mode & S_IFDIR) { |
| | | std::cout << "it's a directory" << std::endl; |
| | | } |
| | | else if (s.st_mode & S_IFREG) { |
| | | std::cout << "it's a file" << std::endl; |
| | | } |
| | | else { |
| | | std::cout << "not file not directory" << std::endl; |
| | | } |
| | | } |
| | | else { |
| | | std::cout << "error, doesn't exist" << std::endl; |
| | | return; |
| | | } |
| | | |
| | | path = dirPath + "/*"; |
| | | |
| | | handle = _findfirst(path.c_str(), &fb); |
| | | // æ¾å°ç¬¬ä¸ä¸ªå¹é
çæä»¶ |
| | | if (handle != 0){ |
| | | // å½å¯ä»¥ç»§ç»æ¾å°å¹é
çæä»¶ï¼ç»§ç»æ§è¡ |
| | | while (0 == _findnext(handle, &fb)){ |
| | | // windowsä¸ï¼å¸¸æä¸ªç³»ç»æä»¶ï¼å为â..â,对å®ä¸åå¤ç |
| | | noFile = strcmp(fb.name, ".."); |
| | | |
| | | if (0 != noFile){ |
| | | path = dirPath + "/" + fb.name; |
| | | |
| | | // 屿§å¼ä¸º16ï¼åè¯´ææ¯æä»¶å¤¹ï¼è¿ä»£ |
| | | if (fb.attrib == 16){ |
| | | removeDir(path); |
| | | } |
| | | // éæä»¶å¤¹çæä»¶ï¼ç´æ¥å é¤ã对æä»¶å±æ§å¼çæ
嵿²¡å详ç»è°æ¥ï¼å¯è½è¿æå
¶ä»æ
åµã |
| | | else{ |
| | | remove(path.c_str()); |
| | | } |
| | | } |
| | | } |
| | | //å é¤ç©ºç®å½ |
| | | // _rmdir(dirPath.c_str()); |
| | | // å
³éæä»¶å¤¹ï¼åªæå
³éäºæè½å é¤ãæ¾è¿ä¸ªå½æ°æ¾äºå¾ä¹
ï¼æ åcä¸ç¨çæ¯closedir |
| | | // ç»éªä»ç»ï¼ä¸è¬äº§çHandleç彿°æ§è¡åï¼é½è¦è¿è¡å
³éçå¨ä½ã |
| | | _findclose(handle); |
| | | } |
| | | } |
| | | |
| | | void CFileRecipe::makeDir(std::string dirName) { |
| | | /* code */ |
| | | MakeSureDirectoryPathExists(dirName.c_str()); |
| | | } |
| | | |
| | | bool CFileRecipe::openRecipeFile(CStdioFile &fileRecipe, CString fileName) { |
| | | /* code */ |
| | | if (!fileRecipe.Open(fileName, CFile::modeCreate | CFile::modeReadWrite)) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool CFileRecipe::readRecileFile(CStdioFile &fileRecipe, CString fileName) { |
| | | /* code */ |
| | | if (!fileRecipe.Open(fileName, CFile::modeRead)) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | CString CFileRecipe::toCString(std::string str) { |
| | | /* code */ |
| | | CString strRes = CA2T(str.c_str()); |
| | | return strRes; |
| | | } |
| | | |
| | | std::string CFileRecipe::toString(CString str) { |
| | | /* code */ |
| | | std::string strRes(CT2A(str.GetString())); |
| | | return strRes; |
| | | } |
| | | |
| | | void CFileRecipe::WriteString(CStdioFile &fileRecipe, std::string strText) { |
| | | /* code */ |
| | | CString str = toCString(strText); |
| | | fileRecipe.WriteString(str); |
| | | } |
| | | |
| | | void CFileRecipe::WriteCString(CStdioFile &fileRecipe, CString strText) { |
| | | /* code */ |
| | | fileRecipe.WriteString(strText); |
| | | } |
| | | |
| | | BOOL CFileRecipe::ReadString(CStdioFile &fileRecipe, CString &strRes) { |
| | | /* code */ |
| | | return fileRecipe.ReadString(strRes); |
| | | } |
| | | |
| | | void StringTrim(std::string& s) { |
| | | /* code */ |
| | | if (!s.empty()) { |
| | | s.erase(0, s.find_first_not_of(" ")); |
| | | s.erase(s.find_last_not_of(" ") + 1); |
| | | } |
| | | } |
| | | |
| | | int CFileRecipe::StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings) { |
| | | /* code */ |
| | | strings.clear(); |
| | | size_t pos = 0; |
| | | size_t len = strScr.length(); |
| | | size_t delim_len = delim.length(); |
| | | if (delim_len == 0) { |
| | | return 0; |
| | | } |
| | | |
| | | while (pos < len) { |
| | | size_t find_pos = strScr.find(delim, pos); |
| | | if (find_pos == strScr.npos) { |
| | | std::string str2 = strScr.substr(pos, len - pos); |
| | | StringTrim(str2); |
| | | strings.push_back(str2); |
| | | break; |
| | | } |
| | | |
| | | std::string str2 = strScr.substr(pos, find_pos - pos); |
| | | StringTrim(str2); |
| | | strings.push_back(str2); |
| | | pos = find_pos + delim_len; |
| | | } |
| | | |
| | | return (int)strings.size(); |
| | | } |
| | | |
| | | int CFileRecipe::CStringSplit(const CString& strText, const std::string& delim, std::vector<std::string>& strings) { |
| | | /* code */ |
| | | std::string str = toString(strText); |
| | | return StringSplit(str, delim, strings); |
| | | } |
| | | |
| | | int CFileRecipe::CStringToInt(CString strText) { |
| | | /* code */ |
| | | int result = _wtoi(strText); |
| | | return result; |
| | | } |
| | | |
| | | int CFileRecipe::StringToInt(std::string str) { |
| | | /* code */ |
| | | CString strText = toCString(str); |
| | | return CStringToInt(strText); |
| | | } |
| | | |
| | | double CFileRecipe::CStringToF(CString strText) { |
| | | /* code */ |
| | | double result = _wtof(strText); |
| | | return result; |
| | | } |
| | | |
| | | double CFileRecipe::StringToF(std::string str) { |
| | | /* code */ |
| | | CString strText = toCString(str); |
| | | return CStringToF(strText); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef FILE_RECIPE_H |
| | | #define FILE_RECIPE_H |
| | | |
| | | #include "LocProcess.h" |
| | | |
| | | class CFileRecipe |
| | | { |
| | | public: |
| | | CFileRecipe(); |
| | | ~CFileRecipe(); |
| | | |
| | | public: |
| | | //1. æä»¶æ¯å¦åå¨ |
| | | static bool fileIsExist(std::string fileName); |
| | | |
| | | //2. å 餿件ä¸çæææä»¶ |
| | | static void removeDir(std::string dirPath); |
| | | |
| | | //3. å建ç®å½ |
| | | static void makeDir(std::string dirName); |
| | | |
| | | //4. æå¼åå建CSVæä»¶ |
| | | static bool openRecipeFile(CStdioFile &fileRecipe, CString fileName); |
| | | static bool readRecileFile(CStdioFile &fileRecipe, CString fileName); |
| | | |
| | | //5. æ ¼å¼è½¬æ¢ |
| | | static CString toCString(std::string str); |
| | | |
| | | //6. æ ¼å¼è½¬æ¢ |
| | | static std::string toString(CString str); |
| | | |
| | | //7. åå
¥CSVæä»¶ |
| | | static void WriteString(CStdioFile &fileRecipe, std::string strText); |
| | | static void WriteCString(CStdioFile &fileRecipe, CString strText); |
| | | |
| | | //8. 读åæä»¶ |
| | | static BOOL ReadString(CStdioFile &fileRecipe, CString &strRes); |
| | | //9. å符åå² |
| | | static int StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings); |
| | | static int CStringSplit(const CString& strText, const std::string& delim, std::vector<std::string>& strings); |
| | | |
| | | //10. æ°æ®è½¬æ¢ |
| | | static int CStringToInt(CString strText); |
| | | static int StringToInt(std::string str); |
| | | static double CStringToF(CString strText); |
| | | static double StringToF(std::string str); |
| | | |
| | | private: |
| | | |
| | | }; |
| | | |
| | | #endif |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "GrindDotProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CGrindDotProcess::CGrindDotProcess() |
| | | { |
| | | /* code */ |
| | | m_poseType = 0; |
| | | m_eDir = DIMENSION_NONE; |
| | | m_id = 0; |
| | | |
| | | m_nUse = 0; |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | |
| | | m_nPosY = 0; |
| | | |
| | | m_nInc = 0; |
| | | m_nMin = 0; |
| | | m_nMax = 0; |
| | | m_distResult = 0.0f; |
| | | |
| | | m_nEdgeThres = 20; |
| | | m_nLeftLineDist = 0; |
| | | } |
| | | |
| | | CGrindDotProcess::CGrindDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_poseType = 0; |
| | | m_eDir = eDir; |
| | | m_id = id; |
| | | m_nLeftLineDist = 0; |
| | | |
| | | m_nUse = 0; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD_G%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P_G%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P_G%d"), m_id); |
| | | break; |
| | | } |
| | | |
| | | m_nPosY = 0; |
| | | |
| | | m_nInc = 0; |
| | | m_nMin = 0; |
| | | m_nMax = 0; |
| | | m_distResult = 0.0f; |
| | | m_nEdgeThres = 20; |
| | | } |
| | | |
| | | CGrindDotProcess::~CGrindDotProcess(){ |
| | | /* code */ |
| | | } |
| | | |
| | | int CGrindDotProcess::Execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | m_ptNearResult.x = 0.0f; |
| | | m_ptNearResult.y = 0.0f; |
| | | m_ptMeasureResult.x = 0.0f; |
| | | m_ptMeasureResult.y = 0.0f; |
| | | m_ptLeftResult.x = 0; |
| | | m_ptLeftResult.y = 0; |
| | | m_leftLineResult = 0; |
| | | if (1 != m_nUse) return 0; |
| | | if (0 == m_nLeftLineDist) return 0; |
| | | |
| | | //1. è·åè§£é度 |
| | | getMmvsp(eDir); |
| | | |
| | | //2. æ¥æ¾left |
| | | if (!FindLeftLine(eDir, offset)) return -1; |
| | | |
| | | //3. ç»æå¤æ |
| | | judgeResult(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | bool CGrindDotProcess::FindLeftLine(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return false; |
| | | if (0 == m_poseType) { |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | } |
| | | else { |
| | | if (!pSideData->m_bTopPoint_Find) return false; |
| | | if (!pSideData->m_bBotPoint_Find) return false; |
| | | } |
| | | |
| | | Point2I ptOffset; |
| | | ptOffset.x = m_nLeftLineDist; |
| | | ptOffset.y = m_nPosY; |
| | | Point2I result; |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result)) return false; |
| | | m_locPointResult = result; |
| | | |
| | | int x1 = result.x - 200; |
| | | int y1 = result.y - 31; |
| | | int x2 = result.x + 200; |
| | | int y2 = result.y + 31; |
| | | Point2I leftTop; |
| | | leftTop.x = x1; |
| | | leftTop.y = y1; |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return false; |
| | | |
| | | HalconCpp::HObject hMeanImage; |
| | | HalconCpp::MeanImage(hImage, &hMeanImage, 1, 20); |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 10 || height < 25) return false; |
| | | |
| | | Line2D line; |
| | | line.pt0.x = 5; |
| | | line.pt0.y = 0.5 * height - 1; |
| | | line.pt1.x = width - 6; |
| | | line.pt1.y = 0.5 * height - 1; |
| | | Point2D ptStart, ptEnd; |
| | | if (!CVisionBufferPro::GetMeasureNearPos(hMeanImage, line, m_nEdgeThres, 0, 10, ptStart, ptEnd)) return false; |
| | | |
| | | m_ptMeasureResult = ptStart; |
| | | m_ptMeasureResult.x += leftTop.x; |
| | | m_ptMeasureResult.y += leftTop.y; |
| | | m_ptNearResult = ptEnd; |
| | | m_ptNearResult.x += leftTop.x; |
| | | m_ptNearResult.y += leftTop.y; |
| | | |
| | | m_ptLeftResult.x = (int)(m_ptMeasureResult.x); |
| | | m_ptLeftResult.y = (int)(m_ptMeasureResult.y); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | void CGrindDotProcess::setLeftLine(int nLeftDist, int leftThres) { |
| | | /* code */ |
| | | m_nLeftLineDist = nLeftDist; |
| | | m_nLeftThres = leftThres; |
| | | } |
| | | |
| | | int CGrindDotProcess::getID(void) { |
| | | /* code */ |
| | | return m_id; |
| | | } |
| | | |
| | | void CGrindDotProcess::getMmvsp(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | m_xMmvsp = pSideData->m_dPixelSizeX; |
| | | m_yMmvsp = pSideData->m_dPixelSizeY; |
| | | } |
| | | |
| | | void CGrindDotProcess::judgeResult(void) { |
| | | /* code */ |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return; |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | //1. è¾åºè¾¹çç¹1 |
| | | DispVisionResult inf; |
| | | inf.nType = 0; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_GRIND); |
| | | inf.pointX = (int)(m_ptMeasureResult.x); |
| | | inf.pointY = (int)(m_ptMeasureResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | |
| | | //2. è¾åºç´çº¿ |
| | | inf.nType = 3; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_GRIND); |
| | | inf.rectX1 = (int)(m_ptMeasureResult.x); |
| | | inf.rectY1 = (int)(m_ptMeasureResult.y); |
| | | inf.rectX2 = (int)(m_ptNearResult.x); |
| | | inf.rectY2 = (int)(m_ptNearResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | |
| | | //4. è¾åºä½ç½® |
| | | inf.nType = 4; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_GRIND); |
| | | inf.pointX = (int)(m_ptMeasureResult.x); |
| | | inf.pointY = (int)(m_ptMeasureResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | m_nNgInfo.clear(); |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = true; |
| | | ng.minValue = m_nMin; |
| | | ng.maxValue = m_nMax; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_OK; //缺é·ç±»å |
| | | ng.eVision = VISION_KDIST; |
| | | |
| | | ng.xPosPxl = m_locPointResult.x; |
| | | ng.yPosPxl = m_locPointResult.y; |
| | | ng.xResult = 0.0f; |
| | | ng.yResult = 0.0f; |
| | | ng.x1 = m_locPointResult.x - 40; |
| | | ng.y1 = m_locPointResult.y - 20; |
| | | ng.x2 = m_locPointResult.x + 40; |
| | | ng.y2 = m_locPointResult.y + 20; |
| | | |
| | | ng.ngType = DefectLoc_Grind; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y); |
| | | m_distResult = sqrt(dx * dx + dy * dy); |
| | | m_distResult += m_nInc; |
| | | ng.result = m_distResult; |
| | | |
| | | if (m_nMax < 0.5) { |
| | | m_nNgInfo.push_back(ng); |
| | | return; |
| | | } |
| | | |
| | | if (ng.result < m_nMin || ng.result > m_nMax) { |
| | | ng.isRes = false; |
| | | } |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | |
| | | Json::Value CGrindDotProcess::WriteToJson(void) { |
| | | /* code */ |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = GRIND_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["use"] = m_nUse; |
| | | jsValue["pos y"] = m_nPosY; |
| | | jsValue["end Thres"] = m_nEdgeThres; |
| | | jsValue["inc"] = m_nInc; |
| | | jsValue["min"] = m_nMin; |
| | | jsValue["max"] = m_nMax; |
| | | jsValue["pos type"] = m_poseType; |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CGrindDotProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nUse = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //7. pos y |
| | | strName = "pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPosY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //8. end Thres |
| | | strName = "end Thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nEdgeThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //9. inc |
| | | strName = "inc"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nInc = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //10. min |
| | | strName = "min"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nMin = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //11. max |
| | | strName = "max"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nMax = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //12. pos type |
| | | strName = "pos type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_poseType = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef GRIND_DOT_PROCESS_H |
| | | #define GRIND_DOT_PROCESS_H |
| | | |
| | | #include "IncludeVision.h" |
| | | |
| | | class CGrindDotProcess |
| | | { |
| | | public: |
| | | CGrindDotProcess(); |
| | | CGrindDotProcess(DimensionDir eDir, int id); |
| | | ~CGrindDotProcess(); |
| | | |
| | | public: |
| | | //1. 设置æµé |
| | | void setLeftLine(int nLeftDist, int leftThres); |
| | | |
| | | //2. æ§è¡ |
| | | int Execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | //3. è·åID |
| | | int getID(void); |
| | | |
| | | //6. ä¿åæ°æ® |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | public: |
| | | int m_nUse; |
| | | CString m_strName; |
| | | |
| | | int m_poseType; //ä½ç½®ä¿¡æ¯ |
| | | int m_nPosY; //Yæ¹åçè·ç¦» |
| | | |
| | | int m_nLeftThres; //左边ç亮度éå¼ |
| | | int m_nLeftLineDist; //左边ççè·ç¦» |
| | | int m_nEdgeThres; //ç 磨边éå¼ |
| | | // int m_nLineWidth; //åæè·ç¦» |
| | | |
| | | int m_nInc; //INCè¡¥å¿å¼ |
| | | int m_nMin; //å¤å®éå¼ |
| | | int m_nMax; //å¤å®éå¼ |
| | | |
| | | Point2D m_ptMeasureResult; |
| | | Point2D m_ptNearResult; |
| | | Point2I m_locPointResult; |
| | | |
| | | Point2I m_ptLeftResult; //左边ççç¹ |
| | | double m_distResult; |
| | | int m_leftLineResult; |
| | | |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | int m_id; |
| | | |
| | | double m_xMmvsp; |
| | | double m_yMmvsp; |
| | | |
| | | private: |
| | | //1. è·åå辨ç |
| | | void getMmvsp(DimensionDir eDir); |
| | | |
| | | //2. å¤æç»æ |
| | | void judgeResult(void); |
| | | |
| | | //3. æ¥æ¾è¾¹ç |
| | | bool FindLeftLine(DimensionDir eDir, Point2I offset); |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "GrindProcess.h" |
| | | #include "BlSideData.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CGrindProcess::CGrindProcess() { |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | for (int i = 0; i < 50; i++) { |
| | | m_dots[i] = new CGrindDotProcess(m_eDir, i + 1); |
| | | } |
| | | m_isUse = false; |
| | | |
| | | m_nLeftLineDist = 0; |
| | | m_nLeftThres = 20; |
| | | } |
| | | |
| | | CGrindProcess::CGrindProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_isUse = false; |
| | | m_nLeftLineDist = 0; |
| | | m_nLeftThres = 20; |
| | | for (int i = 0; i < 50; i++) { |
| | | m_dots[i] = new CGrindDotProcess(m_eDir, i + 1); |
| | | } |
| | | |
| | | } |
| | | |
| | | CGrindProcess::~CGrindProcess() { |
| | | /* code */ |
| | | for (int i = 0; i < 50; i++) { |
| | | CGrindDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dots[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | void CGrindProcess::Execute(DimensionDir eDir) { |
| | | /* code */ |
| | | if (!m_isUse) return; |
| | | |
| | | MeasureInfo m_info; |
| | | |
| | | m_info.idxRefer = 10; |
| | | m_info.modePoint = 0; |
| | | m_info.modeNear = 0; |
| | | m_info.typePoint = 0; |
| | | m_info.pointThres = 15; |
| | | m_info.nearThres = 30; |
| | | |
| | | Point2I offset; |
| | | for (int i = 0; i < 50; i++) { |
| | | CGrindDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | if (1 != dot->m_nUse) continue; |
| | | |
| | | offset.x = i; |
| | | offset.y = i; |
| | | |
| | | dot->setLeftLine(m_nLeftLineDist, m_nLeftThres); |
| | | dot->Execute(m_eDir, offset); |
| | | } |
| | | } |
| | | |
| | | Json::Value CGrindProcess::WriteToJson(void) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["type"] = GRIND_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["use"] = m_isUse; |
| | | jsValue["toMark"] = m_nLeftLineDist; |
| | | jsValue["leftThres"] = m_nLeftThres; |
| | | |
| | | for (int i = 0; i < 50; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dots[i]->WriteToJson(); |
| | | } |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CGrindProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)jsValue.size(); |
| | | if (num < 1) return; |
| | | |
| | | //1. Side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) { |
| | | m_isUse = jsValue[strName.c_str()].asBool(); |
| | | } |
| | | |
| | | //3. idxRefer |
| | | strName = "toMark"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nLeftLineDist = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //4. typePoint |
| | | strName = "leftThres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nLeftThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | for (int i = 0; i < 50; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dots[i]->DecodeJson(jsData); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef GRIND_PROCESS_H |
| | | #define GRIND_PROCESS_H |
| | | |
| | | #include "GrindDotProcess.h" |
| | | |
| | | class CGrindProcess |
| | | { |
| | | public: |
| | | CGrindProcess(); |
| | | CGrindProcess(DimensionDir eDir); |
| | | ~CGrindProcess(); |
| | | |
| | | public: |
| | | bool m_isUse; //æ¯å¦å¯ç¨ |
| | | DimensionDir m_eDir; |
| | | int m_nLeftLineDist; |
| | | int m_nLeftThres; |
| | | |
| | | CGrindDotProcess *m_dots[50]; |
| | | |
| | | public: |
| | | //1. æ§è¡æ£æµ |
| | | void Execute(DimensionDir eDir); |
| | | |
| | | //2. ä¿åæä»¶ |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "HoleDotProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CHoleDotProcess::CHoleDotProcess(){ |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | m_id = 0; |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | m_nUse = 0; |
| | | m_nPoseType = 0; |
| | | m_nShapeType = 2; |
| | | m_nSmoothSize = 8; |
| | | m_nBrightType = 1; |
| | | m_nDefectSize = 3; |
| | | m_nThres = 45; |
| | | |
| | | |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | m_isScale = false; |
| | | m_nPoseX = 0; |
| | | m_nPoseX = 0; |
| | | m_score = 0.5f; |
| | | m_idModel = HalconCpp::HTuple(); |
| | | m_nNgInfo.clear(); |
| | | |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | HalconCpp::GenEmptyObj(&m_hImageResult); |
| | | } |
| | | |
| | | CHoleDotProcess::CHoleDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_id = id; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD_H%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P_H%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P_H%d"), m_id); |
| | | break; |
| | | } |
| | | m_nUse = 0; |
| | | m_nPoseType = 0; |
| | | m_nShapeType = 2; |
| | | m_nSmoothSize = 8; |
| | | m_nBrightType = 1; |
| | | m_nDefectSize = 3; |
| | | m_nThres = 45; |
| | | |
| | | |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | m_isScale = false; |
| | | m_nPoseX = 0; |
| | | m_nPoseX = 0; |
| | | m_score = 0.5f; |
| | | m_idModel = HalconCpp::HTuple(); |
| | | m_nNgInfo.clear(); |
| | | |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | HalconCpp::GenEmptyObj(&m_hImageResult); |
| | | } |
| | | |
| | | CHoleDotProcess::~CHoleDotProcess(){ |
| | | /* code */ |
| | | |
| | | } |
| | | |
| | | Json::Value CHoleDotProcess::WriteToJson(std::string& strDir) { |
| | | /* code */ |
| | | int iValue = 0; |
| | | if (ClsVision::ObjectExist(m_hImage)) { |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | if (width > 0 && height > 0) { |
| | | iValue = 1; |
| | | } |
| | | } |
| | | std::string strImage = "NULL"; |
| | | if (1 == iValue) { |
| | | strImage = ClsVision::FormatString("%d_%d_hole", m_eDir, m_id); |
| | | } |
| | | |
| | | Json::Value jsValue; |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | jsValue["alg type"] = HOLE_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["use"] = m_nUse; |
| | | jsValue["Pos Type"] = m_nPoseType; |
| | | jsValue["Shape Type"] = m_nShapeType; |
| | | jsValue["Bright Type"] = m_nBrightType; |
| | | jsValue["Thres"] = m_nThres; |
| | | jsValue["Smooth Size"] = m_nSmoothSize; |
| | | jsValue["Defect Size"] = m_nDefectSize; |
| | | jsValue["Pose X"] = m_nPoseX; |
| | | jsValue["Pose Y"] = m_nPoseY; |
| | | jsValue["image file"] = strImage; |
| | | |
| | | std::string imageDir = strDir + "Image\\"; |
| | | if (!CFileRecipe::fileIsExist(imageDir)) { |
| | | CFileRecipe::makeDir(imageDir); |
| | | } |
| | | if (0 == iValue) return jsValue; |
| | | |
| | | |
| | | std::string fileName = imageDir + strImage + ".jpg"; |
| | | HalconCpp::WriteImage(m_hImage, "jpeg", 0, fileName.c_str()); |
| | | return jsValue; |
| | | } |
| | | |
| | | void CHoleDotProcess::DecodeJson(std::string& strDir, Json::Value& jsValue) { |
| | | /* code */ |
| | | if (strDir.empty()) return; |
| | | |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nUse = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //5. Pose Type |
| | | strName = "Pos Type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseType = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //6. Shape Type |
| | | strName = "Shape Type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nShapeType = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //7. Bright Type |
| | | strName = "Bright Type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nBrightType = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //8. Thres |
| | | strName = "Thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //9. Smooth Size |
| | | strName = "Smooth Size"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nSmoothSize = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //10. Defect Size |
| | | strName = "Defect Size"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nDefectSize = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //11. Pose X |
| | | strName = "Pose X"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //12. Pose Y |
| | | strName = "Pose Y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //13. image file |
| | | strName = "image file"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | std::string imgFile = jsValue[strName.c_str()].asString(); |
| | | if (0 != imgFile.compare("NULL")) { |
| | | std::string fileName = strDir + "Image\\" + imgFile + ".jpg"; |
| | | if (CFileRecipe::fileIsExist(fileName)) { |
| | | HalconCpp::ReadImage(&m_hImage, fileName.c_str()); |
| | | CreateMatchModel(); |
| | | } |
| | | } |
| | | else { |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | CreateMatchModel(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int CHoleDotProcess::Execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_ptLocResult.x = 0.0f; |
| | | m_ptLocResult.y = 0.0f; |
| | | m_nNgInfo.clear(); |
| | | HalconCpp::GenEmptyObj(&m_hImageResult); |
| | | if (1 != m_nUse) return 0; |
| | | if (ClsVision::TupleNil(m_idModel)) { |
| | | CreateMatchModel(); |
| | | } |
| | | if (ClsVision::TupleNil(m_idModel)) return 0; |
| | | |
| | | //æ¥æ¾ç®æ ä½ç½®ï¼æªååæå¾å |
| | | if (!FindTargetPos(eDir, offset)) return 0; |
| | | |
| | | FindDefectInfo(); |
| | | |
| | | int nRet = (int)(m_nNgInfo.size()); |
| | | return nRet; |
| | | } |
| | | |
| | | bool CHoleDotProcess::FindDefectInfo(void) { |
| | | /* code */ |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return false; |
| | | |
| | | if (nullptr != pSideData) { |
| | | DispVisionResult inf; |
| | | inf.nType = 4; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_THRES); |
| | | inf.strName = m_strName; |
| | | inf.pointX = (int)(m_ptLocResult.x); |
| | | inf.pointY = (int)(m_ptLocResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | |
| | | int x1 = (int)(m_ptLocResult.x - 0.5 * width); |
| | | int y1 = (int)(m_ptLocResult.y - 0.5 * height); |
| | | int x2 = x1 + width - 1; |
| | | int y2 = y1 + height - 1; |
| | | |
| | | if (nullptr != pSideData) { |
| | | DispVisionResult inf; |
| | | inf.nType = 1; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_THRES); |
| | | inf.strName = m_strName; |
| | | inf.rectX1 = x1; |
| | | inf.rectY1 = y1; |
| | | inf.rectX2 = x2; |
| | | inf.rectY2 = y2; |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, m_hImageResult, x1, y1, x2, y2)) return false; |
| | | |
| | | //æ¥æ¾ç¼ºé·ä¿¡æ¯ |
| | | HalconCpp::HObject hRoiRegion; |
| | | if (0 == m_nShapeType) { |
| | | return false; |
| | | } |
| | | else if (1 == m_nShapeType) { |
| | | HalconCpp::GenRectangle1(&hRoiRegion, m_nSmoothSize, m_nSmoothSize, height - 1 - m_nSmoothSize, width - 1 - m_nSmoothSize); |
| | | } |
| | | else { |
| | | HalconCpp::GenEllipse(&hRoiRegion, 0.5 * (height-1), 0.5 * (width-1), 0, 0.5 * width - m_nSmoothSize, 0.5 * height - m_nSmoothSize); |
| | | } |
| | | |
| | | //HalconCpp::HWindow hDispWin(0, 0, width, height); |
| | | //hDispWin.SetPart(0, 0, height - 1, width - 1); |
| | | //hDispWin.DispObj(m_hImageResult); |
| | | //hDispWin.SetDraw("margin"); |
| | | //hDispWin.SetColored(6); |
| | | //hDispWin.DispObj(hRoiRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | |
| | | HalconCpp::HObject hProcImage; |
| | | HalconCpp::ReduceDomain(m_hImageResult, hRoiRegion, &hProcImage); |
| | | HalconCpp::HObject hRegion, hConnectedRegion, hSelectedRegion; |
| | | if (1 == m_nBrightType) { |
| | | HalconCpp::Threshold(hProcImage, &hRegion, 0, m_nThres); |
| | | } |
| | | else { |
| | | HalconCpp::Threshold(hProcImage, &hRegion, m_nThres, 255); |
| | | } |
| | | HalconCpp::Connection(hRegion, &hConnectedRegion); |
| | | HalconCpp::SelectShape(hConnectedRegion, &hSelectedRegion, "area", "and", 10, MAXINT); |
| | | //hDispWin.SetDraw("fill"); |
| | | //hDispWin.DispObj(hSelectedRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HTuple hvNum; |
| | | HalconCpp::CountObj(hSelectedRegion, &hvNum); |
| | | int nCount = hvNum[0].I(); |
| | | if (nCount <1) return false; |
| | | |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = false; |
| | | ng.minValue = m_nDefectSize; |
| | | ng.maxValue = m_nDefectSize; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_HOLE; //缺é·ç±»å |
| | | ng.eVision = VISION_HOLE; |
| | | |
| | | double xMmvsp = pSideData->m_dPixelSizeX; |
| | | double yMmvsp = pSideData->m_dPixelSizeY; |
| | | HalconCpp::HTuple hvArea, hvY, hvX; |
| | | HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2; |
| | | HalconCpp::AreaCenter(hSelectedRegion, &hvArea, &hvY, &hvX); |
| | | HalconCpp::SmallestRectangle1(hSelectedRegion, &hvY1, &hvX1, &hvY2, &hvX2); |
| | | for (int i = 0; i < nCount; i++) { |
| | | int wTmp = hvX2[i].I() - hvX1[i].I() + 1; |
| | | int hTmp = hvY2[i].I() - hvY1[i].I() + 1; |
| | | if (wTmp > m_nDefectSize || hTmp > m_nDefectSize) { |
| | | ng.result = hvArea[i].I(); |
| | | ng.xResult = (int)(xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1)); |
| | | ng.yResult = (int)(yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1)); |
| | | ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + x1; |
| | | ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + y1; |
| | | |
| | | ng.x1 = hvX1[i].I() + x1 - 1; |
| | | ng.y1 = hvY1[i].I() + y1 - 1; |
| | | ng.x2 = hvX2[i].I() + x1 + 1; |
| | | ng.y2 = hvY2[i].I() + y1 + 1; |
| | | |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 1; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.strName = m_strName; |
| | | inf.eVision = (int)(VISION_THRES); |
| | | inf.rectX1 = ng.x1; |
| | | inf.rectY1 = ng.y1; |
| | | inf.rectX2 = ng.x2; |
| | | inf.rectY2 = ng.y2; |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool CHoleDotProcess::FindTargetPos(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | if (ClsVision::TupleNil(m_idModel)) return false; |
| | | |
| | | //è·åæå®æ¹åçä¾§è¾¹æ°æ® |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | //å¦æä¾§è¾¹æ°æ®ä¸ºç©ºï¼åè¿åfalse |
| | | if (nullptr == pSideData) return false; |
| | | if (0 == m_nPoseType) { |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | } |
| | | else { |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bTopPoint_Find) return false; |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bBotPoint_Find) return false; |
| | | } |
| | | |
| | | //1. é¦å
计ç®Keyçä½ç½® |
| | | Point2I ptOffset; |
| | | ptOffset.x = m_nPoseX; |
| | | ptOffset.y = m_nPoseY; |
| | | Point2I result; |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_nPoseType, result)) return false; |
| | | |
| | | //2. 计ç®ImageçROI |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | int x1 = (int)(result.x - 0.5 * width - 200); |
| | | int y1 = (int)(result.y - 0.5 * height - 200); |
| | | int x2 = (int)(result.x + 0.5 * width + 200); |
| | | int y2 = (int)(result.y + 0.5 * height + 200); |
| | | HalconCpp::HObject hSearchImage; |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hSearchImage, x1, y1, x2, y2)) return false; |
| | | |
| | | //3. æ¥æ¾æ¨¡æ¿ |
| | | std::vector<ParaMatch> vResult; |
| | | if (m_isScale) { |
| | | HalconCpp::HObject hZoomImage; |
| | | HalconCpp::ZoomImageFactor(hSearchImage, &hZoomImage, m_xScale, m_yScale, "constant"); |
| | | ClsVision::FindNccModel(hZoomImage, m_idModel, m_score, 1, vResult); |
| | | int sz = (int)(vResult.size()); |
| | | for (int i = 0; i < sz; i++) { |
| | | vResult[i].pt.x = vResult[i].pt.x / m_xScale; |
| | | vResult[i].pt.y = vResult[i].pt.y / m_yScale; |
| | | } |
| | | } |
| | | else { |
| | | ClsVision::FindNccModel(hSearchImage, m_idModel, m_score, 1, vResult); |
| | | } |
| | | int nCount = (int)(vResult.size()); |
| | | if (nCount < 1) return false; |
| | | |
| | | m_ptLocResult = vResult[0].pt; |
| | | m_ptLocResult.x += x1; |
| | | m_ptLocResult.y += y1; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | int CHoleDotProcess::CreateMatchModel(void) { |
| | | /* code */ |
| | | if (!ClsVision::TupleNil(m_idModel)) { |
| | | ClsVision::ClearNccModel(m_idModel); |
| | | m_idModel = HalconCpp::HTuple(); |
| | | } |
| | | if (!ClsVision::ObjectExist(m_hImage)) return -1; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | if (width < 1 || height < 1) return -1; |
| | | |
| | | m_isScale = false; |
| | | if (width > 120 || height > 120) { |
| | | m_isScale = true; |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | if (width > 120) { |
| | | m_xScale = 120.0f / width; |
| | | } |
| | | if (height > 120) { |
| | | m_yScale = 120.0f / height; |
| | | } |
| | | HalconCpp::HObject hZoomImage; |
| | | HalconCpp::ZoomImageFactor(m_hImage, &hZoomImage, m_xScale, m_yScale, "constant"); |
| | | m_idModel = ClsVision::CreateNccModel(hZoomImage, -15, 15, 0, 2000); |
| | | } |
| | | else { |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | m_idModel = ClsVision::CreateNccModel(m_hImage, -15, 15, 0, 2000); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef HOLE_DOT_PROCESS |
| | | #define HOLE_DOT_PROCESS |
| | | |
| | | class CHoleDotProcess |
| | | { |
| | | public: |
| | | CHoleDotProcess(); |
| | | CHoleDotProcess(DimensionDir eDir, int id); |
| | | ~CHoleDotProcess(); |
| | | |
| | | public: |
| | | //1. è·åID |
| | | int GetID() { return m_id; } |
| | | |
| | | //2. è·åå¾å |
| | | HalconCpp::HObject& GetImage() { return m_hImage; } |
| | | void SetImage(HalconCpp::HObject& image) { m_hImage = image; CreateMatchModel(); } |
| | | |
| | | //3. 设置ä½ç½® |
| | | void SetPose(int x, int y) { m_nPoseX = x; m_nPoseY = y; } |
| | | void GetPose(int& x, int& y) { x = m_nPoseX; y = m_nPoseY; }; |
| | | |
| | | //4. ä¿åæ°æ® |
| | | Json::Value WriteToJson(std::string& strDir); |
| | | void DecodeJson(std::string& strDir, Json::Value& jsValue); |
| | | |
| | | //7. æ§è¡ |
| | | int Execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; //Side |
| | | CString m_strName; //Name |
| | | int m_nUse; //Use |
| | | |
| | | int m_nPoseType; //PoseType |
| | | int m_nShapeType; //ShapeType |
| | | int m_nBrightType; //BrightType |
| | | int m_nSmoothSize; //SmoothSize |
| | | int m_nThres; //Thres |
| | | int m_nDefectSize; //DefectSize |
| | | |
| | | Point2D m_ptLocResult; //å®ä½ç»æ |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | |
| | | private: |
| | | HalconCpp::HObject m_hImage; //Holeå¾å |
| | | HalconCpp::HObject m_hImageResult; //æªåå¾å |
| | | int m_id; //Holeç¼å· |
| | | double m_score; //Holeå¾å |
| | | |
| | | int m_nPoseX; //Holeä¸å¿ç¹X |
| | | int m_nPoseY; //Holeä¸å¿ç¹Y |
| | | |
| | | HalconCpp::HTuple m_idModel; //模æ¿ID |
| | | double m_xScale; //模æ¿Xç¼©æ¾ |
| | | double m_yScale; //模æ¿Yç¼©æ¾ |
| | | bool m_isScale; //æ¯å¦ç¼©æ¾ |
| | | |
| | | private: |
| | | //1. å建模ç |
| | | int CreateMatchModel(void); |
| | | |
| | | //2. æ¥æ¾ç®æ ä½ç½® |
| | | bool FindTargetPos(DimensionDir eDir, Point2I offset); |
| | | |
| | | //3. è·å缺é·ä¿¡æ¯ |
| | | bool FindDefectInfo(void); |
| | | }; |
| | | |
| | | #endif // !HOLE_DOT_PROCESS |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "HoleProcess.h" |
| | | #include "BlSideData.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CHoleProcess::CHoleProcess(){ |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | for (int i = 0; i < 4; i++) { |
| | | m_dots[i] = new CHoleDotProcess(m_eDir, i + 1); |
| | | } |
| | | } |
| | | |
| | | CHoleProcess::CHoleProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | for (int i = 0; i < 4; i++) { |
| | | m_dots[i] = new CHoleDotProcess(m_eDir, i + 1); |
| | | } |
| | | } |
| | | |
| | | CHoleProcess::~CHoleProcess(){ |
| | | /* code */ |
| | | for (int i = 0; i < 4; i++) { |
| | | CHoleDotProcess* dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dots[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | void CHoleProcess::Execute(DimensionDir eDir) { |
| | | /* code */ |
| | | Point2I offset; |
| | | for (int i = 0; i < 4; i++) { |
| | | CHoleDotProcess* dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | if (1 != dot->m_nUse) continue; |
| | | |
| | | offset.x = i; |
| | | offset.y = i; |
| | | dot->Execute(eDir, offset); |
| | | } |
| | | } |
| | | |
| | | Json::Value CHoleProcess::WriteToJson(std::string& strDir) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["type"] = HOLE_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dots[i]->WriteToJson(strDir); |
| | | } |
| | | return jsValue; |
| | | } |
| | | |
| | | void CHoleProcess::DecodeJson(Json::Value& jsValue, std::string& strDir) { |
| | | /* code */ |
| | | int num = (int)jsValue.size(); |
| | | if (num < 1) return; |
| | | |
| | | //1. Side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dots[i]->DecodeJson(strDir, jsData); |
| | | } |
| | | } |
| | | |
| | | return; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef HOLE_PROCESS_H |
| | | #define HOLE_PROCESS_H |
| | | |
| | | #include "HoleDotProcess.h" |
| | | |
| | | class CHoleProcess |
| | | { |
| | | public: |
| | | CHoleProcess(); |
| | | CHoleProcess(DimensionDir eDir); |
| | | ~CHoleProcess(); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | CHoleDotProcess* m_dots[4]; |
| | | |
| | | public: |
| | | //1. æ§è¡æ£æµ |
| | | void Execute(DimensionDir eDir); |
| | | |
| | | //2. ä¿åæä»¶ |
| | | Json::Value WriteToJson(std::string &strDir); |
| | | void DecodeJson(Json::Value& jsValue, std::string& strDir); |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | #endif // !HOLE_PROCESS_H |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "InChipDotProcess.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "Bspline.h" |
| | | |
| | | CInChipDotProcess::CInChipDotProcess(){ |
| | | /* code */ |
| | | m_nSampleNumber = 16; |
| | | m_nLineWidth = 50; |
| | | m_nChipOffset = -32; |
| | | m_nChipRange = 30; |
| | | m_threshold = 20; |
| | | m_nPointType = 1; |
| | | m_nPointMode = 2; |
| | | m_eDir = DIMENSION_NONE; |
| | | CVisionBufferPro::getLineFrameSize(m_eDir, m_nFrameWidth, m_nFrameHeight); |
| | | ClsVision::GenEmptyObject(m_hRoiRegion); |
| | | } |
| | | |
| | | CInChipDotProcess::CInChipDotProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | m_nSampleNumber = 16; |
| | | m_nLineWidth = 100; |
| | | m_nChipOffset = -32; |
| | | m_nChipRange = 30; |
| | | m_threshold = 20; |
| | | m_nPointType = 1; |
| | | m_nPointMode = 2; |
| | | m_eDir = eDir; |
| | | CVisionBufferPro::getLineFrameSize(m_eDir, m_nFrameWidth, m_nFrameHeight); |
| | | ClsVision::GenEmptyObject(m_hRoiRegion); |
| | | } |
| | | |
| | | CInChipDotProcess::~CInChipDotProcess() |
| | | { |
| | | } |
| | | |
| | | int CInChipDotProcess::Execute(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd) { |
| | | /* code */ |
| | | if (index < 0) return 0; |
| | | |
| | | return ExeInChip(eDir, index, ptStart, ptEnd); |
| | | } |
| | | |
| | | int CInChipDotProcess::ExeInChip(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd) { |
| | | /* code */ |
| | | if (m_nFrameWidth < 1 || m_nFrameHeight < 1) return 0; |
| | | |
| | | int y1 = index * m_nFrameHeight; |
| | | int y2 = index * m_nFrameHeight + m_nFrameHeight - 1; |
| | | int x1 = ptStart.x - m_nLineWidth; |
| | | int x2 = ptEnd.x + m_nLineWidth; |
| | | if (ptStart.x > ptEnd.x) { |
| | | x1 = ptEnd.x - m_nLineWidth; |
| | | x2 = ptStart.x + m_nLineWidth; |
| | | } |
| | | x1 -= 30; |
| | | x2 += 30; |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return 0; |
| | | int leftPos = x1; |
| | | int topPos = y1; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | //HalconCpp::HWindow hDispWin(0, 0, width, height); |
| | | //hDispWin.SetPart(0, 0, height - 1, width - 1); |
| | | //hDispWin.SetColored(6); |
| | | //hDispWin.DispObj(hImage); |
| | | |
| | | std::vector<Point2D> vEdgePoints; |
| | | int step = (int)(1.0 * (y2 - y1) / (m_nSampleNumber - 1)); |
| | | for (int i = 0; i < m_nSampleNumber; i++) { |
| | | int yTarget = y1 + i * step; |
| | | if (0 == i) { |
| | | yTarget = y1 + 15; |
| | | } |
| | | else if (m_nSampleNumber - 1 == i) { |
| | | yTarget = y2 - 15; |
| | | } |
| | | |
| | | Line2D line; |
| | | line.pt0.x = 30; |
| | | line.pt0.y = yTarget - topPos; |
| | | line.pt1.x = x2 - leftPos - 31; |
| | | line.pt1.y = yTarget - topPos; |
| | | Point2D ptStart, ptEnd; |
| | | if (!CVisionBufferPro::GetMeasurePos(hImage, line, m_threshold, m_nPointMode, 10, ptStart, ptEnd)) continue; |
| | | if (0 == i) { |
| | | ptStart.y = 0; |
| | | ptEnd.y = 0; |
| | | } |
| | | else if (m_nSampleNumber - 1 == i) { |
| | | ptStart.y = height - 1; |
| | | ptEnd.y = height - 1; |
| | | } |
| | | |
| | | if (0 == m_nPointType) { |
| | | vEdgePoints.push_back(ptStart); |
| | | } |
| | | else { |
| | | vEdgePoints.push_back(ptEnd); |
| | | } |
| | | } |
| | | |
| | | int num = (int)(vEdgePoints.size()); |
| | | if (num < 0.5 * m_nSampleNumber) return 0; |
| | | |
| | | //1. è·åç¹éµ |
| | | std::vector<vec> vStartCtrlPoint; |
| | | for (int i = 0; i < num; i++) { |
| | | float x0 = (float)vEdgePoints[i].x; |
| | | float y0 = (float)vEdgePoints[i].y; |
| | | vec p0(x0, y0, 0); |
| | | vStartCtrlPoint.push_back(p0); |
| | | } |
| | | |
| | | //2. æ§è¡æ ·æ¡æå¼ |
| | | CBspline bcurve(vStartCtrlPoint); |
| | | bcurve.execute(); |
| | | |
| | | int sz = (int)(bcurve.m_vPtResults.size()); |
| | | if (sz < 1) return 0; |
| | | HalconCpp::HTuple hvY, hvX; |
| | | for (int i = 0; i < sz; i++) { |
| | | hvX[i] = bcurve.m_vPtResults[i][0] + m_nChipOffset; |
| | | hvY[i] = bcurve.m_vPtResults[i][1]; |
| | | } |
| | | int idx = sz; |
| | | hvX[idx] = bcurve.m_vPtResults[sz - 1][0] + m_nChipOffset; |
| | | hvY[idx] = bcurve.m_vPtResults[sz - 1][1]; |
| | | idx += 1; |
| | | hvX[idx] = bcurve.m_vPtResults[sz - 1][0] + m_nChipOffset + m_nChipRange; |
| | | hvY[idx] = bcurve.m_vPtResults[sz - 1][1]; |
| | | idx += 1; |
| | | for (int i = sz - 1; i >= 0; i--) { |
| | | hvX[idx] = bcurve.m_vPtResults[i][0] + m_nChipOffset + m_nChipRange; |
| | | hvY[idx] = bcurve.m_vPtResults[i][1]; |
| | | idx += 1; |
| | | } |
| | | |
| | | HalconCpp::GenRegionPolygonFilled(&m_hRoiRegion, hvY, hvX); |
| | | //hDispWin.DispObj(m_hRoiRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HObject hProObject, hRegion, hConnectRegion; |
| | | HalconCpp::ReduceDomain(hImage, m_hRoiRegion, &hProObject); |
| | | HalconCpp::Threshold(hProObject, &hRegion, 0, 60); |
| | | HalconCpp::Connection(hRegion, &hConnectRegion); |
| | | //hDispWin.ClearWindow(); |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hConnectRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | return 0; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef INCHIP_DOT_PROCESS_H |
| | | #define INCHIP_DOT_PROCESS_H |
| | | |
| | | class CInChipDotProcess |
| | | { |
| | | public: |
| | | CInChipDotProcess(); |
| | | CInChipDotProcess(DimensionDir eDir); |
| | | ~CInChipDotProcess(); |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | int Execute(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd); |
| | | |
| | | public: |
| | | int m_nChipOffset; |
| | | int m_nChipRange; |
| | | |
| | | int m_nLineWidth; //ROIç宽度 |
| | | int m_nPointType; |
| | | int m_nPointMode; |
| | | int m_threshold; //è¾¹ç |
| | | int m_nSampleNumber; //éæ ·ç¹æ°é |
| | | |
| | | HalconCpp::HObject m_hRoiRegion; |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | int m_nFrameWidth; |
| | | int m_nFrameHeight; |
| | | |
| | | private: |
| | | //1. æ§è¡æ£æµ |
| | | int ExeInChip(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd); |
| | | |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "KDistProcess.h" |
| | | #include "BlSideData.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | CKDistProcess::CKDistProcess() { |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | for (int i = 0; i < 50; i++) { |
| | | m_dots[i] = new CKeyDistDotProcess(m_eDir, i + 1); |
| | | } |
| | | m_nRoiSize = 100; |
| | | m_isUse = false; |
| | | } |
| | | |
| | | CKDistProcess::CKDistProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_isUse = false; |
| | | m_nRoiSize = 100; |
| | | for (int i = 0; i < 50; i++) { |
| | | m_dots[i] = new CKeyDistDotProcess(m_eDir, i + 1); |
| | | } |
| | | } |
| | | |
| | | CKDistProcess::~CKDistProcess() { |
| | | /* code */ |
| | | for (int i = 0; i < 50; i++) { |
| | | CKeyDistDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dots[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | void CKDistProcess::Execute(DimensionDir eDir) { |
| | | /* code */ |
| | | if (!m_isUse) return; |
| | | |
| | | Point2I offset; |
| | | for (int i = 0; i < 50; i++) { |
| | | CKeyDistDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | if (1 != dot->m_nUse) continue; |
| | | |
| | | offset.x = i; |
| | | offset.y = i; |
| | | |
| | | dot->setRoiSize(m_nRoiSize); |
| | | dot->Execute(m_eDir, offset); |
| | | } |
| | | } |
| | | |
| | | Json::Value CKDistProcess::WriteToJson(void) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["type"] = KDIST_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["use"] = m_isUse; |
| | | jsValue["roi size"] = m_nRoiSize; |
| | | |
| | | for (int i = 0; i < 50; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dots[i]->WriteToJson(); |
| | | } |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CKDistProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)jsValue.size(); |
| | | if (num < 1) return; |
| | | |
| | | //1. Side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) { |
| | | m_isUse = jsValue[strName.c_str()].asBool(); |
| | | } |
| | | |
| | | //3. roi size |
| | | strName = "roi size"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nRoiSize = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | for (int i = 0; i < 50; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dots[i]->DecodeJson(jsData); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef KDIST_PROCESS_H |
| | | #define KDIST_PROCESS_H |
| | | |
| | | #include "KeyDistDotProcess.h" |
| | | |
| | | class CKDistProcess |
| | | { |
| | | public: |
| | | CKDistProcess(); |
| | | CKDistProcess(DimensionDir eDir); |
| | | ~CKDistProcess(); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | bool m_isUse; //æ¯å¦å¯ç¨ |
| | | int m_nRoiSize; |
| | | CKeyDistDotProcess *m_dots[50]; |
| | | |
| | | public: |
| | | //1. æ§è¡æ£æµ |
| | | void Execute(DimensionDir eDir); |
| | | |
| | | //3. ä¿åæä»¶ |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | }; |
| | | |
| | | #endif |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "KeyDistDotProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | CKeyDistDotProcess::CKeyDistDotProcess() { |
| | | /* code */ |
| | | m_eDir = DIMENSION_NONE; |
| | | m_id = 0; |
| | | m_nStdDist = 0; |
| | | |
| | | m_nUse = 0; |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | |
| | | m_poseType = 0; |
| | | m_keyPoseX = 0; |
| | | m_keyPoseY = 0; |
| | | m_nPosX = 0; |
| | | m_nPosY = 0; |
| | | m_nEndThres = 0; |
| | | // m_nLineWidth = 200; |
| | | |
| | | m_nInc = 0; |
| | | m_nMin = 0; |
| | | m_nMax = 0; |
| | | m_nRoiSize = 100; |
| | | m_distResult = 0.0f; |
| | | } |
| | | |
| | | CKeyDistDotProcess::CKeyDistDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_id = id; |
| | | |
| | | m_nUse = 0; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD_D%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P_D%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P_D%d"), m_id); |
| | | break; |
| | | } |
| | | |
| | | m_poseType = 0; |
| | | m_keyPoseX = 0; |
| | | m_keyPoseY = 0; |
| | | m_nPosX = 0; |
| | | m_nPosY = 0; |
| | | m_nEndThres = 0; |
| | | // m_nLineWidth = 200; |
| | | m_nStdDist = 0; |
| | | |
| | | m_nInc = 0; |
| | | m_nMin = 0; |
| | | m_nMax = 0; |
| | | m_nRoiSize = 100; |
| | | m_distResult = 0.0f; |
| | | } |
| | | |
| | | CKeyDistDotProcess::~CKeyDistDotProcess() { |
| | | /* code */ |
| | | } |
| | | |
| | | int CKeyDistDotProcess::Execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | m_ptNearResult.x = 0.0f; |
| | | m_ptNearResult.y = 0.0f; |
| | | m_ptMeasureResult.x = 0.0f; |
| | | m_ptMeasureResult.y = 0.0f; |
| | | if (1 != m_nUse) return 0; |
| | | if (0 == m_keyPoseY && 0 == m_keyPoseX) return 0; |
| | | if (0 == m_nPosX && 0 == m_nPosY) return 0; |
| | | |
| | | //1. è·åè§£é度 |
| | | getMmvsp(eDir); |
| | | |
| | | //2. æ¥æ¾ç»æ |
| | | if (!findEndPoint(eDir)) return -1; |
| | | |
| | | //3. ç»æå¤æ |
| | | judgeResult(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | bool CKeyDistDotProcess::getImageROI(HalconCpp::HObject &hImage, Point2I &result) { |
| | | /* code */ |
| | | // å®ä¹ä¸¤ä¸ªvectorï¼åå«å卿 åç¹åå®é
ç¹çåæ |
| | | std::vector<Point2D> vStdPoint, vRealPoint; |
| | | // è®¡ç®æ åç¹ä¸å®é
ç¹ä¹é´çè·ç¦» |
| | | double dx = m_locPointResult.x - m_ptMeasureResult.x; |
| | | double dy = m_locPointResult.y - m_ptMeasureResult.y; |
| | | double dist = sqrt(dx * dx + dy * dy); |
| | | |
| | | // å建ä¸ä¸ªposeç¹ï¼ç¨äºå卿 åç¹ |
| | | Point2D pose; |
| | | pose.x = m_nRoiSize + 10; //å°ºå¯¸å¤§å° 2 * m_nRoiSize + 20 // 110; |
| | | pose.y = 40; |
| | | vStdPoint.push_back(pose); |
| | | // å°æ åç¹æ²¿çè·ç¦»ç§»å¨ |
| | | pose.x = m_nRoiSize + 10 + dist;//110.0 + dist; |
| | | vStdPoint.push_back(pose); |
| | | |
| | | // å°å®é
ç¹åå
¥vRealPoint |
| | | pose.x = m_locPointResult.x; |
| | | pose.y = m_locPointResult.y; |
| | | vRealPoint.push_back(pose); |
| | | vRealPoint.push_back(m_ptMeasureResult); |
| | | |
| | | // å°vStdPointåvRealPoint转æ¢ä¸ºä»¿å°ç©éµ |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint); |
| | | |
| | | //4ä¸ªç¹ |
| | | // 设置xåyçå¼ä¸º0 |
| | | pose.x = 0.0; |
| | | pose.y = 0.0; |
| | | // å°poseåæ è½¬æ¢ä¸ºpointåæ |
| | | Point2D point = ClsVision::CoordinateTransform(pose, affine); |
| | | // å°pointåæ è½¬æ¢ä¸ºæ´æ° |
| | | int x1 = (int)(point.x); |
| | | int y1 = (int)(point.y); |
| | | int x2 = (int)(point.x); |
| | | int y2 = (int)(point.y); |
| | | |
| | | // 设置xåyçå¼ä¸º0 |
| | | pose.x = 0.0; |
| | | pose.y = 79.0; |
| | | // å°poseåæ è½¬æ¢ä¸ºpointåæ |
| | | point = ClsVision::CoordinateTransform(pose, affine); |
| | | // 妿x1大äºpoint.xï¼åå°x1设置为point.x |
| | | if (x1 > point.x) x1 = (int)(point.x); |
| | | // 妿y1大äºpoint.yï¼åå°y1设置为point.y |
| | | if (y1 > point.y) y1 = (int)(point.y); |
| | | // 妿x2å°äºpoint.xï¼åå°x2设置为point.x |
| | | if (x2 < point.x) x2 = (int)(point.x); |
| | | // 妿y2å°äºpoint.yï¼åå°y2设置为point.y |
| | | if (y2 < point.y) y2 = (int)(point.y); |
| | | |
| | | // 设置xåyçå¼ä¸º219.0 |
| | | pose.x = 2 * (m_nRoiSize + 10) - 1; //219.0; |
| | | pose.y = 79.0; |
| | | // å°poseåæ è½¬æ¢ä¸ºpointåæ |
| | | point = ClsVision::CoordinateTransform(pose, affine); |
| | | // 妿x1大äºpoint.xï¼åå°x1设置为point.x |
| | | if (x1 > point.x) x1 = (int)(point.x); |
| | | // 妿y1大äºpoint.yï¼åå°y1设置为point.y |
| | | if (y1 > point.y) y1 = (int)(point.y); |
| | | // 妿x2å°äºpoint.xï¼åå°x2设置为point.x |
| | | if (x2 < point.x) x2 = (int)(point.x); |
| | | // 妿y2å°äºpoint.yï¼åå°y2设置为point.y |
| | | if (y2 < point.y) y2 = (int)(point.y); |
| | | |
| | | // 设置xåyçå¼ä¸º219.0 |
| | | pose.x = 2 * (m_nRoiSize + 10) - 1; //219.0; |
| | | pose.y = 0.0; |
| | | // å°poseåæ è½¬æ¢ä¸ºpointåæ |
| | | point = ClsVision::CoordinateTransform(pose, affine); |
| | | // 妿x1大äºpoint.xï¼åå°x1设置为point.x |
| | | if (x1 > point.x) x1 = (int)(point.x); |
| | | // 妿y1大äºpoint.yï¼åå°y1设置为point.y |
| | | if (y1 > point.y) y1 = (int)(point.y); |
| | | // 妿x2å°äºpoint.xï¼åå°x2设置为point.x |
| | | if (x2 < point.x) x2 = (int)(point.x); |
| | | // 妿y2å°äºpoint.yï¼åå°y2设置为point.y |
| | | if (y2 < point.y) y2 = (int)(point.y); |
| | | |
| | | // 计ç®å®½åº¦ |
| | | int dWidth = x2 - x1 + 1; |
| | | // å¦æå®½åº¦å°äº220ï¼åå°x1åx2设置为110çåç§»é |
| | | if (dWidth <= 2 * (m_nRoiSize + 10)) { |
| | | x1 = m_locPointResult.x - (m_nRoiSize + 10); |
| | | x2 = m_locPointResult.x + (m_nRoiSize + 10); |
| | | } |
| | | // å¦åï¼è®¡ç®x1åx2çåç§»éï¼å¹¶å°å®ä»¬è®¾ç½®ä¸ºx1åx2çä¸é´å¼ |
| | | else { |
| | | int dd = (int)((dWidth + 2) / 2); |
| | | x1 = m_locPointResult.x - dd; |
| | | x2 = m_locPointResult.x + dd; |
| | | } |
| | | // 计ç®é«åº¦ |
| | | int dHeight = y2 - y1 + 1; |
| | | // 妿é«åº¦å°äº80ï¼åå°y1åy2设置为40çåç§»é |
| | | if (dHeight <= 80) { |
| | | y1 = m_locPointResult.y - 40; |
| | | y2 = m_locPointResult.y + 40; |
| | | } |
| | | // å¦åï¼è®¡ç®y1åy2çåç§»éï¼å¹¶å°å®ä»¬è®¾ç½®ä¸ºy1åy2çä¸é´å¼ |
| | | else { |
| | | int dd = (int)((dHeight + 2) / 2); |
| | | y1 = m_locPointResult.y - dd; |
| | | y2 = m_locPointResult.y + dd; |
| | | } |
| | | |
| | | HalconCpp::HObject hTmpObject; |
| | | // 妿è·åROI失败ï¼åè¿åfalse |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hTmpObject, x1, y1, x2, y2)) return false; |
| | | // å°ç»æçxåy设置为x1åy1 |
| | | result.x = x1; |
| | | result.y = y1; |
| | | |
| | | // è·åå¾åå¤§å° |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hTmpObject, width, height); |
| | | if (width < 1 || height < 1) return false; |
| | | |
| | | // æ¸
é¤ä¹åè®°å½çç¹ |
| | | vStdPoint.clear(); |
| | | // å°ç¹è½¬æ¢ä¸ºæ ååæ ç³» |
| | | pose.x = 0.5 * (width - 1); |
| | | pose.y = 0.5 * (height - 1); |
| | | vStdPoint.push_back(pose); |
| | | // å°ç¹è½¬æ¢ä¸ºå®é
åæ ç³» |
| | | pose.x += (m_ptMeasureResult.x - m_locPointResult.x); |
| | | pose.y += (m_ptMeasureResult.y - m_locPointResult.y); |
| | | vStdPoint.push_back(pose); |
| | | |
| | | // å°ç¹è½¬æ¢ä¸ºå®é
åæ ç³» |
| | | vRealPoint.clear(); |
| | | pose.x = m_nRoiSize + 10; //110; |
| | | pose.y = 40; |
| | | vRealPoint.push_back(pose); |
| | | pose.x = m_nRoiSize + 10 + dist;// 110.0 + dist; |
| | | vRealPoint.push_back(pose); |
| | | |
| | | // å°æ åç¹åå®é
ç¹è½¬æ¢ä¸ºç¸ä¼¼åº¦ |
| | | affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint); |
| | | // 对å¾åè¿è¡ä»¿å°åæ¢ |
| | | ClsVision::AffineTransImage(hTmpObject, affine, hImage); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool CKeyDistDotProcess::findEndPoint(DimensionDir eDir) { |
| | | /* code */ |
| | | //è·åæå®æ¹åçä¾§è¾¹æ°æ® |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | //å¦æä¾§è¾¹æ°æ®ä¸ºç©ºï¼åè¿åfalse |
| | | if (nullptr == pSideData) return false; |
| | | |
| | | if (0 == m_poseType) { |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | } |
| | | else { |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bTopPoint_Find) return false; |
| | | //å¦æä¾§è¾¹æ°æ®ä¸æ²¡ææ¾å°ä¸ç¹ï¼åè¿åfalse |
| | | if (!pSideData->m_bBotPoint_Find) return false; |
| | | } |
| | | |
| | | //1. é¦å
计ç®Keyçä½ç½® |
| | | Point2I ptOffset; |
| | | ptOffset.x = m_keyPoseX; |
| | | ptOffset.y = m_keyPoseY; |
| | | Point2I result; |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result)) return false; |
| | | |
| | | m_ptMeasureResult.x = result.x; |
| | | m_ptMeasureResult.y = result.y; |
| | | |
| | | ptOffset.x = m_nPosX; |
| | | ptOffset.y = m_nPosY; |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result)) return false; |
| | | m_locPointResult = result; |
| | | |
| | | HalconCpp::HObject hImage; |
| | | Point2I leftTop; |
| | | if (!getImageROI(hImage, leftTop)) return false; |
| | | |
| | | // å®ä¹HObjectç±»åçåé |
| | | HalconCpp::HObject hMeanObject, hRoiRegion, hTmpObj, hProcObject; |
| | | // 使ç¨MeanImage彿°è®¡ç®å¾åçå¹³åå¼ï¼å¹¶å°ç»æåå¨å¨hMeanObjectä¸ |
| | | HalconCpp::MeanImage(hImage, &hMeanObject, 1, 15); |
| | | // å®ä¹ä¸ä¸ªç©å½¢åºåï¼å·¦ä¸è§åæ 为(10, 10)ï¼å³ä¸è§åæ 为(69, 219) |
| | | HalconCpp::GenRectangle1(&hRoiRegion, 10, 10, 69, 2 * (m_nRoiSize + 10)- 1 /* 219 */ ); |
| | | // 使ç¨ReduceDomain彿°å°hMeanObjectçå¼åå»hRoiRegionçå¼ï¼å¹¶å°ç»æåå¨å¨hTmpObjä¸ |
| | | HalconCpp::ReduceDomain(hMeanObject, hRoiRegion, &hTmpObj); |
| | | // 使ç¨CropDomain彿°è£åªhTmpObjï¼å¹¶å°ç»æåå¨å¨hProcObjectä¸ |
| | | HalconCpp::CropDomain(hTmpObj, &hProcObject); |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hProcObject, width, height); |
| | | if (width < 1 || height < 1) return false; |
| | | |
| | | Line2D line; |
| | | line.pt0.x = 5; |
| | | line.pt0.y = 0.5 * height - 1; |
| | | line.pt1.x = width - 6; |
| | | line.pt1.y = 0.5 * height - 1; |
| | | int nThreshold = 10; |
| | | if (m_nEndThres > 3) nThreshold = m_nEndThres; |
| | | Point2D ptStart, ptEnd; |
| | | if (!CVisionBufferPro::GetMeasureNearPos(hProcObject, line, nThreshold, 0, 10, ptStart, ptEnd)) return false; |
| | | |
| | | Point2D posLeftPoint; |
| | | posLeftPoint.x = ptStart.x + 10; |
| | | posLeftPoint.y = 0.5 * (height - 1) + 10; |
| | | |
| | | |
| | | std::vector<Point2D> vStdPoint, vRealPoint; |
| | | // è®¡ç®æ åç¹ä¸å®é
ç¹ä¹é´çè·ç¦» |
| | | double dx = m_locPointResult.x - m_ptMeasureResult.x; |
| | | double dy = m_locPointResult.y - m_ptMeasureResult.y; |
| | | double dist = sqrt(dx * dx + dy * dy); |
| | | |
| | | // å建ä¸ä¸ªposeç¹ï¼ç¨äºå卿 åç¹ |
| | | Point2D pose; |
| | | pose.x = 10 + m_nRoiSize; // 110; |
| | | pose.y = 40; |
| | | vStdPoint.push_back(pose); |
| | | // å°æ åç¹æ²¿çè·ç¦»ç§»å¨ |
| | | pose.x = 10 + m_nRoiSize + dist; // 110.0 + dist; |
| | | vStdPoint.push_back(pose); |
| | | |
| | | // å°å®é
ç¹åå
¥vRealPoint |
| | | pose.x = m_locPointResult.x; |
| | | pose.y = m_locPointResult.y; |
| | | vRealPoint.push_back(pose); |
| | | vRealPoint.push_back(m_ptMeasureResult); |
| | | |
| | | // å°vStdPointåvRealPoint转æ¢ä¸ºä»¿å°ç©éµ |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint); |
| | | m_ptNearResult = ClsVision::CoordinateTransform(posLeftPoint, affine); |
| | | |
| | | if (m_nEndThres > 3) { |
| | | Point2D posEndPoint; |
| | | posEndPoint.x = ptEnd.x + 10; |
| | | posEndPoint.y = 0.5 * (height - 1) + 10; |
| | | m_ptMeasureResult = ClsVision::CoordinateTransform(posEndPoint, affine); |
| | | } |
| | | |
| | | // |
| | | return true; |
| | | } |
| | | |
| | | int CKeyDistDotProcess::getID(void) { |
| | | /* code */ |
| | | return m_id; |
| | | } |
| | | |
| | | void CKeyDistDotProcess::setRoiSize(int sz) { |
| | | /* code */ |
| | | m_nRoiSize = sz; |
| | | } |
| | | |
| | | void CKeyDistDotProcess::getMmvsp(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | m_xMmvsp = pSideData->m_dPixelSizeX; |
| | | m_yMmvsp = pSideData->m_dPixelSizeY; |
| | | } |
| | | |
| | | void CKeyDistDotProcess::judgeResult(void) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | if (fabs(m_ptMeasureResult.x) < 0.1 && fabs(m_ptMeasureResult.y) < 0.1f) return; |
| | | |
| | | //å建缺é·dotä¿¡æ¯ |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = true; |
| | | ng.minValue = m_nMin; |
| | | ng.maxValue = m_nMax; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_OK; //缺é·ç±»å |
| | | ng.eVision = VISION_KDIST; |
| | | |
| | | //计ç®ç¼ºé·ä½ç½® |
| | | ng.xPosPxl = m_locPointResult.x; |
| | | ng.yPosPxl = m_locPointResult.y; |
| | | ng.xResult = 0.0f; |
| | | ng.yResult = 0.0f; |
| | | ng.x1 = m_locPointResult.x - 40; |
| | | ng.y1 = m_locPointResult.y - 20; |
| | | ng.x2 = m_locPointResult.x + 40; |
| | | ng.y2 = m_locPointResult.y + 20; |
| | | |
| | | //计ç®ç¼ºé·ç±»å |
| | | ng.ngType = DefectLoc_Corner_Dist; |
| | | double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x); |
| | | double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y); |
| | | m_distResult = sqrt(dx * dx + dy * dy); |
| | | |
| | | //è¾åºæ¾ç¤ºæ°æ® |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 3; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_KDIST); |
| | | inf.rectX1 = (int)(m_ptMeasureResult.x); |
| | | inf.rectY1 = (int)(m_ptMeasureResult.y); |
| | | inf.rectX2 = (int)(m_ptNearResult.x); |
| | | inf.rectY2 = (int)(m_ptNearResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | |
| | | inf.nType = 0; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_KDIST); |
| | | inf.pointX = (int)(m_ptNearResult.x); |
| | | inf.pointY = (int)(m_ptNearResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | |
| | | inf.nType = 4; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_KDIST); |
| | | inf.pointX = (int)(m_ptNearResult.x); |
| | | inf.pointY = (int)(m_ptNearResult.y); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | //计ç®ç¼ºé·è·ç¦» |
| | | m_distResult += m_nInc; |
| | | ng.result = m_distResult; |
| | | |
| | | //å¤æç¼ºé·æ¯å¦ç¬¦åæ å |
| | | if (m_nMax < 0.5) { |
| | | m_nNgInfo.push_back(ng); |
| | | return; |
| | | } |
| | | |
| | | double dDist = m_distResult - m_nStdDist; |
| | | if (dDist < m_nMin || dDist > m_nMax) { |
| | | ng.isRes = false; |
| | | } |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | |
| | | Json::Value CKeyDistDotProcess::WriteToJson(void) { |
| | | /* code */ |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = KDIST_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["use"] = m_nUse; |
| | | jsValue["pos type"] = m_poseType; |
| | | jsValue["key pos x"] = m_keyPoseX; |
| | | jsValue["key pos y"] = m_keyPoseY; |
| | | jsValue["pos x"] = m_nPosX; |
| | | jsValue["pos y"] = m_nPosY; |
| | | jsValue["inc"] = m_nInc; |
| | | jsValue["min"] = m_nMin; |
| | | jsValue["max"] = m_nMax; |
| | | jsValue["end thres"] = m_nEndThres; |
| | | jsValue["std dist"] = m_nStdDist; |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CKeyDistDotProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nUse = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //5. pos type |
| | | strName = "pos type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_poseType = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //6. key pos x |
| | | strName = "key pos x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_keyPoseX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //7. key pos y |
| | | strName = "key pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_keyPoseY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //8. pos x |
| | | strName = "pos x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPosX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //9. pos y |
| | | strName = "pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPosY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //10. inc |
| | | strName = "inc"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nInc = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //11. min |
| | | strName = "min"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nMin = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //12. max |
| | | strName = "max"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nMax = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //14. end thres |
| | | strName = "end thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nEndThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //15. std dist |
| | | strName = "std dist"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nStdDist = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef KEY_DIST_DOT_PROCESS_H |
| | | #define KEY_DIST_DOT_PROCESS_H |
| | | |
| | | class CKeyDistDotProcess |
| | | { |
| | | public: |
| | | CKeyDistDotProcess(); |
| | | CKeyDistDotProcess(DimensionDir eDir, int id); |
| | | ~CKeyDistDotProcess(); |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | int Execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | //2. è·åID |
| | | int getID(void); |
| | | void setRoiSize(int sz); |
| | | |
| | | //3. ä¿åæ°æ® |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | public: |
| | | int m_nUse; |
| | | CString m_strName; |
| | | |
| | | int m_poseType; |
| | | int m_keyPoseX; |
| | | int m_keyPoseY; |
| | | int m_nPosX; |
| | | int m_nPosY; |
| | | int m_nEndThres; |
| | | // int m_nLineWidth; //åæå®½åº¦ |
| | | int m_nStdDist; |
| | | int m_nInc; |
| | | int m_nMin; |
| | | int m_nMax; |
| | | |
| | | Point2D m_ptMeasureResult; |
| | | Point2D m_ptNearResult; |
| | | Point2I m_locPointResult; |
| | | double m_distResult; |
| | | |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | |
| | | private: |
| | | DimensionDir m_eDir; |
| | | int m_id; |
| | | |
| | | double m_xMmvsp; |
| | | double m_yMmvsp; |
| | | int m_nRoiSize; |
| | | |
| | | private: |
| | | //1. è·åå辨ç |
| | | void getMmvsp(DimensionDir eDir); |
| | | |
| | | //2. æ¥æ¾ç»æ |
| | | bool findEndPoint(DimensionDir eDir); |
| | | |
| | | //3. å¤æç»æ |
| | | void judgeResult(void); |
| | | |
| | | //4. æªå¾ROIå¾ |
| | | bool getImageROI(HalconCpp::HObject &hImage, Point2I &result); |
| | | }; |
| | | |
| | | #endif |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "LocProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "BlSideData.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CLocProcess::CLocProcess(){ |
| | | /* code */ |
| | | for (int i = 0; i < 2; i++) { |
| | | m_dot[i] = NULL; |
| | | } |
| | | |
| | | m_topMark.x = 0; |
| | | m_topMark.y = 0; |
| | | m_botMark.x = 0; |
| | | m_botMark.y = 0; |
| | | } |
| | | |
| | | CLocProcess::CLocProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | for (int i = 0; i < 2; i++) { |
| | | CNccDotProcess *dot = new CNccDotProcess(m_eDir, i); |
| | | m_dot[i] = dot; |
| | | } |
| | | |
| | | m_topMark.x = 0; |
| | | m_topMark.y = 0; |
| | | m_botMark.x = 0; |
| | | m_botMark.y = 0; |
| | | } |
| | | |
| | | CLocProcess::~CLocProcess(){ |
| | | /* code */ |
| | | Release(); |
| | | } |
| | | |
| | | void CLocProcess::Release(void) { |
| | | /* code */ |
| | | for (int i = 0; i < 2; i++) { |
| | | CNccDotProcess *dot = m_dot[i]; |
| | | if (NULL == dot) continue; |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dot[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | void CLocProcess::Init(void) { |
| | | /* code */ |
| | | for (int i = 0; i < 2; i++) { |
| | | CNccDotProcess *dot = new CNccDotProcess(m_eDir, i); |
| | | m_dot[i] = dot; |
| | | } |
| | | |
| | | m_topMark.x = 0; |
| | | m_topMark.y = 0; |
| | | m_botMark.x = 0; |
| | | m_botMark.y = 0; |
| | | } |
| | | |
| | | CNccDotProcess* CLocProcess::getDot(int index) { |
| | | /* code */ |
| | | if (index < 0 || index > 1) return NULL; |
| | | |
| | | CNccDotProcess *dot = m_dot[index]; |
| | | return dot; |
| | | } |
| | | |
| | | void CLocProcess::setPose(Point2I pose, int nType) { |
| | | /* code */ |
| | | if (0 == nType) { |
| | | m_topMark = pose; |
| | | } |
| | | else if (1 == nType){ |
| | | m_botMark = pose; |
| | | } |
| | | } |
| | | |
| | | Point2I CLocProcess::getPose(int nType) { |
| | | /* code */ |
| | | if (0 == nType) { |
| | | return m_topMark; |
| | | } |
| | | else if (1 == nType) { |
| | | return m_botMark; |
| | | } |
| | | |
| | | return m_topMark; |
| | | } |
| | | |
| | | int CLocProcess::execute(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return 0; |
| | | |
| | | pSideData->m_bTopPoint_Find = FALSE; |
| | | pSideData->m_bBotPoint_Find = FALSE; |
| | | Point2I offset, pose; |
| | | for (int i = 0; i < 2; i++) { |
| | | CNccDotProcess *dot = m_dot[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | pose = dot->getPose(); |
| | | offset = getOffset(pose); |
| | | |
| | | dot->execute(eDir, offset); |
| | | |
| | | SetResult(dot); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | void CLocProcess::SetResult(CNccDotProcess *dot) { |
| | | /* code */ |
| | | if (NULL == m_dot) return; |
| | | |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return; |
| | | |
| | | int id = dot->getID(); |
| | | if (0 == id) { |
| | | if (fabs(dot->m_ptResult.x) < 0.01 && fabs(dot->m_ptResult.y) < 0.01) return; |
| | | |
| | | pSideData->m_bTopPoint_Find = TRUE; |
| | | pSideData->m_mTopPoint.x = (int)(dot->m_ptResult.x); |
| | | pSideData->m_mTopPoint.y = (int)(dot->m_ptResult.y); |
| | | } |
| | | else if (1 == id) { |
| | | if (fabs(dot->m_ptResult.x) < 0.01 && fabs(dot->m_ptResult.y) < 0.01) return; |
| | | |
| | | pSideData->m_bBotPoint_Find = TRUE; |
| | | pSideData->m_mBotPoint.x = (int)(dot->m_ptResult.x); |
| | | pSideData->m_mBotPoint.y = (int)(dot->m_ptResult.y); |
| | | } |
| | | } |
| | | |
| | | Point2I CLocProcess::getOffset(Point2I pose) { |
| | | /* code */ |
| | | Point2I result; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return result; |
| | | if (0 == pose.x && 0 == pose.y) return result; |
| | | |
| | | double dx = pose.x - m_topMark.x; |
| | | double dy = pose.y - m_topMark.y; |
| | | double dist0 = sqrt(dx * dx + dy * dy); |
| | | dx = pose.x - m_botMark.x; |
| | | dy = pose.y - m_botMark.y; |
| | | double dist1 = sqrt(dx * dx + dy * dy); |
| | | |
| | | if (dist0 < dist1) { |
| | | if (pSideData->m_bTopMark_Find) { |
| | | result.x = pSideData->m_mTopMark.x - m_topMark.x; |
| | | result.y = pSideData->m_mTopMark.y - m_topMark.y; |
| | | } |
| | | else if (pSideData->m_bBotMark_Find) { |
| | | result.x = pSideData->m_mBotMark.x - m_botMark.x; |
| | | result.y = pSideData->m_mBotMark.y - m_botMark.y; |
| | | } |
| | | } |
| | | else { |
| | | if (pSideData->m_bBotMark_Find) { |
| | | result.x = pSideData->m_mBotMark.x - m_botMark.x; |
| | | result.y = pSideData->m_mBotMark.y - m_botMark.y; |
| | | } |
| | | else if(pSideData->m_bTopMark_Find) { |
| | | result.x = pSideData->m_mTopMark.x - m_topMark.x; |
| | | result.y = pSideData->m_mTopMark.y - m_topMark.y; |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | Json::Value CLocProcess::WriteToJson(std::string &strDir) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["type"] = LOC_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["TopMark X"] = m_topMark.x; |
| | | jsValue["TopMark Y"] = m_topMark.y; |
| | | jsValue["BotMark X"] = m_botMark.x; |
| | | jsValue["BotMark Y"] = m_botMark.y; |
| | | |
| | | for (int i = 0; i < 2; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dot[i]->WriteToJson(strDir); |
| | | } |
| | | return jsValue; |
| | | } |
| | | |
| | | int CLocProcess::DecodeJson(std::string &strDir, Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)jsValue.size(); |
| | | if (num < 1) return -1; |
| | | |
| | | //1. Side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. TopMark X,//3. TopMark Y |
| | | strName = "TopMark X"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_topMark.x = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | strName = "TopMark Y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_topMark.y = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | strName = "BotMark X"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_botMark.x = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | strName = "BotMark Y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_botMark.y = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | for (int i = 0; i < 2; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dot[i]->DecodeJson(strDir, jsData); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef LOC_PROCESS_H |
| | | #define LOC_PROCESS_H |
| | | |
| | | #include "NccDotProcess.h" |
| | | |
| | | class CLocProcess |
| | | { |
| | | public: |
| | | CLocProcess(); |
| | | CLocProcess(DimensionDir eDir); |
| | | ~CLocProcess(); |
| | | |
| | | public: |
| | | //1. åå§å |
| | | void Init(void); |
| | | |
| | | //2. è·åæ°æ® |
| | | CNccDotProcess* getDot(int index); |
| | | |
| | | //3. è®¾ç½®æ°æ® |
| | | void setPose(Point2I pose, int nType); |
| | | Point2I getPose(int nType); |
| | | |
| | | //4. æ§è¡ |
| | | int execute(DimensionDir eDir); |
| | | |
| | | //5. åå
¥æä»¶ |
| | | Json::Value WriteToJson(std::string &strDir); |
| | | int DecodeJson(std::string &strDir, Json::Value &jsValue); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | |
| | | private: |
| | | Point2I m_topMark; |
| | | Point2I m_botMark; |
| | | |
| | | private: |
| | | CNccDotProcess *m_dot[2]; |
| | | |
| | | private: |
| | | //1. éæ¾ |
| | | void Release(void); |
| | | |
| | | //2. è·ååç§» |
| | | Point2I getOffset(Point2I pose); |
| | | |
| | | //3. è®¾ç½®ç»æ |
| | | void SetResult(CNccDotProcess *dot); |
| | | |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "NccDotProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CNccDotProcess::CNccDotProcess(){ |
| | | /* code */ |
| | | m_id = 0; |
| | | m_pos.x = 0; |
| | | m_pos.y = 0; |
| | | m_strName = _T("P0"); |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | m_idModel = -1; |
| | | m_eDir = DIMENSION_NONE; |
| | | m_score = 0.5f; |
| | | |
| | | m_ptResult.x = 0.0f; |
| | | m_ptResult.y = 0.0f; |
| | | |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | m_isScale = false; |
| | | |
| | | m_idModel = HalconCpp::HTuple(); |
| | | } |
| | | |
| | | CNccDotProcess::~CNccDotProcess(){ |
| | | /* code */ |
| | | if (!ClsVision::TupleNil(m_idModel)) { |
| | | ClsVision::ClearNccModel(m_idModel); |
| | | m_idModel = HalconCpp::HTuple(); |
| | | } |
| | | } |
| | | |
| | | CNccDotProcess::CNccDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_id = id; |
| | | m_eDir = eDir; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P%d"), m_id); |
| | | break; |
| | | } |
| | | |
| | | m_pos.x = 0; |
| | | m_pos.y = 0; |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | m_idModel = HalconCpp::HTuple(); |
| | | m_score = 0.5f; |
| | | m_ptResult.x = 0.0f; |
| | | m_ptResult.y = 0.0f; |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | m_isScale = false; |
| | | } |
| | | |
| | | int CNccDotProcess::execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_ptResult.x = 0.0f; |
| | | m_ptResult.y = 0.0f; |
| | | if (ClsVision::TupleNil(m_idModel)) { |
| | | CreateMatchModel(); |
| | | } |
| | | if (ClsVision::TupleNil(m_idModel)) return -1; |
| | | |
| | | findTargetPoint(eDir, offset); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CNccDotProcess::findTargetPoint(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | if (ClsVision::TupleNil(m_idModel)) return; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | int x1 = (int)(m_pos.x - 0.5 * width - 200); |
| | | int y1 = (int)(m_pos.y - 0.5 * height - 200); |
| | | int x2 = (int)(m_pos.x + 0.5 * width + 200); |
| | | int y2 = (int)(m_pos.y + 0.5 * height + 200); |
| | | x1 += offset.x; |
| | | y1 += offset.y; |
| | | x2 += offset.x; |
| | | y2 += offset.y; |
| | | |
| | | HalconCpp::HObject hSearchImage; |
| | | if (!CVisionBufferPro::getImageROI(m_eDir, hSearchImage, x1, y1, x2, y2)) return; |
| | | |
| | | std::vector<ParaMatch> vResult; |
| | | if (m_isScale) { |
| | | HalconCpp::HObject hZoomImage; |
| | | HalconCpp::ZoomImageFactor(hSearchImage, &hZoomImage, m_xScale, m_yScale, "constant"); |
| | | ClsVision::FindNccModel(hZoomImage, m_idModel, m_score, 1, vResult); |
| | | int sz = (int)(vResult.size()); |
| | | for (int i = 0; i < sz; i++) { |
| | | vResult[i].pt.x = vResult[i].pt.x / m_xScale; |
| | | vResult[i].pt.y = vResult[i].pt.y / m_yScale; |
| | | } |
| | | } |
| | | else { |
| | | ClsVision::FindNccModel(hSearchImage, m_idModel, m_score, 1, vResult); |
| | | } |
| | | int nCount = (int)(vResult.size()); |
| | | if (nCount < 1) return; |
| | | |
| | | m_ptResult = vResult[0].pt; |
| | | |
| | | m_ptResult.x += x1; |
| | | m_ptResult.y += y1; |
| | | |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 1; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_LOC); |
| | | inf.rectX1 = (int)(m_ptResult.x - 0.5 * width - 1); |
| | | inf.rectY1 = (int)(m_ptResult.y - 0.5 * height - 1); |
| | | inf.rectX2 = (int)(m_ptResult.x + 0.5 * width + 1); |
| | | inf.rectY2 = (int)(m_ptResult.y + 0.5 * height + 1); |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | |
| | | //if (nullptr != pSideData) { //è¾åºç¹çæ¾ç¤ºç»æ |
| | | // DispVisionResult inf; |
| | | // inf.nType = 0; |
| | | // inf.eDir = (int)(m_eDir); |
| | | // inf.eVision = (int)(VISION_LOC); |
| | | // inf.pointX = (int)(m_ptResult.x); |
| | | // inf.pointY = (int)(m_ptResult.y); |
| | | // pSideData->m_vDispVisionResult.push_back(inf); |
| | | //} |
| | | |
| | | KeyDebugInfo inf = CVisionRecipe::getInstance()->getKeyInfo(); |
| | | if (inf.isDebugTool && inf.isLocKey) { |
| | | Log_GetDebug()->TraceInfo("Trace Ncc Result %d: %d, (%.0f,%.0f), %d", |
| | | (int)m_eDir, m_id, m_ptResult.x, m_ptResult.y, __LINE__); |
| | | } |
| | | } |
| | | |
| | | void CNccDotProcess::CreateMatchModel(void) { |
| | | /* code */ |
| | | if (!ClsVision::TupleNil(m_idModel)) { |
| | | ClsVision::ClearNccModel(m_idModel); |
| | | m_idModel = HalconCpp::HTuple(); |
| | | } |
| | | if (!ClsVision::ObjectExist(m_hImage)) return; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | if (width < 1 || height < 1) return; |
| | | |
| | | m_isScale = false; |
| | | if (width > 120 || height > 120) { |
| | | m_isScale = true; |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | if (width > 120) { |
| | | m_xScale = 120.0f / width; |
| | | } |
| | | if (height > 120) { |
| | | m_yScale = 120.0f / height; |
| | | } |
| | | HalconCpp::HObject hZoomImage; |
| | | HalconCpp::ZoomImageFactor(m_hImage, &hZoomImage, m_xScale, m_yScale, "constant"); |
| | | m_idModel = ClsVision::CreateNccModel(hZoomImage, -15, 15, 0, 2000); |
| | | } |
| | | else { |
| | | m_xScale = 1.0f; |
| | | m_yScale = 1.0f; |
| | | m_idModel = ClsVision::CreateNccModel(m_hImage, -15, 15, 0, 2000); |
| | | } |
| | | } |
| | | |
| | | void CNccDotProcess::setPose(Point2I pose) { |
| | | /* code */ |
| | | m_pos = pose; |
| | | } |
| | | |
| | | Point2I CNccDotProcess::getPose(void) { |
| | | /* code */ |
| | | return m_pos; |
| | | } |
| | | |
| | | void CNccDotProcess::setImage(HalconCpp::HObject &hImage) { |
| | | /* code */ |
| | | m_hImage = hImage; |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) { |
| | | m_pos.x = 0; |
| | | m_pos.y = 0; |
| | | if (!ClsVision::TupleNil(m_idModel)) { |
| | | ClsVision::ClearNccModel(m_idModel); |
| | | m_idModel = HalconCpp::HTuple(); |
| | | } |
| | | } |
| | | else { |
| | | CreateMatchModel(); |
| | | } |
| | | } |
| | | |
| | | HalconCpp::HObject& CNccDotProcess::getImage(void) { |
| | | /* code */ |
| | | return m_hImage; |
| | | } |
| | | |
| | | int CNccDotProcess::getID(void) { |
| | | /* code */ |
| | | return m_id; |
| | | } |
| | | |
| | | Json::Value CNccDotProcess::WriteToJson(std::string &strDir) { |
| | | /* code */ |
| | | int iValue = 0; |
| | | if (ClsVision::ObjectExist(m_hImage)) { |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(m_hImage, width, height); |
| | | if (width > 0 && height > 0) { |
| | | iValue = 1; |
| | | } |
| | | } |
| | | std::string strImage = "NULL"; |
| | | if (1 == iValue) { |
| | | strImage = ClsVision::FormatString("%d_%d_loc", m_eDir, m_id); |
| | | } |
| | | |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = LOC_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["score"] = m_score; |
| | | jsValue["pos x"] = m_pos.x; |
| | | jsValue["pos y"] = m_pos.y; |
| | | jsValue["image file"] = strImage; |
| | | |
| | | std::string imageDir = strDir + "Image\\"; |
| | | if (!CFileRecipe::fileIsExist(imageDir)) { |
| | | CFileRecipe::makeDir(imageDir); |
| | | } |
| | | if (0 == iValue) return jsValue; |
| | | |
| | | std::string fileName = imageDir + strImage + ".jpg"; |
| | | HalconCpp::WriteImage(m_hImage, "jpeg", 0, fileName.c_str()); |
| | | return jsValue; |
| | | } |
| | | |
| | | void CNccDotProcess::DecodeJson(std::string &strDir, Json::Value &jsValue) { |
| | | /* code */ |
| | | if (strDir.empty()) return; |
| | | |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id =jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. score |
| | | strName = "score"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) { |
| | | m_score = jsValue[strName.c_str()].asDouble(); |
| | | } |
| | | |
| | | //5. pos x |
| | | strName = "pos x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_pos.x = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //6. pos y |
| | | strName = "pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_pos.y = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //7. image file |
| | | strName = "image file"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | std::string imgFile = jsValue[strName.c_str()].asString(); |
| | | if (0 != imgFile.compare("NULL")) { |
| | | std::string fileName = strDir + "Image\\" + imgFile + ".jpg"; |
| | | if (CFileRecipe::fileIsExist(fileName)) { |
| | | HalconCpp::ReadImage(&m_hImage, fileName.c_str()); |
| | | CreateMatchModel(); |
| | | } |
| | | } |
| | | else { |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | CreateMatchModel(); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef NCC_DOT_PROCESS_H |
| | | #define NCC_DOT_PROCESS_H |
| | | |
| | | class CNccDotProcess |
| | | { |
| | | public: |
| | | CNccDotProcess(); |
| | | CNccDotProcess(DimensionDir eDir, int id); |
| | | ~CNccDotProcess(); |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | int execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | //2. 设置ä½ç½® |
| | | void setPose(Point2I pose); |
| | | Point2I getPose(void); |
| | | |
| | | //3. 设置å¾å |
| | | void setImage(HalconCpp::HObject &hImage); |
| | | HalconCpp::HObject& getImage(void); |
| | | |
| | | //4. è·åID |
| | | int getID(void); |
| | | |
| | | //5. ä¿åæ°æ® |
| | | Json::Value WriteToJson(std::string &strDir); |
| | | void DecodeJson(std::string &strDir, Json::Value &jsValue); |
| | | |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | double m_score; |
| | | CString m_strName; |
| | | |
| | | Point2D m_ptResult; |
| | | |
| | | |
| | | private: |
| | | Point2I m_pos; |
| | | HalconCpp::HTuple m_idModel; |
| | | int m_id; |
| | | HalconCpp::HObject m_hImage; |
| | | |
| | | double m_xScale; //xè½´ç¼©æ¾æ¯ä¾ |
| | | double m_yScale; //yè½´ç¼©æ¾æ¯ä¾ |
| | | bool m_isScale; //æ¯å¦ç¼©æ¾ |
| | | |
| | | private: |
| | | //1. åå»ºæ¨¡æ¿ |
| | | void CreateMatchModel(void); |
| | | |
| | | //2. æ¥æ¾ä½ç½® |
| | | void findTargetPoint(DimensionDir eDir, Point2I offset); |
| | | |
| | | |
| | | }; |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "RcutDotProcess.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | #include "Bspline.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | CRcutDotProcess::CRcutDotProcess(){ |
| | | /* code */ |
| | | m_id = 0; |
| | | m_strName.Format(_T("Point%d"), m_id); |
| | | m_nPoseX = 0; |
| | | m_nPoseY = 0; |
| | | m_width = 0; |
| | | m_height = 0; |
| | | |
| | | m_nUse = 0; |
| | | m_nChamferSize = 25; |
| | | m_nChipRange = 30; |
| | | m_nChipThres = 50; |
| | | |
| | | m_nStartAngle = 8; |
| | | m_nEndAngle = 82; |
| | | m_nDx = 50; |
| | | m_nDy = 50; |
| | | |
| | | m_nBinThres = 20; |
| | | m_nEdgeSmooth = 1; |
| | | |
| | | m_x1 = -1; |
| | | m_y1 = -1; |
| | | m_xMmvsp = 0.0f; |
| | | m_yMmvsp = 0.0f; |
| | | |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | HalconCpp::GenEmptyObj(&m_hRoiRegion); |
| | | HalconCpp::GenEmptyObj(&m_hChipRegion); |
| | | } |
| | | |
| | | CRcutDotProcess::CRcutDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_id = id; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD_RCut_Dot%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P_RCut_Dot%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P_RCut_Dot%d"), m_id); |
| | | break; |
| | | } |
| | | m_nPoseX = 0; |
| | | m_nPoseY = 0; |
| | | m_width = 0; |
| | | m_height = 0; |
| | | |
| | | m_nUse = 0; |
| | | m_nChamferSize = 25; |
| | | m_nChipRange = 30; |
| | | m_nChipThres = 50; |
| | | |
| | | m_nStartAngle = 8; |
| | | m_nEndAngle = 82; |
| | | m_nDx = 50; |
| | | m_nDy = 50; |
| | | |
| | | m_nBinThres = 20; |
| | | m_nEdgeSmooth = 1; |
| | | |
| | | m_x1 = -1; |
| | | m_y1 = -1; |
| | | m_xMmvsp = 0.0f; |
| | | m_yMmvsp = 0.0f; |
| | | |
| | | HalconCpp::GenEmptyObj(&m_hImage); |
| | | HalconCpp::GenEmptyObj(&m_hRoiRegion); |
| | | HalconCpp::GenEmptyObj(&m_hChipRegion); |
| | | } |
| | | |
| | | CRcutDotProcess::~CRcutDotProcess(){ |
| | | /* code */ |
| | | } |
| | | |
| | | void CRcutDotProcess::getRegion(int &xPos, int &yPos, int &width, int &height){ |
| | | /* code */ |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr == pSideData) return; |
| | | |
| | | //è¿è¡åæ è½¬æ¢ |
| | | Point2I offset; |
| | | offset.x = m_nPoseX; |
| | | offset.y = m_nPoseY; |
| | | Point2I result; |
| | | |
| | | int nType = 1; |
| | | if (1 != m_id) { |
| | | nType = 2; |
| | | } |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, offset, nType, result)) return; |
| | | |
| | | int dWidth = (int)(m_width / pSideData->m_dPixelSizeX + 0.5f); |
| | | int dHeight = (int)(m_height / pSideData->m_dPixelSizeY + 0.5f); |
| | | |
| | | if (1 == m_id) { //Top RCut) |
| | | xPos = result.x - dWidth + 1; |
| | | yPos = result.y - dHeight + 1; |
| | | width = dWidth; |
| | | height = dHeight; |
| | | } |
| | | else { |
| | | xPos = result.x - dWidth + 1; |
| | | yPos = result.y; |
| | | width = dWidth; |
| | | height = dHeight; |
| | | } |
| | | } |
| | | |
| | | void CRcutDotProcess::setRegion(int xPos, int yPos, int width, int height) { |
| | | /* code */ |
| | | //è·åä¾§å
æ°æ® |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr == pSideData) return; |
| | | |
| | | //设置å¾åçåºå |
| | | int x1 = xPos; |
| | | int y1 = yPos; |
| | | int x2 = xPos + width - 1; |
| | | int y2 = yPos + height - 1; |
| | | // Log_GetDebug()->TraceInfo("Trace Set ROI: %d, %d, %d, %d, %d, %d, %d", (int)m_eDir, m_id, x1, y1, x2, y2, __LINE__); |
| | | |
| | | //è®°å½å³ä¸å·¦è¾¹ |
| | | Point2I point; |
| | | if (1 == m_id) { //Top RCut |
| | | point.x = x2; |
| | | point.y = y2; |
| | | } |
| | | else { //Bot RCut |
| | | point.x = x2; |
| | | point.y = y1; |
| | | } |
| | | Point2I pose, ptTop, ptBot; |
| | | if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir,point, pose, ptTop, ptBot)) return; |
| | | |
| | | //设置poseåå®½é« |
| | | if (1 == m_id) { //Top RCut |
| | | m_nPoseX = ptTop.x; |
| | | m_nPoseY = ptTop.y; |
| | | } |
| | | else { |
| | | m_nPoseX = ptBot.x; |
| | | m_nPoseY = ptBot.y; |
| | | } |
| | | m_width = (int)(pSideData->m_dPixelSizeX * width); |
| | | m_height = (int)(pSideData->m_dPixelSizeY * height); |
| | | |
| | | #if 0 |
| | | int x = 0; |
| | | int y = 0; |
| | | int w = 0; |
| | | int h = 0; |
| | | getRegion(x, y, w, h); |
| | | |
| | | Log_GetDebug()->TraceInfo("Trace Input Info: %d, %d, %d, %d, %d", xPos, yPos, width, height, __LINE__); |
| | | Log_GetDebug()->TraceInfo("Trace Input Info: %d, %d, %d, %d, %d", x, y, w, h, __LINE__); |
| | | #endif |
| | | } |
| | | |
| | | int CRcutDotProcess::getID(void) { |
| | | /* code*/ |
| | | return m_id; |
| | | } |
| | | |
| | | void CRcutDotProcess::setID(int id) { |
| | | /* code */ |
| | | m_id = id; |
| | | } |
| | | |
| | | int CRcutDotProcess::Execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_fMaxChamber = 0.0f; |
| | | m_nNgInfo.clear(); |
| | | HalconCpp::GenEmptyObj(&m_hResultRegion); |
| | | if (1 != m_nUse) return 0; |
| | | if (m_width < 1 || m_height < 1) return 0; |
| | | |
| | | //1. è·åè§£é度 |
| | | getMmvsp(eDir); |
| | | |
| | | //2. è·åå¾å |
| | | if (!getProcImage(eDir, offset, m_hImage)) return 0; |
| | | |
| | | //3. Chipæ£æµ |
| | | InspectChip(m_hImage); |
| | | |
| | | //5. è·åç»æ |
| | | getResult(); |
| | | |
| | | //5. æå°æ°æ® |
| | | int nRet = (int)(m_nNgInfo.size()); |
| | | //KeyDebugInfo inf = CVisionRecipe::getInstance()->getKeyInfo(); |
| | | //if (inf.isDebugTool && inf.isCutLineKey) { |
| | | // for (int i = 0; i < nRet; i++) { |
| | | // Log_GetDebug()->TraceInfo("Trace CutLine Result %d: %d, %d, (%.1f, %.1f), %d", |
| | | // (int)m_eDir, m_id, i, m_nNgInfo[i].xResult, m_nNgInfo[i].yResult, __LINE__); |
| | | // } |
| | | //} |
| | | |
| | | return nRet; |
| | | } |
| | | |
| | | void CRcutDotProcess::getResult(void) { |
| | | /* code */ |
| | | int nCount = ClsVision::ObjectNumber(m_hResultRegion); |
| | | if (nCount < 1) return; |
| | | |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = false; |
| | | ng.minValue = m_nDx; |
| | | ng.maxValue = m_nDy; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_Chip; //缺é·ç±»å |
| | | ng.eVision = VISION_RCUT; |
| | | |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | HalconCpp::HTuple hvArea, hvY, hvX; |
| | | HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2; |
| | | HalconCpp::AreaCenter(m_hResultRegion, &hvArea, &hvY, &hvX); |
| | | HalconCpp::SmallestRectangle1(m_hResultRegion, &hvY1, &hvX1, &hvY2, &hvX2); |
| | | for (int i = 0; i < nCount; i++) { |
| | | ng.result = hvArea[i].I(); |
| | | ng.xResult = (int)(m_xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1)); |
| | | ng.yResult = (int)(m_yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1)); |
| | | ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + m_x1; |
| | | ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + m_y1; |
| | | ng.x1 = hvX1[i].I() + m_x1 - 1; |
| | | ng.y1 = hvY1[i].I() + m_y1 - 1; |
| | | ng.x2 = hvX2[i].I() + m_x1 + 1; |
| | | ng.y2 = hvY2[i].I() + m_y1 + 1; |
| | | |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 1; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_RCUT); |
| | | inf.rectX1 = ng.x1; |
| | | inf.rectY1 = ng.y1; |
| | | inf.rectX2 = ng.x2; |
| | | inf.rectY2 = ng.y2; |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | } |
| | | |
| | | void CRcutDotProcess::getMmvsp(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | m_xMmvsp = pSideData->m_dPixelSizeX; |
| | | m_yMmvsp = pSideData->m_dPixelSizeY; |
| | | } |
| | | |
| | | bool CRcutDotProcess::getProcImage(DimensionDir eDir, Point2I offset, HalconCpp::HObject &hImage) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | if (m_width < 1 && m_height < 1) return false; |
| | | if (0 == m_nPoseX && 0 == m_nPoseY) return false; |
| | | |
| | | int left = 0; |
| | | int top = 0; |
| | | int width = 0; |
| | | int height = 0; |
| | | getRegion(left, top, width, height); |
| | | |
| | | int x1 = left; |
| | | int y1 = top; |
| | | int x2 = left + width - 1; |
| | | int y2 = top + height - 1; |
| | | |
| | | m_x1 = x1; |
| | | m_y1 = y1; |
| | | bool bRes = CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2); |
| | | |
| | | // Log_GetDebug()->TraceInfo("Trace ROI: %d, %d, %d, %d, %d, %d", (int)m_eDir, m_id, x1, y1, x2, y2); |
| | | |
| | | return bRes; |
| | | } |
| | | |
| | | void CRcutDotProcess::TechImage(void) { |
| | | /* code */ |
| | | ClsVision::GenEmptyObject(m_hChipRegion); |
| | | ClsVision::GenEmptyObject(m_hRoiRegion); |
| | | |
| | | Point2I offset; |
| | | offset.x = 0; |
| | | offset.y = 0; |
| | | |
| | | Execute(m_eDir, offset); |
| | | } |
| | | |
| | | void CRcutDotProcess::InspectChip(HalconCpp::HObject &hImage) { |
| | | /* code */ |
| | | if (1 == m_id) { |
| | | InspectTopChip(hImage); |
| | | return; |
| | | } |
| | | |
| | | InspectBotChip(hImage); |
| | | } |
| | | |
| | | bool CRcutDotProcess::getRcutEdgePoints(HalconCpp::HObject &hImage, std::vector<Point2D> &vStartPoints, std::vector<Point2D> &vEndPoints, std::vector<Point2D> &vResPoints, double &maxDist, double &minDist) { |
| | | /* code */ |
| | | int width = 0; |
| | | int height = 0; |
| | | minDist = 0.0f; |
| | | maxDist = 0.0f; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) return false; |
| | | |
| | | //HalconCpp::HWindow hDispWin(0, 0, width, height); |
| | | //hDispWin.SetPart(0, 0, height - 1, width - 1); |
| | | //hDispWin.SetColored(6); |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.Click(); |
| | | |
| | | maxDist = 0; |
| | | minDist = MAXINT; |
| | | if (1 == m_id) { |
| | | double radius = sqrt(1.0 * width * width + 1.0 * height * height); |
| | | double centerX = width - 1; |
| | | double centerY = height - 1; |
| | | double angle0 = m_nStartAngle; |
| | | double angle1 = m_nEndAngle; |
| | | double step = 1.0 * (m_nEndAngle - m_nStartAngle) / 15; |
| | | std::vector<Line2D> vLines; |
| | | std::vector<Point2D> vStartResults; |
| | | std::vector<Point2D> vEndResuts; |
| | | std::vector<bool> vFindRes; |
| | | |
| | | for (int i = 0; i < 16; i++) { |
| | | double angle = angle0 + i * step - 90; |
| | | double phi = DegToRad(angle); |
| | | double cosx = cos(phi); |
| | | double sinx = sin(phi); |
| | | double x0 = centerX - radius * cosx; |
| | | double y0 = centerY + radius * sinx; |
| | | HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength; |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 5, -100, 5, 100, &hvRow, &hvColumn, &hvIsOverlapping); |
| | | HalconCpp::TupleLength(hvRow, &hvLength); |
| | | if (hvLength[0].I() < 1) continue; |
| | | double x1 = hvColumn[0].D(); |
| | | double y1 = hvRow[0].D(); |
| | | if (x1 < 0) { |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping); |
| | | HalconCpp::TupleLength(hvRow, &hvLength); |
| | | if (hvLength[0].I() < 1) continue; |
| | | x1 = hvColumn[0].D(); |
| | | y1 = hvRow[0].D(); |
| | | } |
| | | Line2D line; |
| | | line.pt0.x = x1; |
| | | line.pt0.y = y1; |
| | | line.pt1.x = centerX; |
| | | line.pt1.y = centerY; |
| | | Point2D ptStart, ptEnd; |
| | | bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, -1.0f, ptStart, ptEnd); |
| | | vLines.push_back(line); |
| | | vStartResults.push_back(ptStart); |
| | | vEndResuts.push_back(ptEnd); |
| | | vFindRes.push_back(isFind); |
| | | |
| | | //HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2; |
| | | //HalconCpp::GenRegionLine(&hDispRegion, y1, x1, centerY, centerX); |
| | | //if (!isFind) { |
| | | // hDispWin.SetColor("blue"); |
| | | // hDispWin.DispObj(hDispRegion); |
| | | // hDispWin.Click(); |
| | | //} |
| | | if (!isFind) continue; |
| | | |
| | | //HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0); |
| | | //HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0); |
| | | //hDispWin.SetColor("blue"); |
| | | //hDispWin.DispObj(hDispRegion); |
| | | //hDispWin.SetColor("green"); |
| | | //hDispWin.DispObj(hDispObj1); |
| | | //hDispWin.DispObj(hDispObj2); |
| | | //hDispWin.Click(); |
| | | } |
| | | |
| | | double avg = 0.0f; |
| | | double nCount = 0; |
| | | for (int i = 0; i < 16; i++) { |
| | | if (!vFindRes[i]) continue; |
| | | |
| | | double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]); |
| | | avg += dist; |
| | | nCount += 1; |
| | | } |
| | | if (nCount < 3) { |
| | | avg = 0.8 * m_nChamferSize; |
| | | } |
| | | else { |
| | | avg = avg / nCount; |
| | | } |
| | | |
| | | for (int i = 0; i < 16; i++) { |
| | | if (vFindRes[i]) continue; |
| | | |
| | | Line2D line = vLines[i]; |
| | | Point2D ptStart, ptEnd; |
| | | // Log_GetDebug()->TraceInfo("Line %d: %.2f, %.2f, %.2f, %.2f", i, line.pt0.x, line.pt0.y, line.pt1.x, line.pt1.y); |
| | | bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, avg, ptStart, ptEnd); |
| | | |
| | | //HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2; |
| | | //HalconCpp::GenRegionLine(&hDispRegion, line.pt0.y, line.pt0.x, line.pt1.y, line.pt1.x); |
| | | //if (!isFind) { |
| | | // hDispWin.SetColor("blue"); |
| | | // hDispWin.DispObj(hDispRegion); |
| | | // hDispWin.Click(); |
| | | //} |
| | | if (!isFind) continue; |
| | | |
| | | vFindRes[i] = isFind; |
| | | vStartResults[i] = ptStart; |
| | | vEndResuts[i] = ptEnd; |
| | | |
| | | //HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0); |
| | | //HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0); |
| | | //hDispWin.SetColor("blue"); |
| | | //hDispWin.DispObj(hDispRegion); |
| | | //hDispWin.SetColor("green"); |
| | | //hDispWin.DispObj(hDispObj1); |
| | | //hDispWin.DispObj(hDispObj2); |
| | | //hDispWin.Click(); |
| | | } |
| | | |
| | | for (int i = 0; i < 16; i++) { |
| | | if (!vFindRes[i]) continue; |
| | | |
| | | double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]); |
| | | if (dist > maxDist) maxDist = dist; |
| | | if (dist < minDist) minDist = dist; |
| | | vStartPoints.push_back(vStartResults[i]); |
| | | vEndPoints.push_back(vEndResuts[i]); |
| | | Point2D midPoint; |
| | | midPoint.x = 0.5 * (vStartResults[i].x + vEndResuts[i].x); |
| | | midPoint.y = 0.5 * (vStartResults[i].y + vEndResuts[i].y); |
| | | vResPoints.push_back(midPoint); |
| | | } |
| | | |
| | | } |
| | | else { |
| | | double radius = sqrt(1.0 * width * width + 1.0 * height * height); |
| | | double centerX = width - 1; |
| | | double centerY = 0; |
| | | double angle0 = m_nStartAngle; |
| | | double angle1 = m_nEndAngle; |
| | | double step = 1.0 * (m_nEndAngle - m_nStartAngle) / 15; |
| | | |
| | | std::vector<Line2D> vLines; |
| | | std::vector<Point2D> vStartResults; |
| | | std::vector<Point2D> vEndResuts; |
| | | std::vector<bool> vFindRes; |
| | | |
| | | for (int i = 0; i < 16; i++) { |
| | | double angle = angle0 + i * step; |
| | | double phi = DegToRad(angle); |
| | | double cosx = cos(phi); |
| | | double sinx = sin(phi); |
| | | double x0 = centerX - radius * cosx; |
| | | double y0 = centerY + radius * sinx; |
| | | HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength; |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, height - 6, -100, height - 6, 100, &hvRow, &hvColumn, &hvIsOverlapping); |
| | | HalconCpp::TupleLength(hvRow, &hvLength); |
| | | if (hvLength[0].I() < 1) continue; |
| | | double x1 = hvColumn[0].D(); |
| | | double y1 = hvRow[0].D(); |
| | | if (x1 < 0) { |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping); |
| | | HalconCpp::TupleLength(hvRow, &hvLength); |
| | | if (hvLength[0].I() < 1) continue; |
| | | x1 = hvColumn[0].D(); |
| | | y1 = hvRow[0].D(); |
| | | } |
| | | Line2D line; |
| | | line.pt0.x = x1; |
| | | line.pt0.y = y1; |
| | | line.pt1.x = centerX; |
| | | line.pt1.y = centerY; |
| | | Point2D ptStart, ptEnd; |
| | | bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, -1.0f, ptStart, ptEnd); |
| | | vLines.push_back(line); |
| | | vStartResults.push_back(ptStart); |
| | | vEndResuts.push_back(ptEnd); |
| | | vFindRes.push_back(isFind); |
| | | |
| | | //HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2; |
| | | //HalconCpp::GenRegionLine(&hDispRegion, y1, x1, centerY, centerX); |
| | | //if (!isFind) { |
| | | // hDispWin.SetColor("blue"); |
| | | // hDispWin.DispObj(hDispRegion); |
| | | // hDispWin.Click(); |
| | | //} |
| | | if (!isFind) continue; |
| | | |
| | | //HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0); |
| | | //HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0); |
| | | //hDispWin.SetColor("blue"); |
| | | //hDispWin.DispObj(hDispRegion); |
| | | //hDispWin.SetColor("green"); |
| | | //hDispWin.DispObj(hDispObj1); |
| | | //hDispWin.DispObj(hDispObj2); |
| | | //hDispWin.Click(); |
| | | } |
| | | |
| | | double avg = 0.0f; |
| | | double nCount = 0; |
| | | for (int i = 0; i < 16; i++) { |
| | | if (!vFindRes[i]) continue; |
| | | |
| | | double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]); |
| | | avg += dist; |
| | | nCount += 1; |
| | | } |
| | | if (nCount < 3) { |
| | | avg = 0.8 * m_nChamferSize; |
| | | } |
| | | else { |
| | | avg = avg / nCount; |
| | | } |
| | | |
| | | for (int i = 0; i < 16; i++) { |
| | | if (vFindRes[i]) continue; |
| | | |
| | | Line2D line = vLines[i]; |
| | | Point2D ptStart, ptEnd; |
| | | bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, avg, ptStart, ptEnd); |
| | | |
| | | //HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2; |
| | | //HalconCpp::GenRegionLine(&hDispRegion, line.pt0.y, line.pt0.x, line.pt1.y, line.pt1.x); |
| | | //if (!isFind) { |
| | | // hDispWin.SetColor("blue"); |
| | | // hDispWin.DispObj(hDispRegion); |
| | | // hDispWin.Click(); |
| | | //} |
| | | if (!isFind) continue; |
| | | |
| | | vFindRes[i] = isFind; |
| | | vStartResults[i] = ptStart; |
| | | vEndResuts[i] = ptEnd; |
| | | |
| | | //HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0); |
| | | //HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0); |
| | | //hDispWin.SetColor("blue"); |
| | | //hDispWin.DispObj(hDispRegion); |
| | | //hDispWin.SetColor("green"); |
| | | //hDispWin.DispObj(hDispObj1); |
| | | //hDispWin.DispObj(hDispObj2); |
| | | //hDispWin.Click(); |
| | | } |
| | | |
| | | for (int i = 0; i < 16; i++) { |
| | | if (!vFindRes[i]) continue; |
| | | |
| | | double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]); |
| | | if (dist > maxDist) maxDist = dist; |
| | | if (dist < minDist) minDist = dist; |
| | | vStartPoints.push_back(vStartResults[i]); |
| | | vEndPoints.push_back(vEndResuts[i]); |
| | | Point2D midPoint; |
| | | midPoint.x = 0.5 * (vStartResults[i].x + vEndResuts[i].x); |
| | | midPoint.y = 0.5 * (vStartResults[i].y + vEndResuts[i].y); |
| | | vResPoints.push_back(midPoint); |
| | | } |
| | | } |
| | | |
| | | int num = (int)(vStartPoints.size()); |
| | | if (num < 3) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | void CRcutDotProcess::InspectBotChip(HalconCpp::HObject &hImage) { |
| | | /* code */ |
| | | if (2 != m_id) return; |
| | | |
| | | double maxDist = 0.0f; |
| | | double minDist = 0.0f; |
| | | std::vector<Point2D> vStartPoints; |
| | | std::vector<Point2D> vEndPoints; |
| | | std::vector<Point2D> vResPoints; |
| | | if (!getRcutEdgePoints(hImage, vStartPoints, vEndPoints, vResPoints, maxDist, minDist)) return; |
| | | m_fMaxChamber = maxDist; |
| | | m_fMinChamber = minDist; |
| | | |
| | | //int width = 0; |
| | | //int height = 0; |
| | | //ClsVision::GetImageSize(hImage, width, height); |
| | | //HalconCpp::HWindow hDispWin(0, 0, width, height); |
| | | //hDispWin.SetPart(0, 0, height - 1, width - 1); |
| | | //hDispWin.SetColored(6); |
| | | //hDispWin.DispObj(hImage); |
| | | |
| | | //int sz = (int)(vStartPoints.size()); |
| | | //for (int i = 0; i < sz; i++) { |
| | | // HalconCpp::HObject dispObject1, dispObject2; |
| | | // HalconCpp::GenCrossContourXld(&dispObject1, vStartPoints[i].y, vStartPoints[i].x, 15, 0); |
| | | // HalconCpp::GenCrossContourXld(&dispObject2, vEndPoints[i].y, vEndPoints[i].x, 15, 0); |
| | | // hDispWin.DispObj(dispObject1); |
| | | // hDispWin.DispObj(dispObject2); |
| | | //} |
| | | //hDispWin.Click(); |
| | | |
| | | |
| | | HalconCpp::HObject hContourRegion, hChipRegion; |
| | | if (!getRCutRegion(vStartPoints, vEndPoints, hContourRegion, hChipRegion)) return; |
| | | m_hRoiRegion = hContourRegion; |
| | | m_hChipRegion = hChipRegion; |
| | | |
| | | //hDispWin.SetDraw("fill"); |
| | | //hDispWin.DispObj(hContourRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hChipRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HObject hRectRegion, hSelectRegion; |
| | | genRectangeRegion(hRectRegion); |
| | | ImageBinThreshold(hImage, hRectRegion, hContourRegion, hSelectRegion); |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hSelectRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HObject hRealRegion; |
| | | if (!getRCutRealRegion(hSelectRegion, vResPoints, hRealRegion)) return; |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hRealRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | InpsectChipRegion(hRealRegion, hChipRegion); |
| | | } |
| | | |
| | | bool CRcutDotProcess::getRCutRegion(std::vector<Point2D> vStartPoints, std::vector<Point2D> vEndPoints, HalconCpp::HObject &hTargetRegion, HalconCpp::HObject &hRoiRegion) { |
| | | /* code */ |
| | | int num = (int)(vStartPoints.size()); |
| | | if (num < 1) return false; |
| | | |
| | | //1. è·åç¹éµ |
| | | std::vector<vec> vStartCtrlPoint; |
| | | std::vector<vec> vEndCtrlPoint; |
| | | for (int i = 0; i < num; i++) { |
| | | float x0 = (float)vStartPoints[i].x; |
| | | float y0 = (float)vStartPoints[i].y; |
| | | vec p0(x0, y0, 0); |
| | | vStartCtrlPoint.push_back(p0); |
| | | float x1 = (float)vEndPoints[i].x; |
| | | float y1 = (float)vEndPoints[i].y; |
| | | vec p1(x1, y1, 0); |
| | | vEndCtrlPoint.push_back(p1); |
| | | } |
| | | |
| | | //2. æ§è¡æ ·æ¡æå¼ |
| | | CBspline bcurve(vStartCtrlPoint); |
| | | bcurve.execute(); |
| | | CBspline endBcurve(vEndCtrlPoint); |
| | | endBcurve.execute(); |
| | | |
| | | //3. è·åæ ·æ¡å·®å¼è½®å»ç¹ |
| | | int sz = (int)(bcurve.m_vPtResults.size()); |
| | | if (sz < 1) return false; |
| | | HalconCpp::HTuple hvY, hvX; |
| | | for (int i = 0; i < sz; i++) { |
| | | hvX[i] = bcurve.m_vPtResults[i][0]; |
| | | hvY[i] = bcurve.m_vPtResults[i][1]; |
| | | } |
| | | int idx = sz; |
| | | sz = (int)(endBcurve.m_vPtResults.size()); |
| | | if (sz > 0) { |
| | | for (int i = sz - 1; i >= 0; i--) { |
| | | hvX[idx] = endBcurve.m_vPtResults[i][0]; |
| | | hvY[idx] = endBcurve.m_vPtResults[i][1]; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | if (idx < 3) return false; |
| | | |
| | | //4. ç产åºå |
| | | HalconCpp::GenRegionPolygonFilled(&hTargetRegion, hvY, hvX); |
| | | |
| | | HalconCpp::HTuple hvY0, hvX0; |
| | | for (int i = 0; i < sz; i++) { |
| | | hvX0[i] = endBcurve.m_vPtResults[i][0]; |
| | | hvY0[i] = endBcurve.m_vPtResults[i][1]; |
| | | } |
| | | if (1 == m_id) { |
| | | hvX0[sz] = m_width - 1; |
| | | hvY0[sz] = m_height - 1; |
| | | } |
| | | else { |
| | | hvX0[sz] = m_width - 1; |
| | | hvY0[sz] = 0; |
| | | } |
| | | HalconCpp::HObject hRegion1; |
| | | HalconCpp::GenRegionPolygonFilled(&hRegion1, hvY0, hvX0); |
| | | |
| | | HalconCpp::HObject hTempRegion, hTempRegio2, hTempRegio3; |
| | | HalconCpp::DilationCircle(hTargetRegion, &hTempRegion, 2.5); |
| | | HalconCpp::DilationCircle(hTempRegion, &hTempRegio2, m_nChipRange); |
| | | HalconCpp::Difference(hTempRegio2, hTempRegion, &hTempRegio3); |
| | | HalconCpp::Intersection(hTempRegio3, hRegion1, &hRoiRegion); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | void CRcutDotProcess::genRectangeRegion(HalconCpp::HObject &hRectRegion) { |
| | | /* code */ |
| | | if (1 == m_id) { |
| | | double centerX = m_width - 1; |
| | | double centerY = m_height - 1; |
| | | double radius = sqrt(1.0 * m_width * m_width + 1.0 * m_height * m_height); |
| | | |
| | | double x1 = 0.0f; |
| | | double y1 = 0.0f; |
| | | if (true) { //ç´çº¿ |
| | | double angle = m_nStartAngle - 90.0f; |
| | | double phi = DegToRad(angle); |
| | | double cosx = cos(phi); |
| | | double sinx = sin(phi); |
| | | double x0 = centerX - radius * cosx; |
| | | double y0 = centerY + radius * sinx; |
| | | HalconCpp::HTuple hvY, hvX, hvIsOverlapping; |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 0, -100, 0, 100, &hvY, &hvX, &hvIsOverlapping); |
| | | x1 = hvX[0].D(); |
| | | y1 = hvY[0].D(); |
| | | } |
| | | |
| | | double x2 = 0.0f; |
| | | double y2 = 0.0f; |
| | | if (true) { //ç´çº¿ |
| | | double angle = m_nEndAngle - 90.0f; |
| | | double phi = DegToRad(angle); |
| | | double cosx = cos(phi); |
| | | double sinx = sin(phi); |
| | | double x0 = centerX - radius * cosx; |
| | | double y0 = centerY + radius * sinx; |
| | | HalconCpp::HTuple hvY, hvX, hvIsOverlapping; |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 0, 100, 0, &hvY, &hvX, &hvIsOverlapping); |
| | | x2 = hvX[0].D(); |
| | | y2 = hvY[0].D(); |
| | | } |
| | | |
| | | HalconCpp::GenRectangle1(&hRectRegion, 0, 0, y2, x1); |
| | | } |
| | | else { |
| | | double centerX = m_width - 1; |
| | | double centerY = 0; |
| | | double radius = sqrt(1.0 * m_width * m_width + 1.0 * m_height * m_height); |
| | | |
| | | double x1 = 0.0f; |
| | | double y1 = 0.0f; |
| | | if (true) { //ç´çº¿ |
| | | double angle = m_nStartAngle; |
| | | double phi = DegToRad(angle); |
| | | double cosx = cos(phi); |
| | | double sinx = sin(phi); |
| | | double x0 = centerX - radius * cosx; |
| | | double y0 = centerY + radius * sinx; |
| | | HalconCpp::HTuple hvY, hvX, hvIsOverlapping; |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 0, 0, m_height-1, 0, &hvY, &hvX, &hvIsOverlapping); |
| | | y1 = hvY[0].D(); |
| | | } |
| | | |
| | | double x2 = 0.0f; |
| | | double y2 = 0.0f; |
| | | if (true) { //ç´çº¿ |
| | | double angle = m_nEndAngle; |
| | | double phi = DegToRad(angle); |
| | | double cosx = cos(phi); |
| | | double sinx = sin(phi); |
| | | double x0 = centerX - radius * cosx; |
| | | double y0 = centerY + radius * sinx; |
| | | HalconCpp::HTuple hvY, hvX, hvIsOverlapping; |
| | | HalconCpp::IntersectionLines(y0, x0, centerY, centerX, m_height - 1, -100, m_height - 1, 100, &hvY, &hvX, &hvIsOverlapping); |
| | | x2 = hvX[0].D(); |
| | | y2 = m_height - 1; |
| | | } |
| | | |
| | | HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2); |
| | | } |
| | | } |
| | | |
| | | void CRcutDotProcess::ImageBinThreshold(HalconCpp::HObject &hImage, HalconCpp::HObject &hRectRegion, HalconCpp::HObject &hRcutRegion, HalconCpp::HObject &hTarget) { |
| | | /* code */ |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 1 || height < 1) { |
| | | HalconCpp::GenEmptyObj(&hTarget); |
| | | return; |
| | | } |
| | | |
| | | //1. å¾ååå² |
| | | HalconCpp::HObject hProcObject, hBinRegion; |
| | | HalconCpp::ReduceDomain(hImage, hRectRegion, &hProcObject); |
| | | HalconCpp::Threshold(hProcObject, &hBinRegion, 0, m_nChipThres); |
| | | |
| | | //2. å¾ååå¹¶ |
| | | HalconCpp::HObject hTempRegion, hUionRegion, hConRegion; |
| | | HalconCpp::ConcatObj(hRcutRegion, hBinRegion, &hTempRegion); |
| | | HalconCpp::Union1(hTempRegion, &hUionRegion); |
| | | HalconCpp::Connection(hUionRegion, &hConRegion); |
| | | HalconCpp::SelectShape(hConRegion, &hTarget, "area", "and", 500, MAXINT); |
| | | } |
| | | |
| | | bool CRcutDotProcess::getRCutRealRegion(HalconCpp::HObject &hSelectRegion, std::vector<Point2D> vPoints, HalconCpp::HObject &hTarget) { |
| | | /* code */ |
| | | int num = (int)(vPoints.size()); |
| | | if (num < 3) return false; |
| | | |
| | | HalconCpp::HObject hSelRegion; |
| | | HalconCpp::HTuple hvIndex, hvLength; |
| | | HalconCpp::GenEmptyObj(&hSelRegion); |
| | | |
| | | //1. 第ä¸ä¸ªç¹ |
| | | HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[1].y, (int)vPoints[1].x, &hvIndex); |
| | | HalconCpp::TupleLength(hvIndex, &hvLength); |
| | | if (hvLength[0].I() > 0) { |
| | | if (hvIndex[0].I() >= 1) { |
| | | HalconCpp::SelectObj(hSelectRegion, &hSelRegion, hvIndex[0].I()); |
| | | } |
| | | } |
| | | |
| | | //2. ä¸é´ç¹ |
| | | int idx = (int)((num - 1) / 2); |
| | | HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[idx].y, (int)vPoints[idx].x, &hvIndex); |
| | | HalconCpp::TupleLength(hvIndex, &hvLength); |
| | | if (hvLength[0].I() > 0) { |
| | | if (hvIndex[0].I() >= 1) { |
| | | HalconCpp::HObject hTempRegion, hTempRegion1; |
| | | HalconCpp::SelectObj(hSelectRegion, &hTempRegion, hvIndex[0].I()); |
| | | HalconCpp::ConcatObj(hTempRegion, hSelRegion, &hTempRegion1); |
| | | hSelRegion.Clear(); |
| | | hSelRegion = hTempRegion1; |
| | | } |
| | | } |
| | | |
| | | //3. æåä¸ä¸ª |
| | | HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[num - 2].y, (int)vPoints[num - 2].x, &hvIndex); |
| | | HalconCpp::TupleLength(hvIndex, &hvLength); |
| | | if (hvLength[0].I() > 0) { |
| | | if (hvIndex[0].I() >= 1) { |
| | | HalconCpp::HObject hTempRegion, hTempRegion1; |
| | | HalconCpp::SelectObj(hSelectRegion, &hTempRegion, hvIndex[0].I()); |
| | | HalconCpp::ConcatObj(hTempRegion, hSelRegion, &hTempRegion1); |
| | | hSelRegion.Clear(); |
| | | hSelRegion = hTempRegion1; |
| | | } |
| | | } |
| | | HalconCpp::Union1(hSelRegion, &hTarget); |
| | | return true; |
| | | } |
| | | |
| | | void CRcutDotProcess::InspectTopChip(HalconCpp::HObject &hImage) { |
| | | /* code */ |
| | | if (1 != m_id) return; |
| | | |
| | | double maxDist = 0.0f; |
| | | double minDist = 0.0f; |
| | | std::vector<Point2D> vStartPoints; |
| | | std::vector<Point2D> vEndPoints; |
| | | std::vector<Point2D> vResPoints; |
| | | if (!getRcutEdgePoints(hImage, vStartPoints, vEndPoints, vResPoints, maxDist, minDist)) return; |
| | | m_fMaxChamber = maxDist; |
| | | m_fMinChamber = minDist; |
| | | |
| | | //int width = 0; |
| | | //int height = 0; |
| | | //ClsVision::GetImageSize(hImage, width, height); |
| | | //HalconCpp::HWindow hDispWin(0, 0, width, height); |
| | | //hDispWin.SetPart(0, 0, height - 1, width - 1); |
| | | //hDispWin.SetColored(6); |
| | | //hDispWin.DispObj(hImage); |
| | | |
| | | //int sz = (int)(vStartPoints.size()); |
| | | //for (int i = 0; i < sz; i++) { |
| | | // HalconCpp::HObject dispObject1, dispObject2; |
| | | // HalconCpp::GenCrossContourXld(&dispObject1, vStartPoints[i].y, vStartPoints[i].x, 15, 0); |
| | | // HalconCpp::GenCrossContourXld(&dispObject2, vEndPoints[i].y, vEndPoints[i].x, 15, 0); |
| | | // hDispWin.DispObj(dispObject1); |
| | | // hDispWin.DispObj(dispObject2); |
| | | //} |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HObject hContourRegion, hChipRegion; |
| | | if (!getRCutRegion(vStartPoints, vEndPoints, hContourRegion, hChipRegion)) return; |
| | | m_hRoiRegion = hContourRegion; |
| | | m_hChipRegion = hChipRegion; |
| | | |
| | | //hDispWin.SetDraw("fill"); |
| | | //hDispWin.DispObj(hContourRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hChipRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HObject hRectRegion, hSelectRegion; |
| | | genRectangeRegion(hRectRegion); |
| | | ImageBinThreshold(hImage, hRectRegion, hContourRegion, hSelectRegion); |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hSelectRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | HalconCpp::HObject hRealRegion; |
| | | if (!getRCutRealRegion(hSelectRegion, vResPoints, hRealRegion)) return; |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(hRealRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | InpsectChipRegion(hRealRegion, hChipRegion); |
| | | |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.DispObj(m_hResultRegion); |
| | | //hDispWin.Click(); |
| | | } |
| | | |
| | | void CRcutDotProcess::InpsectChipRegion(HalconCpp::HObject &hChipRegion, HalconCpp::HObject &hRoiRegion) { |
| | | /* code */ |
| | | if (m_xMmvsp < 0.001 || m_yMmvsp < 0.001) return; |
| | | |
| | | int fzX = (int)(m_nDx / m_xMmvsp + 0.5f); |
| | | int fzY = (int)(m_nDy / m_yMmvsp + 0.5f); |
| | | |
| | | HalconCpp::HObject hTempRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hUionRegion, hResRegion, hOpenRegion; |
| | | HalconCpp::Intersection(hChipRegion, hRoiRegion, &hTempRegion); |
| | | if (m_nEdgeSmooth > 0) { |
| | | HalconCpp::OpeningCircle(hTempRegion, &hOpenRegion, m_nEdgeSmooth + 0.5); |
| | | } |
| | | else { |
| | | hOpenRegion = hTempRegion; |
| | | } |
| | | HalconCpp::Connection(hOpenRegion, &hConRegion); |
| | | HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT); |
| | | HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT); |
| | | HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion); |
| | | |
| | | HalconCpp::Union1(hConcatRegion, &hUionRegion); |
| | | HalconCpp::Connection(hUionRegion, &hResRegion); |
| | | int num = ClsVision::ObjectNumber(hResRegion); |
| | | if (num < 1) return; |
| | | |
| | | m_hResultRegion = hResRegion; |
| | | } |
| | | |
| | | HalconCpp::HObject& CRcutDotProcess::getImage(void) { |
| | | /* code */ |
| | | return m_hImage; |
| | | } |
| | | |
| | | HalconCpp::HObject& CRcutDotProcess::getChipRegion(void) { |
| | | /* code */ |
| | | return m_hChipRegion; |
| | | } |
| | | |
| | | HalconCpp::HObject& CRcutDotProcess::getRoiRegion(void) { |
| | | /* code */ |
| | | return m_hRoiRegion; |
| | | } |
| | | |
| | | Json::Value CRcutDotProcess::WriteToJson(void) { |
| | | /* code */ |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = RCUT_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["use"] = m_nUse; |
| | | jsValue["pos x"] = m_nPoseX; |
| | | jsValue["pos y"] = m_nPoseY; |
| | | jsValue["width"] = m_width; |
| | | jsValue["height"] = m_height; |
| | | jsValue["chamber size"] = m_nChamferSize; |
| | | jsValue["chamber range"] = m_nChipRange; |
| | | jsValue["chamber thres"] = m_nChipThres; |
| | | jsValue["start angle"] = m_nStartAngle; |
| | | jsValue["end angle"] = m_nEndAngle; |
| | | jsValue["dx"] = m_nDx; |
| | | jsValue["dy"] = m_nDy; |
| | | jsValue["bin thres"] = m_nBinThres; |
| | | jsValue["edge smooth"] = m_nEdgeSmooth; |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CRcutDotProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nUse = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //5. pos x |
| | | strName = "pos x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //6. pos y |
| | | strName = "pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //7. width |
| | | strName = "width"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_width = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //8. height |
| | | strName = "height"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_height = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //9. chamber size |
| | | strName = "chamber size"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nChamferSize = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //10. chamber range |
| | | strName = "chamber range"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nChipRange = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //11. chamber thres |
| | | strName = "chamber thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nChipThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //12. start angle |
| | | strName = "start angle"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nStartAngle = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //13. end angle |
| | | strName = "end angle"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nEndAngle = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //14. dx |
| | | strName = "dx"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nDx = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //15. dy |
| | | strName = "dy"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nDy = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //16. bin thres |
| | | strName = "bin thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nBinThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //17. edge smooth |
| | | strName = "edge smooth"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nEdgeSmooth = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef RCUT_DOT_PROCESS_H |
| | | #define RCUT_DOT_PROCESS_H |
| | | |
| | | class CRcutDotProcess |
| | | { |
| | | public: |
| | | CRcutDotProcess(); |
| | | CRcutDotProcess(DimensionDir eDir, int id); |
| | | ~CRcutDotProcess(); |
| | | |
| | | public: |
| | | //1. è·ååºå |
| | | void getRegion(int &xPos, int &yPos, int &width, int &height); |
| | | void setRegion(int xPos, int yPos, int width, int height); |
| | | |
| | | //2. è·åID |
| | | int getID(void); |
| | | void setID(int id); |
| | | |
| | | //3. è·ååºå |
| | | HalconCpp::HObject& getImage(void); |
| | | HalconCpp::HObject& getChipRegion(void); |
| | | HalconCpp::HObject& getRoiRegion(void); |
| | | |
| | | //4. æ§è¡æ£æµ |
| | | int Execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | //5. åºå示æ |
| | | void TechImage(void); |
| | | |
| | | //6. ä¿åæ°æ® |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | |
| | | public: |
| | | int m_nUse; |
| | | CString m_strName; |
| | | |
| | | int m_nChamferSize; //ç 磨é |
| | | int m_nChipRange; //Chip Range |
| | | int m_nChipThres; //Chipéå¼ |
| | | |
| | | int m_nStartAngle; //å¼å§è§åº¦ |
| | | int m_nEndAngle; //ç»æè§åº¦ |
| | | |
| | | int m_nBinThres; //è¾¹çéå¼ |
| | | int m_nEdgeSmooth; //è¾¹çéå¼ |
| | | |
| | | //Judge XY |
| | | int m_nDx; |
| | | int m_nDy; |
| | | |
| | | |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | double m_fMaxChamber; |
| | | double m_fMinChamber; |
| | | |
| | | private: |
| | | int m_id; |
| | | int m_nPoseX; |
| | | int m_nPoseY; |
| | | int m_width; |
| | | int m_height; |
| | | |
| | | HalconCpp::HObject m_hImage; |
| | | HalconCpp::HObject m_hRoiRegion; |
| | | HalconCpp::HObject m_hChipRegion; |
| | | |
| | | DimensionDir m_eDir; |
| | | int m_x1; |
| | | int m_y1; |
| | | |
| | | double m_xMmvsp; |
| | | double m_yMmvsp; |
| | | HalconCpp::HObject m_hResultRegion; |
| | | |
| | | private: |
| | | //1. è·åå¾å |
| | | bool getProcImage(DimensionDir eDir, Point2I offset, HalconCpp::HObject &hImage); |
| | | |
| | | //2. è·åå辨ç |
| | | void getMmvsp(DimensionDir eDir); |
| | | |
| | | //3. è·åç»æ |
| | | void getResult(void); |
| | | |
| | | //4. è·åå»å½¢ |
| | | void InspectChip(HalconCpp::HObject &hImage); |
| | | |
| | | //5. Topæ£æµ |
| | | void InspectTopChip(HalconCpp::HObject &hImage); |
| | | |
| | | //6. Botæ£æµ |
| | | void InspectBotChip(HalconCpp::HObject &hImage); |
| | | |
| | | //7. è·åRè§åº¦çå°ºå¯¸è½®å» |
| | | bool getRCutRegion(std::vector<Point2D> vStartPoints, std::vector<Point2D> vEndPoints, HalconCpp::HObject &hTargetRegion, HalconCpp::HObject &hRoiRegion); |
| | | |
| | | //8. ç产åºå |
| | | void genRectangeRegion(HalconCpp::HObject &hRectRegion); |
| | | |
| | | //9. å¾ååå² |
| | | void ImageBinThreshold(HalconCpp::HObject &hImage, HalconCpp::HObject &hRectRegion, HalconCpp::HObject &hRcutRegion, HalconCpp::HObject &hTarget); |
| | | |
| | | //10. è·åçå®çRCUTæ¡ |
| | | bool getRCutRealRegion(HalconCpp::HObject &hSelectRegion, std::vector<Point2D> vPoints, HalconCpp::HObject &hTarget); |
| | | |
| | | //11. è·åç¹éµåºå |
| | | bool getRcutEdgePoints(HalconCpp::HObject &hImage, std::vector<Point2D> &vStartPoints, std::vector<Point2D> &vEndPoints, std::vector<Point2D> &vResPoints, double &maxDist, double &minDist); |
| | | |
| | | //12. æ§è¡åºå |
| | | void InpsectChipRegion(HalconCpp::HObject &hChipRegion, HalconCpp::HObject &hRoiRegion); |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "Serializer.h" |
| | | |
| | | |
| | | CSerializer::CSerializer() { |
| | | /* code */ |
| | | } |
| | | |
| | | |
| | | CSerializer::~CSerializer() { |
| | | /* code */ |
| | | } |
| | | |
| | | int CSerializer::SerializedInt32(int& i, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(int)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pBuffer, &i, sizeof(int)); |
| | | return sizeof(int); |
| | | } |
| | | |
| | | int CSerializer::SerializedInt64(__int64& i, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(__int64)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pBuffer, &i, sizeof(__int64)); |
| | | return sizeof(__int64); |
| | | } |
| | | |
| | | int CSerializer::SerializedFloat(float& f, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(float)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pBuffer, &f, sizeof(float)); |
| | | return sizeof(float); |
| | | } |
| | | |
| | | int CSerializer::SerializedDouble(double& d, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(double)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pBuffer, &d, sizeof(double)); |
| | | return sizeof(double); |
| | | } |
| | | |
| | | int CSerializer::SerializedBuffer(void*pScrBuffer, int scrSize, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < scrSize) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pBuffer, pScrBuffer, scrSize); |
| | | return scrSize; |
| | | } |
| | | |
| | | int CSerializer::SerializedString(std::string& str, void* pBuffer, int size) { |
| | | /* code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | |
| | | int len = (int)(str.length()); |
| | | int nRet1 = SerializedInt32(len, pTemp, remainSize); |
| | | if (nRet1 < 0) { |
| | | return nRet1; |
| | | } |
| | | pTemp += nRet1; |
| | | remainSize -= nRet1; |
| | | |
| | | int nRet2 = SerializedBuffer((void*)str.c_str(), len, pTemp, remainSize); |
| | | if (nRet2 < 0) { |
| | | return nRet2; |
| | | } |
| | | |
| | | return nRet1 + nRet2; |
| | | } |
| | | |
| | | int CSerializer::SerializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size) { |
| | | /*code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | |
| | | HalconCpp::HTuple hPoint, hSize; |
| | | HalconCpp::HTuple hSerializedItem; |
| | | HalconCpp::SerializeObject(hObject, &hSerializedItem); |
| | | HalconCpp::GetSerializedItemPtr(hSerializedItem, &hPoint, &hSize); |
| | | |
| | | int len = hSize[0].I(); |
| | | int nRet1 = SerializedInt32(len, pTemp, remainSize); |
| | | if (nRet1 < 0) { |
| | | HalconCpp::ClearSerializedItem(hSerializedItem); |
| | | return nRet1; |
| | | } |
| | | pTemp += nRet1; |
| | | remainSize -= nRet1; |
| | | |
| | | if (remainSize < hSize[0].I()) { |
| | | HalconCpp::ClearSerializedItem(hSerializedItem); |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pTemp, (void*)hPoint.L(), hSize[0].I()); |
| | | return nRet1 + hSize[0].I(); |
| | | } |
| | | |
| | | int CSerializer::DeserializedInt32(int& i, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(int)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(&i, pBuffer, sizeof(int)); |
| | | return sizeof(int); |
| | | } |
| | | |
| | | int CSerializer::DeserializedInt64(__int64& i, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(__int64)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(&i, pBuffer, sizeof(__int64)); |
| | | return sizeof(__int64); |
| | | } |
| | | |
| | | int CSerializer::DeserializedFloat(float& f, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(float)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(&f, pBuffer, sizeof(float)); |
| | | return sizeof(float); |
| | | } |
| | | |
| | | int CSerializer::DeserializedDouble(double& d, void* pBuffer, int size) { |
| | | /* code */ |
| | | if (size < sizeof(double)) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(&d, pBuffer, sizeof(double)); |
| | | return sizeof(double); |
| | | } |
| | | |
| | | int CSerializer::DeserializedBuffer(void*pTarBuffer, int tarSize, void* pBuffer, int size) { |
| | | /*code */ |
| | | if (size < tarSize) { |
| | | return -1; |
| | | } |
| | | |
| | | memcpy(pTarBuffer, pBuffer, tarSize); |
| | | return tarSize; |
| | | } |
| | | |
| | | int CSerializer::DeserializedString(std::string& str, void* pBuffer, int size) { |
| | | /* code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | |
| | | int len = 0; |
| | | int nRet1 = DeserializedInt32(len, pTemp, remainSize); |
| | | if (nRet1 < 0) { |
| | | return nRet1; |
| | | } |
| | | pTemp += nRet1; |
| | | remainSize -= nRet1; |
| | | |
| | | char* pszTemp = new char[len]; |
| | | int nRet2 = DeserializedBuffer(pszTemp, len, pTemp, remainSize); |
| | | if (nRet2 < 0) { |
| | | delete[] pszTemp; |
| | | return nRet2; |
| | | } |
| | | str.clear(); |
| | | str.append(pszTemp, len); |
| | | delete[] pszTemp; |
| | | |
| | | return nRet1 + nRet2; |
| | | } |
| | | |
| | | int CSerializer::DeserializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size) { |
| | | /* code */ |
| | | char* pTemp = (char*)pBuffer; |
| | | int remainSize = size; |
| | | |
| | | int len = 0; |
| | | int nRet1 = DeserializedInt32(len, pTemp, remainSize); |
| | | if (nRet1 < 0) { |
| | | return nRet1; |
| | | } |
| | | pTemp += nRet1; |
| | | remainSize -= nRet1; |
| | | |
| | | |
| | | if (remainSize < len) { |
| | | return nRet1; |
| | | } |
| | | |
| | | HalconCpp::HTuple hSerializedItem; |
| | | HalconCpp::CreateSerializedItemPtr((__int64)pTemp, len, "false", &hSerializedItem); |
| | | HalconCpp::DeserializeObject(&hObject, hSerializedItem); |
| | | |
| | | return nRet1 + len; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef SERIALIZER_H |
| | | #define SERIALIZER_H |
| | | |
| | | #define SERIALIZER_INT_32(i, p, r, uu) nRet = CSerializer::SerializedInt32(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define SERIALIZER_INT_64(i, p, r, uu) nRet = CSerializer::SerializedInt64(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define SERIALIZER_DOUBLE(d, p, r, uu) nRet = CSerializer::SerializedDouble(d, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define SERIALIZER_H_OBJECT(h, p, r, uu) nRet = CSerializer::SerializedHobject(h, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define SERIALIZER_STRING(s, p, r, uu) nRet = CSerializer::SerializedString(s, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define DESERIALIZER_INT_32(i, p, r, uu) nRet = CSerializer::DeserializedInt32(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define DESERIALIZER_INT_64(i, p, r, uu) nRet = CSerializer::DeserializedInt64(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define DESERIALIZER_DOUBLE(d, p, r, uu) nRet = CSerializer::DeserializedDouble(d, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define DESERIALIZER_STRING(s, p, r, uu) nRet = CSerializer::DeserializedString(s, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | #define DESERIALIZER_H_OBJECT(h, p, r, uu) nRet = CSerializer::DeserializedHobject(h, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet; |
| | | |
| | | class CSerializer |
| | | { |
| | | public: |
| | | CSerializer(); |
| | | ~CSerializer(); |
| | | |
| | | public: |
| | | static int SerializedInt32(int& i, void* pBuffer, int size); |
| | | static int SerializedInt64(__int64& i, void* pBuffer, int size); |
| | | static int SerializedFloat(float& f, void* pBuffer, int size); |
| | | static int SerializedDouble(double& d, void* pBuffer, int size); |
| | | static int SerializedBuffer(void*pScrBuffer, int scrSize, void* pBuffer, int size); |
| | | static int SerializedString(std::string& str, void* pBuffer, int size); |
| | | static int SerializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size); |
| | | static int DeserializedInt32(int& i, void* pBuffer, int size); |
| | | static int DeserializedInt64(__int64& i, void* pBuffer, int size); |
| | | static int DeserializedFloat(float& f, void* pBuffer, int size); |
| | | static int DeserializedDouble(double& d, void* pBuffer, int size); |
| | | static int DeserializedBuffer(void*pTarBuffer, int tarSize, void* pBuffer, int size); |
| | | static int DeserializedString(std::string& str, void* pBuffer, int size); |
| | | static int DeserializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size); |
| | | }; |
| | | |
| | | #endif |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "SoftVisionApp.h" |
| | | #include "VisionSetDlg.h" |
| | | #include "VisionRecipe.h" |
| | | #include "BlSideData.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "KeyVisionSetDlg.h" |
| | | #include "TranformCoordinate.h" |
| | | #include "CornerRcutProcess.h" |
| | | #include "FileRecipe.h" |
| | | #include "resource.h" |
| | | #include "BlVisionPro.h" |
| | | #include "ThresProcess.h" |
| | | |
| | | CSoftVisionApp::CSoftVisionApp(){ |
| | | /* code */ |
| | | m_pEvent = nullptr; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | CSoftVisionApp::~CSoftVisionApp(){ |
| | | /* code */ |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | static CSoftVisionApp _gSoftVisionApp; |
| | | CSoftVisionApp* CSoftVisionApp::getInstance(void) { |
| | | /* code */ |
| | | return &_gSoftVisionApp; |
| | | } |
| | | |
| | | int CSoftVisionApp::OpenVisionWindow(void) { |
| | | /* code */ |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CVisionSetDlg dlg; |
| | | dlg.DoModal(); |
| | | int nRet = (int)(::GetLastError()); |
| | | return nRet; |
| | | } |
| | | |
| | | CDialogEx* CSoftVisionApp::CreateVisionWindow(void) { |
| | | /* code */ |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CVisionSetDlg *pDlg = new CVisionSetDlg(); |
| | | pDlg->Create(IDD_DIALOG_VISION_SET, NULL); |
| | | |
| | | return (CDialogEx*)(pDlg); |
| | | } |
| | | |
| | | int CSoftVisionApp::ReleaseWindow(CDialogEx *pDlg) { |
| | | /* code */ |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | |
| | | CVisionSetDlg *pVisionSetDlg = (CVisionSetDlg *)(pDlg); |
| | | if (NULL == pVisionSetDlg) { |
| | | pVisionSetDlg->DestroyWindow(); |
| | | delete pVisionSetDlg; |
| | | pVisionSetDlg = nullptr; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | void CSoftVisionApp::ChangeDimension(CDialogEx *pDlg, int nDir) { |
| | | /* code */ |
| | | if (!CVisionRecipe::getInstance()->getVisionSetOpen()) return; |
| | | |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | |
| | | CVisionSetDlg *pVisionSetDlg = (CVisionSetDlg *)(pDlg); |
| | | if (NULL == pVisionSetDlg) return; |
| | | if (!CVisionRecipe::getInstance()->getVisionSetOpen()) return; |
| | | |
| | | DimensionDir eDir = (DimensionDir)(nDir); |
| | | pVisionSetDlg->ChangeDimension(eDir); |
| | | } |
| | | |
| | | void CSoftVisionApp::SetVisionOpen(BOOL isOpen) { |
| | | /* code */ |
| | | CVisionRecipe::getInstance()->setVisionSetOpen(isOpen); |
| | | } |
| | | |
| | | void CSoftVisionApp::OpenKeySetWindow(void) { |
| | | /* code */ |
| | | AFX_MANAGE_STATE(AfxGetStaticModuleState()); |
| | | CKeyVisionSetDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | Point2I CSoftVisionApp::getPose(int eDir, int xPoxPxl, int yPosPxl) { |
| | | /* code */ |
| | | CTranformCoordinate tranform; |
| | | Point2I pose; |
| | | pose.x = xPoxPxl; |
| | | pose.y = yPosPxl; |
| | | |
| | | return tranform.Execute((DimensionDir)eDir, pose); |
| | | } |
| | | |
| | | int CSoftVisionApp::Execute(int eDir, NgInfo *ngArray) { |
| | | /* code */ |
| | | DimensionDir nDir = (DimensionDir)(eDir); |
| | | KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo(); |
| | | int nRet = 0; |
| | | |
| | | //1. è§è§å®ä½ |
| | | if (0 != ExecuteLoc(nDir)) { |
| | | return nRet; |
| | | } |
| | | |
| | | //2. GrindSize |
| | | if (0 == ExecuteGrind(nDir)) { |
| | | nRet = getGrindResult(nDir ,ngArray); |
| | | } |
| | | |
| | | |
| | | //3. Dist |
| | | if (0 == ExecuteDist(nDir)) { //è·åæ°æ®ç¼ºé·çæ°æ® |
| | | NgInfo ngRCUT[NG_INF_NUM]; |
| | | int nCount = getDistResult(nDir, ngRCUT); |
| | | if (nCount > 0) { |
| | | int nTotal = nRet; |
| | | nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal); |
| | | } |
| | | } |
| | | |
| | | //4. CutLine |
| | | if (0 == ExecuteCut(nDir)) { |
| | | NgInfo ngRCUT[NG_INF_NUM]; |
| | | int nCount = getCutResult(nDir, ngRCUT); |
| | | if (nCount > 0) { |
| | | int nTotal = nRet; |
| | | nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal); |
| | | } |
| | | } |
| | | |
| | | //5. Rcut |
| | | if (0 == ExecuteRCUT(nDir)){ |
| | | NgInfo ngRCUT[NG_INF_NUM]; |
| | | int nCount = getRcutResult(nDir, ngRCUT); |
| | | if (nCount > 0) { |
| | | int nTotal = nRet; |
| | | nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal); |
| | | } |
| | | } |
| | | |
| | | //6. Thres |
| | | if (0 == ExecuteThres(nDir)) { |
| | | NgInfo ngRCUT[NG_INF_NUM]; |
| | | int nCount = getThresResult(nDir, ngRCUT); |
| | | if (nCount > 0) { |
| | | int nTotal = nRet; |
| | | nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal); |
| | | } |
| | | } |
| | | |
| | | //7. Hole |
| | | if (0 == ExecuteHole(nDir)) { |
| | | NgInfo ngRCUT[NG_INF_NUM]; |
| | | int nCount = getHoleResult(nDir, ngRCUT); |
| | | if (nCount > 0) { |
| | | int nTotal = nRet; |
| | | nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal); |
| | | } |
| | | } |
| | | |
| | | return nRet; |
| | | } |
| | | |
| | | //5. 设置åè°æ¶é´ |
| | | void CSoftVisionApp::setImageEventSignal(IVisionEvent *pEvent) { |
| | | /* code */ |
| | | m_pEvent = pEvent; |
| | | } |
| | | |
| | | Point2I CSoftVisionApp::getPointCoor(DimensionDir dir, Point2I point, Point2I ptTop, Point2I ptBot, int nType) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(dir); |
| | | double xMmvsp = pSideData->m_dPixelSizeX; |
| | | double yMmvsp = pSideData->m_dPixelSizeY; |
| | | Point2D posTop, posBot, pose; |
| | | posTop.x = 0.0f; |
| | | posTop.y = 0.0f; |
| | | posBot.x = xMmvsp * (ptBot.x - ptTop.x); |
| | | posBot.y = yMmvsp * (ptBot.y - ptTop.y); |
| | | pose.x = xMmvsp * (point.x - ptTop.x); |
| | | pose.y = yMmvsp * (point.y - ptTop.y); |
| | | |
| | | double dx = xMmvsp * (ptBot.x - ptTop.x); |
| | | double dy = yMmvsp * (ptBot.y - ptTop.y); |
| | | double dist = sqrt(dx * dx + dy * dy); |
| | | std::vector<Point2D> vPtOrigine, vPtReal; |
| | | vPtOrigine.push_back(posTop); |
| | | vPtOrigine.push_back(posBot); |
| | | |
| | | Point2D pt; |
| | | pt.x = 0.0f; |
| | | pt.y = 0.0f; |
| | | vPtReal.push_back(pt); |
| | | pt.x = 0.0f; |
| | | pt.y = dist; |
| | | vPtReal.push_back(pt); |
| | | |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal); |
| | | Point2D ptResult = ClsVision::CoordinateTransform(pose, affine); |
| | | Point2I result; |
| | | if (0 == nType) { |
| | | result.x = (int)(ptResult.x); |
| | | result.y = (int)(ptResult.y); |
| | | } |
| | | else { |
| | | result.x = (int)(ptResult.x - vPtReal[1].x); |
| | | result.y = (int)(ptResult.y - vPtReal[1].y); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | bool CSoftVisionApp::transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult) { |
| | | /* code */ |
| | | topResult.x = 0; |
| | | topResult.y = 0; |
| | | botResult.x = 0; |
| | | botResult.y = 0; |
| | | result.x = 0; |
| | | result.y = 0; |
| | | DimensionDir nDir = (DimensionDir)(eDir); |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(nDir); |
| | | if (NULL == pSideData) return false; |
| | | |
| | | //1. é¦å
计ç®mark line |
| | | if (pSideData->m_bTopMark_Find && pSideData->m_bBotMark_Find){ //è®¡ç® |
| | | Point2I ptTop = pSideData->getPose(0); |
| | | Point2I ptBot = pSideData->getPose(1); |
| | | result = getPointCoor(nDir, point, ptTop, ptBot, 0); |
| | | } |
| | | |
| | | //2. è®¡ç® Top Point |
| | | if (pSideData->m_bTopPoint_Find && pSideData->m_bBotPoint_Find) { //è®¡ç® |
| | | Point2I ptTop = pSideData->getPose(2); |
| | | Point2I ptBot = pSideData->getPose(3); |
| | | topResult = getPointCoor(nDir, point, ptTop, ptBot, 0); |
| | | } |
| | | |
| | | //3. 计ç®Bot Point |
| | | if (pSideData->m_bTopPoint_Find && pSideData->m_bBotPoint_Find) { //è®¡ç® |
| | | Point2I ptTop = pSideData->getPose(2); |
| | | Point2I ptBot = pSideData->getPose(3); |
| | | botResult = getPointCoor(nDir, point, ptTop, ptBot, 1); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool CSoftVisionApp::findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I& result) { |
| | | /* code */ |
| | | if (toLineDist > 0) return false; |
| | | if (nEndThres < 1) return false; |
| | | DimensionDir eDirReal = (DimensionDir)eDir; |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(eDirReal); |
| | | if (nullptr == pSideData) return false; |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | |
| | | Point2I ptOffset; |
| | | ptOffset.x = -1 * toLineDist; |
| | | ptOffset.y = toTopY; |
| | | Point2I leftPoint; |
| | | if (!CVisionBufferPro::TransformToReal(eDirReal, ptOffset, 0, leftPoint)) return false; |
| | | |
| | | double fzSearchRange = 500.0f; |
| | | int nSearchRange = (int)(fzSearchRange / pSideData->m_dPixelSizeX); |
| | | Point2I cutResult; |
| | | if (!CVisionBufferPro::findCutLine(eDirReal, leftPoint, nSearchRange, nEndThres, cutResult)) return false; |
| | | |
| | | result = cutResult; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | double CSoftVisionApp::DistancePL(Point2D pose, Line2D line) { |
| | | /* code */ |
| | | return ClsVision::DistancePL(pose, line); |
| | | } |
| | | |
| | | int CSoftVisionApp::findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, |
| | | int szType, int xFzSize, int yFzSize, CRect* aryResult) { |
| | | /* code */ |
| | | DimensionDir eCurDir = (DimensionDir)eDir; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eCurDir); |
| | | if (nullptr == pSideData) return 0; |
| | | |
| | | int xDefectSize = (int)(1.0f * xFzSize / pSideData->m_dPixelSizeX + 0.5f); |
| | | int yDefectSize = (int)(1.0f * yFzSize / pSideData->m_dPixelSizeY + 0.5f); |
| | | |
| | | int nRet = CVisionBufferPro::findNorchDefect(eCurDir, vPoints, roiRect, nThres, nOffset, nBinThres, szType, xDefectSize, yDefectSize, aryResult); |
| | | return nRet; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteLoc(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isLocUse) return -1; |
| | | |
| | | CLocProcess *dot = pInstance->getLocProcess(eDir); |
| | | if (NULL == dot) return -1; |
| | | dot->execute(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteGrind(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isGrindUse) return -1; |
| | | |
| | | CGrindProcess *dot = pInstance->getGrindProcess(eDir); |
| | | if (NULL == dot) return -1; |
| | | |
| | | dot->Execute(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteDist(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isDistUse) return -1; |
| | | |
| | | CKDistProcess *dot = pInstance->getKDistProcess(eDir); |
| | | if (NULL == dot) return -1; |
| | | |
| | | dot->Execute(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteCut(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isCutUse) return -1; |
| | | |
| | | CCutProcess *dot = pInstance->getCutProcess(eDir); |
| | | if (NULL == dot) return -1; |
| | | |
| | | dot->Execute(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteRCUT(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isRcutUse) return -1; |
| | | |
| | | CCornerRcutProcess *dot = pInstance->getCornerRcutProcess(eDir); |
| | | dot->execute(eDir); |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteThres(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isThresUse) return -1; |
| | | |
| | | CThresProcess *dot = pInstance->getThresProcess(eDir); |
| | | dot->execute(eDir); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::ExecuteHole(DimensionDir eDir) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return -1; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return -1; |
| | | if (!inf.isHoleUse) return -1; |
| | | |
| | | CHoleProcess *dot = pInstance->getHoleProcess(eDir); |
| | | dot->Execute(eDir); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CSoftVisionApp::getGrindResult(DimensionDir eDir, NgInfo *ngResult) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return 0; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return 0; |
| | | if (!inf.isGrindUse) return 0; |
| | | |
| | | CGrindProcess *dot = pInstance->getGrindProcess(eDir); |
| | | if (NULL == dot) return 0; |
| | | |
| | | int nCount = 50; |
| | | int idx = 0; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CGrindDotProcess *distDot = dot->m_dots[i]; |
| | | if (NULL == distDot) continue; |
| | | if (1 != distDot->m_nUse) continue; |
| | | |
| | | int ngNum = (int)(distDot->m_nNgInfo.size()); |
| | | if (ngNum < 1) continue; |
| | | |
| | | for (int j = 0; j < ngNum; j++) { |
| | | if (idx > NG_INF_NUM - 1) continue; //ç¼ºé·æ°éè¿å¤§ |
| | | NgInfo ng; |
| | | ng.eDir = distDot->m_nNgInfo[j].eDir; |
| | | ng.eVision = distDot->m_nNgInfo[j].eVision; |
| | | ng.isRes = distDot->m_nNgInfo[j].isRes; |
| | | ng.id = distDot->m_nNgInfo[j].id; |
| | | ng.minValue = distDot->m_nNgInfo[j].minValue; |
| | | ng.maxValue = distDot->m_nNgInfo[j].maxValue; |
| | | ng.result = distDot->m_nNgInfo[j].result; |
| | | ng.xResult = distDot->m_nNgInfo[j].xResult; |
| | | ng.yResult = distDot->m_nNgInfo[j].yResult; |
| | | ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl; |
| | | ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl; |
| | | ng.x1 = distDot->m_nNgInfo[j].x1; |
| | | ng.y1 = distDot->m_nNgInfo[j].y1; |
| | | ng.x2 = distDot->m_nNgInfo[j].x2; |
| | | ng.y2 = distDot->m_nNgInfo[j].y2; |
| | | ng.ngType = distDot->m_nNgInfo[j].ngType; |
| | | ng.strName = distDot->m_nNgInfo[j].strName; |
| | | ngResult[idx] = ng; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | return idx; |
| | | } |
| | | |
| | | int CSoftVisionApp::getDistResult(DimensionDir eDir, NgInfo *ngResult) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return 0; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return 0; |
| | | if (!inf.isDistUse) return 0; |
| | | |
| | | CKDistProcess *dot = pInstance->getKDistProcess(eDir); |
| | | if (NULL == dot) return 0; |
| | | |
| | | int nCount = 50; |
| | | int idx = 0; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CKeyDistDotProcess *distDot = dot->m_dots[i]; |
| | | if (NULL == distDot) continue; |
| | | if (1 != distDot->m_nUse) continue; |
| | | |
| | | int ngNum = (int)(distDot->m_nNgInfo.size()); |
| | | if (ngNum < 1) continue; |
| | | |
| | | for (int j = 0; j < ngNum; j++) { |
| | | if(idx > NG_INF_NUM-1) continue; //ç¼ºé·æ°éè¿å¤§ |
| | | NgInfo ng; |
| | | ng.eDir = distDot->m_nNgInfo[j].eDir; |
| | | ng.eVision = distDot->m_nNgInfo[j].eVision; |
| | | ng.isRes = distDot->m_nNgInfo[j].isRes; |
| | | ng.id = distDot->m_nNgInfo[j].id; |
| | | ng.minValue = distDot->m_nNgInfo[j].minValue; |
| | | ng.maxValue = distDot->m_nNgInfo[j].maxValue; |
| | | ng.result = distDot->m_nNgInfo[j].result; |
| | | ng.xResult = distDot->m_nNgInfo[j].xResult; |
| | | ng.yResult = distDot->m_nNgInfo[j].yResult; |
| | | ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl; |
| | | ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl; |
| | | ng.x1 = distDot->m_nNgInfo[j].x1; |
| | | ng.y1 = distDot->m_nNgInfo[j].y1; |
| | | ng.x2 = distDot->m_nNgInfo[j].x2; |
| | | ng.y2 = distDot->m_nNgInfo[j].y2; |
| | | ng.ngType = distDot->m_nNgInfo[j].ngType; |
| | | ng.strName = distDot->m_nNgInfo[j].strName; |
| | | ngResult[idx] = ng; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | return idx; |
| | | } |
| | | |
| | | int CSoftVisionApp::getCutResult(DimensionDir eDir, NgInfo *ngResult) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return 0; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return 0; |
| | | if (!inf.isCutUse) return 0; |
| | | |
| | | CCutProcess *dot = pInstance->getCutProcess(eDir); |
| | | if (NULL == dot) return 0; |
| | | |
| | | int nCount = 50; |
| | | int idx = 0; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CCutDotProcess *distDot = dot->m_dots[i]; |
| | | if (NULL == distDot) continue; |
| | | if (1 != distDot->m_nUse) continue; |
| | | |
| | | int ngNum = (int)(distDot->m_nNgInfo.size()); |
| | | if (ngNum < 1) continue; |
| | | |
| | | for (int j = 0; j < ngNum; j++) { |
| | | if (idx > NG_INF_NUM - 1) continue; //ç¼ºé·æ°éè¿å¤§ |
| | | NgInfo ng; |
| | | ng.eDir = distDot->m_nNgInfo[j].eDir; |
| | | ng.eVision = distDot->m_nNgInfo[j].eVision; |
| | | ng.isRes = distDot->m_nNgInfo[j].isRes; |
| | | ng.id = distDot->m_nNgInfo[j].id; |
| | | ng.minValue = distDot->m_nNgInfo[j].minValue; |
| | | ng.maxValue = distDot->m_nNgInfo[j].maxValue; |
| | | ng.result = distDot->m_nNgInfo[j].result; |
| | | ng.xResult = distDot->m_nNgInfo[j].xResult; |
| | | ng.yResult = distDot->m_nNgInfo[j].yResult; |
| | | ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl; |
| | | ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl; |
| | | ng.x1 = distDot->m_nNgInfo[j].x1; |
| | | ng.y1 = distDot->m_nNgInfo[j].y1; |
| | | ng.x2 = distDot->m_nNgInfo[j].x2; |
| | | ng.y2 = distDot->m_nNgInfo[j].y2; |
| | | ng.ngType = distDot->m_nNgInfo[j].ngType; |
| | | ng.strName = distDot->m_nNgInfo[j].strName; |
| | | ngResult[idx] = ng; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | return idx; |
| | | } |
| | | |
| | | int CSoftVisionApp::getRcutResult(DimensionDir eDir, NgInfo *ngResult) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return 0; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return 0; |
| | | if (!inf.isRcutUse) return 0; |
| | | |
| | | CCornerRcutProcess *dot = pInstance->getCornerRcutProcess(eDir); |
| | | if (NULL == dot) return 0; |
| | | |
| | | int nCount = 2; |
| | | int idx = 0; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CRcutDotProcess *pRcut = dot->m_dots[i]; |
| | | if (NULL == pRcut) continue; |
| | | if (1 != pRcut->m_nUse) continue; |
| | | |
| | | int ngNum = (int)(pRcut->m_nNgInfo.size()); |
| | | if (ngNum < 1) continue; |
| | | |
| | | for (int j = 0; j < ngNum; j++) { |
| | | if (idx > NG_INF_NUM - 1) continue; //ç¼ºé·æ°éè¿å¤§ |
| | | NgInfo ng; |
| | | ng.eDir = pRcut->m_nNgInfo[j].eDir; |
| | | ng.eVision = pRcut->m_nNgInfo[j].eVision; |
| | | ng.isRes = pRcut->m_nNgInfo[j].isRes; |
| | | ng.id = pRcut->m_nNgInfo[j].id; |
| | | ng.minValue = pRcut->m_nNgInfo[j].minValue; |
| | | ng.maxValue = pRcut->m_nNgInfo[j].maxValue; |
| | | ng.result = pRcut->m_nNgInfo[j].result; |
| | | ng.xResult = pRcut->m_nNgInfo[j].xResult; |
| | | ng.yResult = pRcut->m_nNgInfo[j].yResult; |
| | | ng.xPosPxl = pRcut->m_nNgInfo[j].xPosPxl; |
| | | ng.yPosPxl = pRcut->m_nNgInfo[j].yPosPxl; |
| | | ng.x1 = pRcut->m_nNgInfo[j].x1; |
| | | ng.y1 = pRcut->m_nNgInfo[j].y1; |
| | | ng.x2 = pRcut->m_nNgInfo[j].x2; |
| | | ng.y2 = pRcut->m_nNgInfo[j].y2; |
| | | ng.ngType = pRcut->m_nNgInfo[j].ngType; |
| | | ng.strName = pRcut->m_nNgInfo[j].strName; |
| | | ngResult[idx] = ng; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | return idx; |
| | | } |
| | | |
| | | int CSoftVisionApp::getThresResult(DimensionDir eDir, NgInfo *ngResult) { |
| | | /* code */ |
| | | CVisionRecipe *pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return 0; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return 0; |
| | | if (!inf.isThresUse) return 0; |
| | | |
| | | CThresProcess *dot = pInstance->getThresProcess(eDir); |
| | | if (NULL == dot) return 0; |
| | | |
| | | int nCount = 12; |
| | | int idx = 0; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CThresDotProcess *pThres = dot->m_dots[i]; |
| | | if (NULL == pThres) continue; |
| | | if (1 != pThres->m_nUse) continue; |
| | | |
| | | int ngNum = (int)(pThres->m_nNgInfo.size()); |
| | | if (ngNum < 1) continue; |
| | | |
| | | for (int j = 0; j < ngNum; j++) { |
| | | if (idx > NG_INF_NUM - 1) continue; //ç¼ºé·æ°éè¿å¤§ |
| | | NgInfo ng; |
| | | ng.eDir = pThres->m_nNgInfo[j].eDir; |
| | | ng.eVision = pThres->m_nNgInfo[j].eVision; |
| | | ng.isRes = pThres->m_nNgInfo[j].isRes; |
| | | ng.id = pThres->m_nNgInfo[j].id; |
| | | ng.minValue = pThres->m_nNgInfo[j].minValue; |
| | | ng.maxValue = pThres->m_nNgInfo[j].maxValue; |
| | | ng.result = pThres->m_nNgInfo[j].result; |
| | | ng.xResult = pThres->m_nNgInfo[j].xResult; |
| | | ng.yResult = pThres->m_nNgInfo[j].yResult; |
| | | ng.xPosPxl = pThres->m_nNgInfo[j].xPosPxl; |
| | | ng.yPosPxl = pThres->m_nNgInfo[j].yPosPxl; |
| | | ng.x1 = pThres->m_nNgInfo[j].x1; |
| | | ng.y1 = pThres->m_nNgInfo[j].y1; |
| | | ng.x2 = pThres->m_nNgInfo[j].x2; |
| | | ng.y2 = pThres->m_nNgInfo[j].y2; |
| | | ng.ngType = pThres->m_nNgInfo[j].ngType; |
| | | ng.strName = pThres->m_nNgInfo[j].strName; |
| | | ngResult[idx] = ng; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | return idx; |
| | | } |
| | | |
| | | int CSoftVisionApp::getHoleResult(DimensionDir eDir, NgInfo* ngResult) { |
| | | /* code */ |
| | | CVisionRecipe* pInstance = CVisionRecipe::getInstance(); |
| | | if (NULL == pInstance) return 0; |
| | | |
| | | VisionUseInfo inf = pInstance->getVisionUse(eDir); |
| | | if (!inf.isVisionUse) return 0; |
| | | if (!inf.isHoleUse) return 0; |
| | | |
| | | CHoleProcess* dot = pInstance->getHoleProcess(eDir); |
| | | if (NULL == dot) return 0; |
| | | |
| | | int nCount = 4; |
| | | int idx = 0; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CHoleDotProcess* pThres = dot->m_dots[i]; |
| | | if (NULL == pThres) continue; |
| | | if (1 != pThres->m_nUse) continue; |
| | | |
| | | int ngNum = (int)(pThres->m_nNgInfo.size()); |
| | | if (ngNum < 1) continue; |
| | | |
| | | for (int j = 0; j < ngNum; j++) { |
| | | if (idx > NG_INF_NUM - 1) continue; //ç¼ºé·æ°éè¿å¤§ |
| | | NgInfo ng; |
| | | ng.eDir = pThres->m_nNgInfo[j].eDir; |
| | | ng.eVision = pThres->m_nNgInfo[j].eVision; |
| | | ng.isRes = pThres->m_nNgInfo[j].isRes; |
| | | ng.id = pThres->m_nNgInfo[j].id; |
| | | ng.minValue = pThres->m_nNgInfo[j].minValue; |
| | | ng.maxValue = pThres->m_nNgInfo[j].maxValue; |
| | | ng.result = pThres->m_nNgInfo[j].result; |
| | | ng.xResult = pThres->m_nNgInfo[j].xResult; |
| | | ng.yResult = pThres->m_nNgInfo[j].yResult; |
| | | ng.xPosPxl = pThres->m_nNgInfo[j].xPosPxl; |
| | | ng.yPosPxl = pThres->m_nNgInfo[j].yPosPxl; |
| | | ng.x1 = pThres->m_nNgInfo[j].x1; |
| | | ng.y1 = pThres->m_nNgInfo[j].y1; |
| | | ng.x2 = pThres->m_nNgInfo[j].x2; |
| | | ng.y2 = pThres->m_nNgInfo[j].y2; |
| | | ng.ngType = pThres->m_nNgInfo[j].ngType; |
| | | ng.strName = pThres->m_nNgInfo[j].strName; |
| | | ngResult[idx] = ng; |
| | | idx += 1; |
| | | } |
| | | } |
| | | |
| | | return idx; |
| | | } |
| | | |
| | | int CSoftVisionApp::addResultToTotal(NgInfo *ngInfo, int nCount, NgInfo *ngTotal, int nTotal) { |
| | | /* code */ |
| | | int ngRes = nTotal; |
| | | if (nCount < 1) return ngRes; |
| | | |
| | | int fzNum = NG_INF_NUM - 1; |
| | | for (int i = 0; i < nCount; i++) { |
| | | if (ngRes > fzNum) continue; |
| | | NgInfo ng = ngInfo[i]; |
| | | ngTotal[ngRes] = ng; |
| | | ngRes += 1; |
| | | } |
| | | |
| | | return ngRes; |
| | | } |
| | | |
| | | void CSoftVisionApp::sendMessage(int code, int eDir) { |
| | | /* code */ |
| | | if (nullptr == m_pEvent) return; |
| | | if (NULL == m_pEvent->m_msgRcvCb) return; |
| | | |
| | | m_pEvent->m_msgRcvCb(code, eDir); |
| | | } |
| | | |
| | | void CSoftVisionApp::Log(int level, std::string strText) { |
| | | /* code */ |
| | | if (nullptr == m_pEvent) return; |
| | | if (NULL == m_pEvent->m_msgLogCb) return; |
| | | |
| | | Lock(); |
| | | m_pEvent->m_msgLogCb(level, strText); |
| | | Unlock(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef SOFT_VISION_APP_H |
| | | #define SOFT_VISION_APP_H |
| | | |
| | | #include <iostream> |
| | | #include <stdio.h> |
| | | #include "ISoftVisionApp.h" |
| | | class CSoftVisionApp : public ISoftVisionApp |
| | | { |
| | | public: |
| | | CSoftVisionApp(); |
| | | ~CSoftVisionApp(); |
| | | |
| | | static CSoftVisionApp* getInstance(void); |
| | | |
| | | public: |
| | | //1. æå¼è§è§çªä½ |
| | | virtual int OpenVisionWindow(void); |
| | | virtual CDialogEx* CreateVisionWindow(void); |
| | | virtual int ReleaseWindow(CDialogEx *pDlg); |
| | | virtual void ChangeDimension(CDialogEx *pDlg, int nDir); |
| | | virtual void SetVisionOpen(BOOL isOpen); |
| | | |
| | | //2. 设置å±è½ |
| | | virtual void OpenKeySetWindow(void); |
| | | |
| | | //3. åæ è½¬æ¢ |
| | | virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl); |
| | | |
| | | //4. æ§è¡è§è§å¤ç |
| | | virtual int Execute(int eDir, NgInfo *ngArray); |
| | | //5. 设置åè°æ¶é´ |
| | | virtual void setImageEventSignal(IVisionEvent *pEvent); |
| | | //6. åæ ç³»è½¬æ¢ |
| | | virtual bool transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult); |
| | | //7. æ£æµCut线 |
| | | virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I& result); |
| | | virtual double DistancePL(Point2D pose, Line2D line); |
| | | |
| | | //8. æ£æµNorchç¼ºé· |
| | | virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, |
| | | int szType, int xFzSize, int yFzSize, CRect* aryResult); |
| | | |
| | | //5. è·åè·ç¦»çç»æ |
| | | int getDistResult(DimensionDir eDir, NgInfo *ngResult); |
| | | |
| | | //6. è·åRCUTçç¼ºé· |
| | | int getRcutResult(DimensionDir eDir, NgInfo *ngResult); |
| | | |
| | | //6.1 è·åTHresç»æ |
| | | int getThresResult(DimensionDir eDir, NgInfo *ngResult); |
| | | |
| | | //6. è·åHoleç»æ |
| | | int getHoleResult(DimensionDir eDir, NgInfo *ngResult); |
| | | |
| | | //7. è·åGrindç»æ |
| | | int getGrindResult(DimensionDir eDir, NgInfo *ngResult); |
| | | |
| | | //8. è·åCutç»æ |
| | | int getCutResult(DimensionDir eDir, NgInfo *ngResult); |
| | | |
| | | //9 设置åè°ä¿¡æ¯ |
| | | void sendMessage(int code, int eDir); |
| | | |
| | | //10. æå°æ¥å¿ |
| | | void Log(int level, std::string strText); |
| | | |
| | | private: |
| | | IVisionEvent *m_pEvent; |
| | | CRITICAL_SECTION m_criticalSection; |
| | | |
| | | private: |
| | | inline void Lock() { EnterCriticalSection(&m_criticalSection); } |
| | | inline void Unlock() { LeaveCriticalSection(&m_criticalSection); } |
| | | |
| | | //1. æ§è¡è§è§å®ä½ |
| | | int ExecuteLoc(DimensionDir eDir); |
| | | |
| | | //2. GrendSize |
| | | int ExecuteGrind(DimensionDir eDir); |
| | | |
| | | //3. è§è§å®ä½ |
| | | int ExecuteDist(DimensionDir eDir); |
| | | |
| | | //4. Cutæ£æµ |
| | | int ExecuteCut(DimensionDir eDir); |
| | | |
| | | //5. RCUTæ£æµ |
| | | int ExecuteRCUT(DimensionDir eDir); |
| | | |
| | | //6. è§è§æ£æµ |
| | | int ExecuteThres(DimensionDir eDir); |
| | | |
| | | //7. Holeæ£æµ |
| | | int ExecuteHole(DimensionDir eDir); |
| | | |
| | | //6. æ°æ®ç»æåå¹¶ |
| | | int addResultToTotal(NgInfo *ngInfo, int nCount, NgInfo *ngTotal, int nTotal); |
| | | |
| | | //7. è·åè·ç¦» |
| | | Point2I getPointCoor(DimensionDir dir, Point2I point, Point2I ptTop, Point2I ptBot, int nType); |
| | | |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "ThresDotProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "FileRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | |
| | | CThresDotProcess::CThresDotProcess(){ |
| | | /* code */ |
| | | m_nUse = 0; |
| | | m_id = 0; |
| | | m_strName.Format(_T("Point%d"), m_id); |
| | | |
| | | m_minThres = 60; |
| | | m_maxThres = 255; |
| | | |
| | | m_minSizeX = 50; |
| | | m_minSizeY = 50; |
| | | m_eDir = DIMENSION_NONE; |
| | | m_nPoseX = 0; |
| | | m_nPoseY = 0; |
| | | m_width = 0; |
| | | m_height = 0; |
| | | m_nSmoothSize = 2; |
| | | m_poseType = 0; |
| | | } |
| | | |
| | | CThresDotProcess::CThresDotProcess(DimensionDir eDir, int id) { |
| | | /* code */ |
| | | m_eDir = eDir; |
| | | m_nUse = 0; |
| | | m_id = id; |
| | | switch (eDir) { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | m_strName.Format(_T("TopA_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | m_strName.Format(_T("TopB_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | m_strName.Format(_T("TopC_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | m_strName.Format(_T("TopD_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | m_strName.Format(_T("BotA_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | m_strName.Format(_T("BotB_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | m_strName.Format(_T("BotC_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | m_strName.Format(_T("BotD_T%d"), m_id); |
| | | break; |
| | | case GLOBAL_DEFINE::DIMENSION_NONE: |
| | | m_strName.Format(_T("P_T%d"), m_id); |
| | | break; |
| | | default: |
| | | m_strName.Format(_T("P_T%d"), m_id); |
| | | break; |
| | | } |
| | | |
| | | m_minThres = 60; |
| | | m_maxThres = 255; |
| | | m_nSmoothSize = 2; |
| | | |
| | | m_minSizeX = 50; |
| | | m_minSizeY = 50; |
| | | m_nPoseX = 0; |
| | | m_nPoseY = 0; |
| | | m_width = 0; |
| | | m_height = 0; |
| | | m_poseType = 0; |
| | | } |
| | | |
| | | CThresDotProcess::~CThresDotProcess(){ |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | } |
| | | |
| | | bool CThresDotProcess::ExecChip(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (NULL == pSideData) return false; |
| | | if (0 == m_poseType) { |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | } |
| | | else { |
| | | if (!pSideData->m_bTopPoint_Find) return false; |
| | | if (!pSideData->m_bBotPoint_Find) return false; |
| | | } |
| | | |
| | | int x = 0; |
| | | int y = 0; |
| | | int width = 0; |
| | | int height = 0; |
| | | getRegion(x, y, width, height); |
| | | |
| | | int x1 = x; |
| | | int y1 = y; |
| | | int x2 = x1 + width - 1; |
| | | int y2 = y1 + height - 1; |
| | | m_ptLeftTop.x = x1; |
| | | m_ptLeftTop.y = y1; |
| | | // Log_GetDebug()->TraceInfo("Trace ROI: (%d, %d, %d, %d), %d", x1, y1, x2, y2, __LINE__); |
| | | |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 1; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_THRES); |
| | | inf.rectX1 = x1; |
| | | inf.rectY1 = y1; |
| | | inf.rectX2 = x2; |
| | | inf.rectY2 = y2; |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | |
| | | inf.nType = 4; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_THRES); |
| | | inf.pointX = x1; |
| | | inf.pointY = y1; |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | HalconCpp::HObject hImage; |
| | | if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return false; |
| | | |
| | | //HalconCpp::HWindow hDispWin(0, 0, m_width, m_height); |
| | | //hDispWin.SetPart(0, 0, m_height - 1, m_width - 1); |
| | | //hDispWin.SetColored(6); |
| | | //hDispWin.DispObj(hImage); |
| | | //hDispWin.Click(); |
| | | |
| | | |
| | | int fzX = (int)(m_minSizeX / m_xMmvsp + 0.5f); |
| | | int fzY = (int)(m_minSizeY / m_yMmvsp + 0.5f); |
| | | |
| | | HalconCpp::HObject hResultRegion; |
| | | HalconCpp::GenEmptyObj(&hResultRegion); |
| | | if (m_minThres > 0) { |
| | | HalconCpp::HObject hRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hOpenRegion; |
| | | HalconCpp::Threshold(hImage, &hRegion, 0, m_minThres); |
| | | if (m_nSmoothSize > 0) { |
| | | double fSmoothSize = m_nSmoothSize + 0.5; |
| | | HalconCpp::OpeningCircle(hRegion, &hOpenRegion, fSmoothSize); |
| | | } |
| | | else { |
| | | hOpenRegion = hRegion; |
| | | } |
| | | HalconCpp::Connection(hOpenRegion, &hConRegion); |
| | | HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT); |
| | | HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT); |
| | | HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion); |
| | | HalconCpp::Union1(hConcatRegion, &hResultRegion); |
| | | } |
| | | |
| | | if (m_maxThres < 255) { |
| | | HalconCpp::HObject hRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hOpenRegion, hUnionRegion; |
| | | HalconCpp::Threshold(hImage, &hRegion, m_maxThres, 255); |
| | | if (m_nSmoothSize > 0) { |
| | | double fSmoothSize = m_nSmoothSize + 0.5; |
| | | HalconCpp::OpeningCircle(hRegion, &hOpenRegion, fSmoothSize); |
| | | } |
| | | else { |
| | | hOpenRegion = hRegion; |
| | | } |
| | | HalconCpp::Connection(hOpenRegion, &hConRegion); |
| | | HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT); |
| | | HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT); |
| | | HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion); |
| | | HalconCpp::Union1(hConcatRegion, &hUnionRegion); |
| | | HalconCpp::GenEmptyObj(&hResultRegion); |
| | | hResultRegion.Clear(); |
| | | hResultRegion = hUnionRegion; |
| | | } |
| | | |
| | | HalconCpp::HObject hConRegion; |
| | | HalconCpp::Connection(hResultRegion, &hConRegion); |
| | | //hDispWin.DispObj(hConRegion); |
| | | //hDispWin.Click(); |
| | | |
| | | int nCount = ClsVision::ObjectNumber(hConRegion); |
| | | if (nCount < 1) return false; |
| | | |
| | | getResult(hConRegion); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | void CThresDotProcess::getResult(HalconCpp::HObject &hResultRegion) { |
| | | /* code */ |
| | | int nCount = ClsVision::ObjectNumber(hResultRegion); |
| | | if (nCount < 1) return; |
| | | |
| | | NgDotInfo ng; |
| | | ng.eDir = m_eDir; |
| | | ng.id = m_id; |
| | | ng.isRes = false; |
| | | ng.minValue = m_minSizeX; |
| | | ng.maxValue = m_minSizeY; |
| | | ng.strName = m_strName; |
| | | ng.ngType = DefectLoc_Chip; //缺é·ç±»å |
| | | ng.eVision = VISION_THRES; |
| | | |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | HalconCpp::HTuple hvArea, hvY, hvX; |
| | | HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2; |
| | | HalconCpp::AreaCenter(hResultRegion, &hvArea, &hvY, &hvX); |
| | | HalconCpp::SmallestRectangle1(hResultRegion, &hvY1, &hvX1, &hvY2, &hvX2); |
| | | for (int i = 0; i < nCount; i++) { |
| | | ng.result = hvArea[i].I(); |
| | | ng.xResult = (int)(m_xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1)); |
| | | ng.yResult = (int)(m_yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1)); |
| | | ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + m_ptLeftTop.x; |
| | | ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + m_ptLeftTop.y; |
| | | ng.x1 = hvX1[i].I() + m_ptLeftTop.x - 1; |
| | | ng.y1 = hvY1[i].I() + m_ptLeftTop.y - 1; |
| | | ng.x2 = hvX2[i].I() + m_ptLeftTop.x + 1; |
| | | ng.y2 = hvY2[i].I() + m_ptLeftTop.y + 1; |
| | | |
| | | if (nullptr != pSideData) { //åºåçæ¾ç¤ºç»æ |
| | | DispVisionResult inf; |
| | | inf.nType = 1; |
| | | inf.strName = m_strName; |
| | | inf.eDir = (int)(m_eDir); |
| | | inf.eVision = (int)(VISION_THRES); |
| | | inf.rectX1 = ng.x1; |
| | | inf.rectY1 = ng.y1; |
| | | inf.rectX2 = ng.x2; |
| | | inf.rectY2 = ng.y2; |
| | | pSideData->m_vDispVisionResult.push_back(inf); |
| | | } |
| | | |
| | | m_nNgInfo.push_back(ng); |
| | | } |
| | | } |
| | | |
| | | void CThresDotProcess::getRegion(int &xPos, int &yPos, int &width, int &height) { |
| | | /* code */ |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr == pSideData) return; |
| | | |
| | | //è·ååæ |
| | | Point2I offset, result; |
| | | offset.x = m_nPoseX; |
| | | offset.y = m_nPoseY; |
| | | if (!CVisionBufferPro::TransformToReal(m_eDir, offset, m_poseType, result)) return; |
| | | |
| | | xPos = result.x; |
| | | yPos = result.y; |
| | | width = (int)(m_width / pSideData->m_dPixelSizeX); |
| | | height = (int)(m_height / pSideData->m_dPixelSizeY); |
| | | } |
| | | |
| | | void CThresDotProcess::setRegion(int xPos, int yPos, int width, int height) { |
| | | /* code */ |
| | | //设置å¾åçROIåºå |
| | | CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); |
| | | if (nullptr == pSideData) return; |
| | | |
| | | //设置å¾åçåºå |
| | | int x1 = xPos; |
| | | int y1 = yPos; |
| | | int x2 = xPos + width - 1; |
| | | int y2 = yPos + height - 1; |
| | | // Log_GetDebug()->TraceInfo("Trace Set ROI: (%d, %d, %d, %d), %d", x1, y1, x2, y2, __LINE__); |
| | | Point2I point; |
| | | point.x = x1; |
| | | point.y = y1; |
| | | |
| | | Point2I pose, ptTop, ptBot; |
| | | if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, point, pose, ptTop, ptBot)) return; |
| | | |
| | | if (0 == m_poseType) { |
| | | m_nPoseX = pose.x; |
| | | m_nPoseY = pose.y; |
| | | } |
| | | else if (1 == m_poseType) { |
| | | m_nPoseX = ptTop.x; |
| | | m_nPoseY = ptTop.y; |
| | | } |
| | | else if (2 == m_poseType) { |
| | | m_nPoseX = ptBot.x; |
| | | m_nPoseY = ptBot.y; |
| | | } |
| | | m_width = (int)(pSideData->m_dPixelSizeX * width); |
| | | m_height = (int)(pSideData->m_dPixelSizeY * height); |
| | | } |
| | | |
| | | int CThresDotProcess::getID(void) { |
| | | /* code*/ |
| | | return m_id; |
| | | } |
| | | |
| | | void CThresDotProcess::setID(int id) { |
| | | /* code */ |
| | | m_id = id; |
| | | } |
| | | |
| | | void CThresDotProcess::getMmvsp(DimensionDir eDir) { |
| | | /* code */ |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | m_xMmvsp = pSideData->m_dPixelSizeX; |
| | | m_yMmvsp = pSideData->m_dPixelSizeY; |
| | | } |
| | | |
| | | int CThresDotProcess::Execute(DimensionDir eDir, Point2I offset) { |
| | | /* code */ |
| | | m_nNgInfo.clear(); |
| | | if (1 != m_nUse) return 0; |
| | | if (m_width < 1 || m_height < 1) return 0; |
| | | |
| | | //1. è·åè§£é度 |
| | | getMmvsp(eDir); |
| | | |
| | | //2. æ§è¡æ£æµ |
| | | ExecChip(eDir); |
| | | |
| | | int nRet = (int)(m_nNgInfo.size()); |
| | | return nRet; |
| | | } |
| | | |
| | | Json::Value CThresDotProcess::WriteToJson(void) { |
| | | /* code */ |
| | | std::string strName = CFileRecipe::toString(m_strName); |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = THRES_VISION_TYPE; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | jsValue["id"] = m_id; |
| | | jsValue["name"] = strName; |
| | | jsValue["pos x"] = m_nPoseX; |
| | | jsValue["pos y"] = m_nPoseY; |
| | | jsValue["width"] = m_width; |
| | | jsValue["height"] = m_height; |
| | | jsValue["use"] = m_nUse; |
| | | jsValue["min thres"] = m_minThres; |
| | | jsValue["max thres"] = m_maxThres; |
| | | jsValue["min size x"] = m_minSizeX; |
| | | jsValue["min size y"] = m_minSizeY; |
| | | jsValue["smooth size"] = m_nSmoothSize; |
| | | jsValue["pose type"] = m_poseType; |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CThresDotProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)(jsValue.size()); |
| | | if (num < 1) return; |
| | | |
| | | //1. side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | //2. id |
| | | strName = "id"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_id = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //3. name |
| | | strName = "name"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) { |
| | | m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString()); |
| | | } |
| | | |
| | | //4. use |
| | | strName = "use"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nUse = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //5. pos x |
| | | strName = "pos x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //6. pos y |
| | | strName = "pos y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nPoseY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //8. width |
| | | strName = "width"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_width = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //9. height |
| | | strName = "height"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_height = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //10. min thres |
| | | strName = "min thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_minThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //11. min |
| | | strName = "max thres"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_maxThres = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //12. min size x |
| | | strName = "min size x"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_minSizeX = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //13. min size y |
| | | strName = "min size y"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_minSizeY = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //14. smooth size |
| | | strName = "smooth size"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nSmoothSize = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | |
| | | //15. smooth size |
| | | strName = "pose type"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_nSmoothSize = jsValue[strName.c_str()].asInt(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef THRES_DOT_PROCRSS_H |
| | | #define THRES_DOT_PROCRSS_H |
| | | |
| | | class CThresDotProcess |
| | | { |
| | | public: |
| | | CThresDotProcess(); |
| | | CThresDotProcess(DimensionDir eDir, int id); |
| | | ~CThresDotProcess(); |
| | | |
| | | public: |
| | | //1. è·ååºå |
| | | void getRegion(int &xPos, int &yPos, int &width, int &height); |
| | | void setRegion(int xPos, int yPos, int width, int height); |
| | | |
| | | //2. è·åID |
| | | int getID(void); |
| | | void setID(int id); |
| | | |
| | | //3. æ§è¡æ£æµ |
| | | int Execute(DimensionDir eDir, Point2I offset); |
| | | |
| | | //5. ä¿åæä»¶ |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | public: |
| | | int m_nUse; |
| | | CString m_strName; |
| | | |
| | | int m_poseType; |
| | | int m_minThres; |
| | | int m_maxThres; |
| | | int m_nSmoothSize; |
| | | |
| | | int m_minSizeX; |
| | | int m_minSizeY; |
| | | std::vector<NgDotInfo> m_nNgInfo; |
| | | |
| | | private: |
| | | int m_id; |
| | | DimensionDir m_eDir; |
| | | int m_nPoseX; |
| | | int m_nPoseY; |
| | | int m_width; |
| | | int m_height; |
| | | Point2I m_ptLeftTop; |
| | | |
| | | double m_xMmvsp; |
| | | double m_yMmvsp; |
| | | |
| | | private: |
| | | //1. æ£æµ |
| | | bool ExecChip(DimensionDir eDir); |
| | | |
| | | //2. è·åç»æ |
| | | void getResult(HalconCpp::HObject &hResultRegion); |
| | | |
| | | //3. è·åå辨ç |
| | | void getMmvsp(DimensionDir eDir); |
| | | }; |
| | | |
| | | |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "ThresProcess.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | |
| | | CThresProcess::CThresProcess(){ |
| | | /* code */ |
| | | for (int i = 0; i < 12; i++) { |
| | | m_dots[i] = NULL; |
| | | } |
| | | m_eDir = DIMENSION_NONE; |
| | | init(); |
| | | } |
| | | |
| | | CThresProcess::CThresProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | for (int i = 0; i < 12; i++) { |
| | | m_dots[i] = NULL; |
| | | } |
| | | m_eDir = eDir; |
| | | init(); |
| | | } |
| | | |
| | | CThresProcess::~CThresProcess(){ |
| | | /* code */ |
| | | release(); |
| | | } |
| | | |
| | | int CThresProcess::init(void) { |
| | | /* code */ |
| | | release(); |
| | | |
| | | for (int i = 0; i < 12; i++) { |
| | | m_dots[i] = new CThresDotProcess(m_eDir, i + 1); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CThresProcess::release(void) { |
| | | /* code */ |
| | | int nCount = 12; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CThresDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | delete dot; |
| | | dot = NULL; |
| | | m_dots[i] = NULL; |
| | | } |
| | | } |
| | | |
| | | int CThresProcess::execute(DimensionDir eDir) { |
| | | /* code */ |
| | | if (m_eDir != eDir) return -1; |
| | | |
| | | int nCount = 12; |
| | | Point2I offset; |
| | | for (int i = 0; i < nCount; i++) { |
| | | CThresDotProcess *dot = m_dots[i]; |
| | | if (NULL == dot) continue; |
| | | if (1 != dot->m_nUse) continue; |
| | | |
| | | offset.x = i; |
| | | offset.y = i; |
| | | dot->Execute(m_eDir, offset); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | Json::Value CThresProcess::WriteToJson(void) { |
| | | /* code */ |
| | | Json::Value jsValue; |
| | | jsValue["alg type"] = THRES_VISION_PROCESS; |
| | | jsValue["side"] = (int)(m_eDir); |
| | | |
| | | for (int i = 0; i < 12; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | jsValue[name.c_str()] = m_dots[i]->WriteToJson(); |
| | | } |
| | | |
| | | return jsValue; |
| | | } |
| | | |
| | | void CThresProcess::DecodeJson(Json::Value &jsValue) { |
| | | /* code */ |
| | | int num = (int)jsValue.size(); |
| | | if (num < 1) return; |
| | | |
| | | //1. Side |
| | | std::string strName = "side"; |
| | | if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) { |
| | | m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt()); |
| | | } |
| | | |
| | | for (int i = 0; i < 12; i++) { |
| | | std::string name = ClsVision::FormatString("Dot%d", i); |
| | | if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) { |
| | | Json::Value jsData = jsValue[name.c_str()]; |
| | | m_dots[i]->DecodeJson(jsData); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef THRES_PROCRSS_H |
| | | #define THRES_PROCRSS_H |
| | | |
| | | #include "ThresDotProcess.h" |
| | | |
| | | class CThresProcess |
| | | { |
| | | public: |
| | | CThresProcess(); |
| | | CThresProcess(DimensionDir eDir); |
| | | ~CThresProcess(); |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | int execute(DimensionDir eDir); |
| | | |
| | | //6. ä¿å |
| | | Json::Value WriteToJson(void); |
| | | void DecodeJson(Json::Value &jsValue); |
| | | |
| | | public: |
| | | DimensionDir m_eDir; |
| | | CThresDotProcess *m_dots[12]; |
| | | |
| | | private: |
| | | //1. åå§å |
| | | int init(void); |
| | | |
| | | //2. éæ¾ |
| | | void release(void); |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "TranformCoordinate.h" |
| | | |
| | | CTranformCoordinate::CTranformCoordinate() |
| | | { |
| | | /* code */ |
| | | } |
| | | |
| | | CTranformCoordinate::~CTranformCoordinate() |
| | | { |
| | | /* code */ |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::Execute(DimensionDir eDir, Point2I pose) { |
| | | /* code */ |
| | | Point2I ptResult = getPose(eDir, pose); |
| | | |
| | | Point2I result = TranformPose(eDir, ptResult); |
| | | |
| | | if (result.x < 0 || result.y < 0) { |
| | | Print(eDir, pose); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | void CTranformCoordinate::Print(DimensionDir eDir, Point2I pose) { |
| | | /* code */ |
| | | ILogger *pLogger = Log_GetDebug(); |
| | | if (NULL == pLogger) return; |
| | | |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | if (NULL == pSideData) return; |
| | | |
| | | pLogger->TraceInfo("Trace Tf %d: (%d, %d), %d", (int)eDir, pose.x, pose.y, __LINE__); |
| | | Point2I ptResult = getPose(eDir, pose); |
| | | pLogger->TraceInfo("Trace Tf %d: (%d, %d), %d", (int)eDir, ptResult.x, ptResult.y, __LINE__); |
| | | |
| | | for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.begin(); iter++) { |
| | | pLogger->TraceInfo("Trace Tf %d: %d, (%d, %d), %d", |
| | | (int)eDir, iter->first, |
| | | iter->second.nSideLine, iter->second.top, __LINE__); |
| | | } |
| | | |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | pLogger->TraceInfo("Trace Tf %d: (%d, %d, %d, %d, %d, %d, %d, %d, %d), %d", |
| | | (int)eDir, |
| | | scanSetting.lengthSize, scanSetting.shortSize, scanSetting.nStdIndex, |
| | | scanSetting.nIndex0, scanSetting.nIndex1, scanSetting.nIndex2, scanSetting.nIndex3, |
| | | scanSetting.nLengthScan, scanSetting.nShortScan, |
| | | __LINE__); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::tfPose(DimensionDir eDir, Point2I pose) { |
| | | /* code */ |
| | | return TranformPose(eDir, pose); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TranformPose(DimensionDir eDir, Point2I pose) { |
| | | /* code */ |
| | | Point2I result = pose; |
| | | switch (eDir) |
| | | { |
| | | case GLOBAL_DEFINE::DIMENSION_A: |
| | | result = TransformPoseTopA(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_B: |
| | | result = TransformPoseTopB(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_C: |
| | | result = TransformPoseTopC(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_D: |
| | | result = TransformPoseTopD(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_A_DN: |
| | | result = TransformPoseBotA(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_B_DN: |
| | | result = TransformPoseBotB(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_C_DN: |
| | | result = TransformPoseBotC(pose); |
| | | break; |
| | | |
| | | case GLOBAL_DEFINE::DIMENSION_D_DN: |
| | | result = TransformPoseBotD(pose); |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseTopA(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex0; |
| | | if (1 == scanSetting.nLengthScan) idx0 = scanSetting.nIndex1; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, true, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseTopB(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex2; |
| | | if (1 == scanSetting.nShortScan) idx0 = scanSetting.nIndex1; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, false, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseTopC(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex3; |
| | | if (1 == scanSetting.nLengthScan) idx0 = scanSetting.nIndex2; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, true, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseTopD(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex3; |
| | | if (1 == scanSetting.nShortScan) idx0 = scanSetting.nIndex0; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, false, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseBotA(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex0; |
| | | if (1 == scanSetting.nLengthScan) idx0 = scanSetting.nIndex1; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, true, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseBotB(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex2; |
| | | if (1 == scanSetting.nShortScan) idx0 = scanSetting.nIndex1; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, false, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseBotC(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex3; |
| | | if (1 == scanSetting.nLengthScan) idx0 = scanSetting.nIndex2; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, true, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformPoseBotD(Point2I pose) { |
| | | /* code */ |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | int idx0 = scanSetting.nIndex3; |
| | | if (1 == scanSetting.nShortScan) idx0 = scanSetting.nIndex0; |
| | | |
| | | int idx1 = scanSetting.nStdIndex; |
| | | |
| | | return TransformResult(pose, false, idx0, idx1, scanSetting); |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::TransformResult(Point2I pose, bool isScanLength, int idx0, int idx1, ScanSetting scanSetting) { |
| | | /* code */ |
| | | Point2I result = pose; |
| | | int id0 = getIndex(idx0, scanSetting); |
| | | int id1 = getIndex(idx1, scanSetting); |
| | | if (-1 == id0 || -1 == id1) return result; |
| | | |
| | | Point2I pt = pose; |
| | | if (isScanLength) { |
| | | pt.x = pose.y; |
| | | pt.y = pose.x; |
| | | } |
| | | |
| | | switch (id0){ |
| | | case 0: { |
| | | if (0 == id1) { |
| | | result = pt; |
| | | } |
| | | else if (1 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = pt.y; |
| | | } |
| | | else if (2 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | else if (3 == id1) { |
| | | result.x = pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | case 1: { |
| | | if (0 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = pt.y; |
| | | } |
| | | else if (1 == id1) { |
| | | result = pt; |
| | | } |
| | | else if (2 == id1) { |
| | | result.x = pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | else if (3 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | case 2: { |
| | | if (0 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | else if (1 == id1) { |
| | | result.x = pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | else if (2 == id1) { |
| | | result = pt; |
| | | } |
| | | else if (3 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = pt.y; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | case 3: { |
| | | if (0 == id1) { |
| | | result.x = pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | else if (1 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = scanSetting.shortSize - pt.y; |
| | | } |
| | | else if (2 == id1) { |
| | | result.x = scanSetting.lengthSize - pt.x; |
| | | result.y = pt.y; |
| | | } |
| | | else if (3 == id1) { |
| | | result = pt; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | int CTranformCoordinate::getIndex(int idx, ScanSetting scanSetting) { |
| | | /* code */ |
| | | int id = -1; |
| | | if (idx == scanSetting.nIndex0) { |
| | | id = 0; |
| | | } |
| | | else if (idx == scanSetting.nIndex1) { |
| | | id = 1; |
| | | } |
| | | else if (idx == scanSetting.nIndex2) { |
| | | id = 2; |
| | | } |
| | | else if (idx == scanSetting.nIndex3) { |
| | | id = 3; |
| | | } |
| | | |
| | | return id; |
| | | } |
| | | |
| | | Point2I CTranformCoordinate::getPose(DimensionDir eDir, Point2I pose) { |
| | | /* code */ |
| | | Point2I result = pose; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | |
| | | int nCount = (int)(pSideData->m_mapSideLineInf.size()); |
| | | if (nCount < 1) return result; |
| | | |
| | | SideLineInf inf; |
| | | bool isFind = false; |
| | | int minDist = MAXINT; |
| | | int dist = 0; |
| | | for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.end(); iter++) { |
| | | if (pose.y < iter->second.top) continue; |
| | | |
| | | dist = abs(pose.y - iter->second.top); |
| | | if (dist > minDist) continue; |
| | | |
| | | inf = iter->second; |
| | | isFind = true; |
| | | minDist = dist; |
| | | } |
| | | |
| | | if (!isFind) { |
| | | for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.end(); iter++) { |
| | | dist = abs(pose.y - iter->second.top); |
| | | if (dist > minDist) continue; |
| | | |
| | | inf = iter->second; |
| | | isFind = true; |
| | | minDist = dist; |
| | | } |
| | | } |
| | | |
| | | if (!isFind) return result; |
| | | |
| | | result.x = (int)(pSideData->m_dPixelSizeX * (pose.x - inf.nSideLine)); |
| | | result.y = (int)(pSideData->m_dPixelSizeY * (pose.y - pSideData->m_nStartLine)); |
| | | |
| | | ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting(); |
| | | if (result.y > scanSetting.lengthSize) { |
| | | result.y = scanSetting.lengthSize - (int)(pSideData->m_dPixelSizeY * abs(pSideData->m_nEndLine - pose.y)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef TRANFORM_COORDINATE_H |
| | | #define TRANFORM_COORDINATE_H |
| | | |
| | | #include "VisionRecipe.h" |
| | | |
| | | class CTranformCoordinate |
| | | { |
| | | public: |
| | | CTranformCoordinate(); |
| | | ~CTranformCoordinate(); |
| | | |
| | | public: |
| | | //1. æ§è¡ |
| | | Point2I Execute(DimensionDir eDir, Point2I pose); |
| | | |
| | | //2. è·åç¸å¯¹ä½ç½® |
| | | Point2I tfPose(DimensionDir eDir, Point2I pose); |
| | | |
| | | private: |
| | | //1. è·åä½ç½® |
| | | Point2I getPose(DimensionDir eDir, Point2I pose); |
| | | |
| | | //2. è·åç¸å¯¹ä½ç½® |
| | | Point2I TranformPose(DimensionDir eDir, Point2I pose); |
| | | |
| | | //3. TopAè½¬æ¢ |
| | | Point2I TransformPoseTopA(Point2I pose); |
| | | |
| | | //4. TopBè½¬æ¢ |
| | | Point2I TransformPoseTopB(Point2I pose); |
| | | |
| | | //5. TopCè½¬æ¢ |
| | | Point2I TransformPoseTopC(Point2I pose); |
| | | |
| | | //6. TopDè½¬æ¢ |
| | | Point2I TransformPoseTopD(Point2I pose); |
| | | |
| | | //7. BotAè½¬æ¢ |
| | | Point2I TransformPoseBotA(Point2I pose); |
| | | |
| | | //8. BotBè½¬æ¢ |
| | | Point2I TransformPoseBotB(Point2I pose); |
| | | |
| | | //9. BotCè½¬æ¢ |
| | | Point2I TransformPoseBotC(Point2I pose); |
| | | |
| | | //10. BotDè½¬æ¢ |
| | | Point2I TransformPoseBotD(Point2I pose); |
| | | |
| | | //11. è½¬æ¢ |
| | | Point2I TransformResult(Point2I pose, bool isScanLength, int idx0, int idx1, ScanSetting scanSetting); |
| | | |
| | | //12. 转æ¢åºå· |
| | | int getIndex(int idx, ScanSetting scanSetting); |
| | | |
| | | //13. æå°æ°æ® |
| | | void Print(DimensionDir eDir, Point2I pose); |
| | | |
| | | |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef VEC_H |
| | | #define VEC_H |
| | | |
| | | #undef min |
| | | #undef max |
| | | |
| | | #include <cmath> |
| | | #include <iostream> |
| | | #include <algorithm> |
| | | using namespace std; |
| | | |
| | | // Let gcc optimize conditional branches a bit better... |
| | | #ifndef likely |
| | | # if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) |
| | | # define likely(x) (x) |
| | | # define unlikely(x) (x) |
| | | # else |
| | | # define likely(x) (__builtin_expect((x), 1)) |
| | | # define unlikely(x) (__builtin_expect((x), 0)) |
| | | # endif |
| | | #endif |
| | | |
| | | |
| | | // Boost-like compile-time assertion checking |
| | | template <bool X> struct VEC_STATIC_ASSERTION_FAILURE; |
| | | template <> struct VEC_STATIC_ASSERTION_FAILURE<true> |
| | | { |
| | | void operator () () {} |
| | | }; |
| | | #define VEC_STATIC_CHECK(expr) VEC_STATIC_ASSERTION_FAILURE<bool(expr)>() |
| | | |
| | | |
| | | template <int D, class T = float> |
| | | class Vec { |
| | | private: |
| | | T v[D]; |
| | | |
| | | public: |
| | | |
| | | // Constructor for no arguments. Everything initialized to 0. |
| | | Vec() { for (int i = 0; i < D; i++) v[i] = T(0); } |
| | | |
| | | // Constructors for 2-4 arguments |
| | | Vec(T x, T y) |
| | | { |
| | | VEC_STATIC_CHECK(D == 2); v[0] = x; v[1] = y; |
| | | } |
| | | Vec(T x, T y, T z) |
| | | { |
| | | VEC_STATIC_CHECK(D == 3); v[0] = x; v[1] = y; v[2] = z; |
| | | } |
| | | Vec(T x, T y, T z, T w) |
| | | { |
| | | VEC_STATIC_CHECK(D == 4); v[0] = x; v[1] = y; v[2] = z; v[3] = w; |
| | | } |
| | | |
| | | // Constructor from anything that can be accessed using [] |
| | | // This one's pretty aggressive, so marked explicit |
| | | template <class S> explicit Vec(const S &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] = T(x[i]); |
| | | } |
| | | |
| | | // No destructor or assignment operator needed |
| | | |
| | | // Array reference and conversion to pointer - no bounds checking |
| | | const T &operator [] (int i) const |
| | | { |
| | | return v[i]; |
| | | } |
| | | T &operator [] (int i) |
| | | { |
| | | return v[i]; |
| | | } |
| | | operator const T * () const |
| | | { |
| | | return v; |
| | | } |
| | | operator const T * () |
| | | { |
| | | return v; |
| | | } |
| | | operator T * () |
| | | { |
| | | return v; |
| | | } |
| | | |
| | | bool operator == (const Vec& d) const { return ((v[0] == d.v[0]) && (v[1] == d.v[1]) && (v[2] == d.v[2])); } |
| | | bool operator != (const Vec& d) const { return ((v[0] != d.v[0]) || (v[1] != d.v[1]) || (v[2] != d.v[2])); } |
| | | |
| | | // Member operators |
| | | Vec<D, T> &operator += (const Vec<D, T> &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] += x[i]; return *this; |
| | | } |
| | | Vec<D, T> &operator -= (const Vec<D, T> &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] -= x[i]; return *this; |
| | | } |
| | | Vec<D, T> &operator *= (const Vec<D, T> &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] *= x[i]; return *this; |
| | | } |
| | | Vec<D, T> &operator *= (const T &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] *= x; return *this; |
| | | } |
| | | Vec<D, T> &operator /= (const Vec<D, T> &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] /= x[i]; return *this; |
| | | } |
| | | Vec<D, T> &operator /= (const T &x) |
| | | { |
| | | for (int i = 0; i < D; i++) v[i] /= x; return *this; |
| | | } |
| | | |
| | | // Outside of class: + - * / % ^ << >> |
| | | |
| | | // Some partial compatibility with valarrays and vectors |
| | | typedef T value_type; |
| | | size_t size() const |
| | | { |
| | | return D; |
| | | } |
| | | T sum() const |
| | | { |
| | | T total = v[0]; |
| | | for (int i = 1; i < D; i++) total += v[i]; |
| | | return total; |
| | | } |
| | | T avg() const |
| | | { |
| | | return sum() / D; |
| | | } |
| | | T product() const |
| | | { |
| | | T total = v[0]; |
| | | for (int i = 1; i < D; i++) total *= v[i]; |
| | | return total; |
| | | } |
| | | T min() const |
| | | { |
| | | T m = v[0]; |
| | | for (int i = 0; i < D; i++) |
| | | if (v[i] < m) m = v[i]; |
| | | return m; |
| | | } |
| | | T max() const |
| | | { |
| | | T m = v[0]; |
| | | for (int i = 1; i < D; i++) |
| | | if (v[i] > m) m = v[i]; |
| | | return m; |
| | | } |
| | | T *begin() { return &(v[0]); } |
| | | const T *begin() const { return &(v[0]); } |
| | | T *end() { return begin() + D; } |
| | | const T *end() const { return begin() + D; } |
| | | void clear() { for (int i = 0; i < D; i++) v[i] = T(0); } |
| | | bool empty() const |
| | | { |
| | | for (int i = 0; i < D; i++) |
| | | if (v[i]) return false; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | typedef Vec<3, float> vec; |
| | | typedef Vec<3, float> point; |
| | | typedef Vec<2, float> vec2; |
| | | typedef Vec<3, float> vec3; |
| | | typedef Vec<4, float> vec4; |
| | | typedef Vec<2, int> ivec2; |
| | | typedef Vec<3, int> ivec3; |
| | | typedef Vec<4, int> ivec4; |
| | | |
| | | |
| | | // Nonmember operators that take two Vecs |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator + (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | return Vec<D, T>(v1) += v2; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator - (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | return Vec<D, T>(v1) -= v2; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator * (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | return Vec<D, T>(v1) *= v2; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator / (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | return Vec<D, T>(v1) /= v2; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const T operator ^ (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | T sum = v1[0] * v2[0]; |
| | | for (int i = 1; i < D; i++) |
| | | sum += v1[i] * v2[i]; |
| | | return sum; |
| | | } |
| | | #define DOT ^ |
| | | |
| | | template <class T> |
| | | static inline const Vec<3, T> operator % (const Vec<3, T> &v1, const Vec<3, T> &v2) |
| | | { |
| | | return Vec<3, T>(v1[1] * v2[2] - v1[2] * v2[1], |
| | | v1[2] * v2[0] - v1[0] * v2[2], |
| | | v1[0] * v2[1] - v1[1] * v2[0]); |
| | | } |
| | | #define CROSS % |
| | | |
| | | |
| | | // Component-wise equality and inequality (#include the usual caveats |
| | | // about comparing floats for equality...) |
| | | template <int D, class T> |
| | | static inline bool operator == (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | for (int i = 0; i < D; i++) |
| | | if (v1[i] != v2[i]) |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline bool operator != (const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | for (int i = 0; i < D; i++) |
| | | if (v1[i] != v2[i]) |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | |
| | | // Unary operators |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> &operator + (const Vec<D, T> &v) |
| | | { |
| | | return v; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator - (const Vec<D, T> &v) |
| | | { |
| | | Vec<D, T> result(v); |
| | | for (int i = 0; i < D; i++) |
| | | result[i] = -result[i]; |
| | | return result; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline bool operator ! (const Vec<D, T> &v) |
| | | { |
| | | return v.empty(); |
| | | } |
| | | |
| | | |
| | | // Vec/scalar operators |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator * (const T &x, const Vec<D, T> &v) |
| | | { |
| | | Vec<D, T> result(v); |
| | | for (int i = 0; i < D; i++) |
| | | result[i] = x * result[i]; |
| | | return result; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator * (const Vec<D, T> &v, const T &x) |
| | | { |
| | | return Vec<D, T>(v) *= x; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator / (const T &x, const Vec<D, T> &v) |
| | | { |
| | | Vec<D, T> result(v); |
| | | for (int i = 0; i < D; i++) |
| | | result[i] = x / result[i]; |
| | | return result; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const Vec<D, T> operator / (const Vec<D, T> &v, const T &x) |
| | | { |
| | | return Vec<D, T>(v) /= x; |
| | | } |
| | | |
| | | |
| | | // iostream operators |
| | | template <int D, class T> |
| | | static inline std::ostream &operator << (std::ostream &os, const Vec<D, T> &v) |
| | | |
| | | { |
| | | os << "("; |
| | | for (int i = 0; i < D - 1; i++) |
| | | os << v[i] << ", "; |
| | | return os << v[D - 1] << ")"; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline std::istream &operator >> (std::istream &is, Vec<D, T> &v) |
| | | { |
| | | char c1 = 0, c2 = 0; |
| | | |
| | | is >> c1; |
| | | if (c1 == '(' || c1 == '[') { |
| | | is >> v[0] >> std::ws >> c2; |
| | | for (int i = 1; i < D; i++) { |
| | | if (c2 == ',') |
| | | is >> v[i] >> std::ws >> c2; |
| | | else |
| | | is.setstate(std::ios::failbit); |
| | | } |
| | | } |
| | | |
| | | if (c1 == '(' && c2 != ')') |
| | | is.setstate(std::ios::failbit); |
| | | else if (c1 == '[' && c2 != ']') |
| | | is.setstate(std::ios::failbit); |
| | | |
| | | return is; |
| | | } |
| | | |
| | | |
| | | // Utility functions for square and cube, to go along with sqrt and cbrt |
| | | template <class T> |
| | | static inline T sqr(const T &x) |
| | | { |
| | | return x*x; |
| | | } |
| | | |
| | | template <class T> |
| | | static inline T cube(const T &x) |
| | | { |
| | | return x*x*x; |
| | | } |
| | | |
| | | |
| | | // Utility functions based on GLSL |
| | | template <class T> |
| | | static inline T fract(const T &x) |
| | | { |
| | | return x - floor(x); |
| | | } |
| | | |
| | | template <class T> |
| | | static inline T clamp(const T &x, const T &a, const T &b) |
| | | { |
| | | return x > a ? x < b ? x : b : a; // returns a on NaN |
| | | } |
| | | |
| | | template <class T, class S> |
| | | static inline T mix(const T &x, const T &y, const S &a) |
| | | { |
| | | return (S(1) - a) * x + a * y; |
| | | } |
| | | |
| | | template <class T> |
| | | static inline T step(const T &x, const T &a) |
| | | { |
| | | return x < a ? T(0) : T(1); |
| | | } |
| | | |
| | | template <class T> |
| | | static inline T smoothstep(const T &x, const T &a, const T &b) |
| | | { |
| | | if (b <= a) return step(x, a); |
| | | T t = (x - a) / (b - a); |
| | | return t <= T(0) ? T(0) : t >= T(1) ? T(1) : t * t * (T(3) - T(2) * t); |
| | | } |
| | | |
| | | // Area-weighted triangle face normal |
| | | template <class T> |
| | | static inline T trinorm(const T &v0, const T &v1, const T &v2) |
| | | { |
| | | return (typename T::value_type) 0.5 * ((v1 - v0) CROSS(v2 - v0)); |
| | | } |
| | | |
| | | // Sign of a scalar |
| | | template <class T> |
| | | static inline T sgn(const T &x) |
| | | { |
| | | return (x < T(0)) ? T(-1) : T(1); |
| | | } |
| | | |
| | | |
| | | // Functions on Vecs |
| | | template <int D, class T> |
| | | static inline const T len2(const Vec<D, T> &v) |
| | | { |
| | | T l2 = v[0] * v[0]; |
| | | for (int i = 1; i < D; i++) |
| | | l2 += v[i] * v[i]; |
| | | return l2; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const T len(const Vec<D, T> &v) |
| | | { |
| | | return sqrt(len2(v)); |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const T dist2(const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | T d2 = sqr(v2[0] - v1[0]); |
| | | for (int i = 1; i < D; i++) |
| | | d2 += sqr(v2[i] - v1[i]); |
| | | return d2; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline const T dist(const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | return sqrt(dist2(v1, v2)); |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline Vec<D, T> normalize(Vec<D, T> &v) |
| | | { |
| | | T l = len(v); |
| | | if (unlikely(l <= T(0))) { |
| | | v[0] = T(1); |
| | | for (int i = 1; i < D; i++) |
| | | v[i] = T(0); |
| | | return v; |
| | | } |
| | | |
| | | l = T(1) / l; |
| | | for (int i = 0; i < D; i++) |
| | | v[i] *= l; |
| | | |
| | | return v; |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline void swap(const Vec<D, T> &v1, const Vec<D, T> &v2) |
| | | { |
| | | for (int i = 0; i < D; i++) |
| | | swap(v1[i], v2[i]); |
| | | } |
| | | |
| | | template <int D, class T> |
| | | static inline Vec<D, T> fabs(const Vec<D, T> &v) |
| | | { |
| | | Vec<D, T> result(v); |
| | | for (int i = 0; i < D; i++) |
| | | if (result[i] < T(0)) |
| | | result[i] = -result[i]; |
| | | return result; |
| | | } |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "VisionBufferPro.h" |
| | | #include "Bspline.h" |
| | | |
| | | #define DEFAULTT_IMAGE_HEIGHT 100000 |
| | | |
| | | CVisionBufferPro::CVisionBufferPro() |
| | | { |
| | | } |
| | | |
| | | CVisionBufferPro::~CVisionBufferPro(){ |
| | | /* code */ |
| | | } |
| | | |
| | | bool CVisionBufferPro::bufferToObject(DimensionDir eDir, int height, HalconCpp::HObject &hImage) { |
| | | /* code */ |
| | | CVisionRecipe *pRecipe = CVisionRecipe::getInstance(); |
| | | int iCam = pRecipe->getCameraIndex(eDir); |
| | | int iScan = pRecipe->getCameraScan(eDir); |
| | | CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam); |
| | | if (NULL == pGrabCtrl) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer(); |
| | | if (nullptr == pBuffer) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer(); |
| | | if (NULL == pMultBuffer) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | int nFrameWidth = pMultBuffer->GetFrameWidth(); |
| | | int nFrameHeight = pMultBuffer->GetFrameHeight(); |
| | | int nFrameCount = pMultBuffer->GetFrameCount(); |
| | | int nTotalLength = nFrameHeight * nFrameCount; |
| | | if (nTotalLength < 1){ |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | try{ |
| | | int imgWidth = nFrameWidth; |
| | | int imgHeight = nTotalLength; |
| | | if (imgHeight > DEFAULTT_IMAGE_HEIGHT) { |
| | | imgHeight = DEFAULTT_IMAGE_HEIGHT; |
| | | } |
| | | if (height > 0) { |
| | | if (imgHeight > height) { |
| | | imgHeight = height; |
| | | } |
| | | } |
| | | |
| | | //å¾åè½¬æ¢ |
| | | uchar *imgData = new uchar[imgWidth * imgHeight]; |
| | | BYTE *lpImg = pBuffer->GetMultiBuffData(iScan); |
| | | std::memcpy(imgData, lpImg, imgWidth * imgHeight); |
| | | HalconCpp::GenImage1(&hImage, "byte", imgWidth, imgHeight, (Hlong)(imgData)); |
| | | delete[] imgData; |
| | | imgData = NULL; |
| | | |
| | | return true; |
| | | } |
| | | catch (...) |
| | | { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::getImageROI(DimensionDir eDir, HalconCpp::HObject &hImage, int x1, int y1, int x2, int y2) { |
| | | /* code */ |
| | | CVisionRecipe *pRecipe = CVisionRecipe::getInstance(); |
| | | int iCam = pRecipe->getCameraIndex(eDir); |
| | | int iScan = pRecipe->getCameraScan(eDir); |
| | | CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam); |
| | | if (NULL == pGrabCtrl) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer(); |
| | | if (nullptr == pBuffer) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer(); |
| | | if (NULL == pMultBuffer) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | int nFrameWidth = pMultBuffer->GetFrameWidth(); |
| | | int nFrameHeight = pMultBuffer->GetFrameHeight(); |
| | | int nFrameCount = pMultBuffer->GetFrameCount(); |
| | | int nTotalLength = nFrameWidth * nFrameHeight * nFrameCount; |
| | | if (nTotalLength < 1) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | if (x1 < 0 || y1 < 0 || x2 > nFrameWidth - 1 || y2 > nTotalLength - 1) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | try{ |
| | | int imgWidth = x2 - x1 + 1; |
| | | int imgHeight = y2 - y1 + 1; |
| | | if (imgWidth < 1 || imgHeight < 1) { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | |
| | | //å¾åè½¬æ¢ |
| | | uchar *imgData = new uchar[imgWidth * imgHeight]; |
| | | BYTE *lpImg = pBuffer->GetMultiBuffData(iScan); |
| | | |
| | | for (int i = y1; i <= y2; i++) { |
| | | std::memcpy(imgData + (i - y1) * imgWidth, lpImg + (i * nFrameWidth) + x1, imgWidth); |
| | | } |
| | | |
| | | |
| | | HalconCpp::GenImage1(&hImage, "byte", imgWidth, imgHeight, (Hlong)(imgData)); |
| | | delete[] imgData; |
| | | imgData = NULL; |
| | | |
| | | return true; |
| | | } |
| | | catch (...) |
| | | { |
| | | ClsVision::GenEmptyObject(hImage); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::getIndexImage(DimensionDir eDir, HalconCpp::HObject *hImage, int index) { |
| | | /* code */ |
| | | CVisionRecipe *pRecipe = CVisionRecipe::getInstance(); |
| | | int iCam = pRecipe->getCameraIndex(eDir); |
| | | int iScan = pRecipe->getCameraScan(eDir); |
| | | CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam); |
| | | if (NULL == pGrabCtrl) { |
| | | HalconCpp::GenEmptyObj(hImage); |
| | | return false; |
| | | } |
| | | |
| | | CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer(); |
| | | if (nullptr == pBuffer) { |
| | | HalconCpp::GenEmptyObj(hImage); |
| | | return false; |
| | | } |
| | | CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer(); |
| | | if (NULL == pMultBuffer) { |
| | | HalconCpp::GenEmptyObj(hImage); |
| | | return false; |
| | | } |
| | | int nFrameHeight = pMultBuffer->GetFrameHeight(); |
| | | int nFrameWidth = pMultBuffer->GetFrameWidth(); |
| | | if (nFrameHeight < 1 || nFrameWidth < 1) { |
| | | HalconCpp::GenEmptyObj(hImage); |
| | | return false; |
| | | } |
| | | |
| | | int x1 = 0; |
| | | int x2 = nFrameWidth - 1; |
| | | int y1 = index * nFrameHeight; |
| | | int y2 = index * nFrameHeight + nFrameHeight - 1; |
| | | |
| | | return getImageROI(eDir, *hImage, x1, y1, x2, y2); |
| | | } |
| | | |
| | | void CVisionBufferPro::getLineFrameSize(DimensionDir eDir, int &nFrameWidth, int &nFrameHeight) { |
| | | /* code */ |
| | | // 设置帧宽åé«åº¦ä¸º-1 |
| | | nFrameWidth = -1; |
| | | nFrameHeight = -1; |
| | | // è·åCVisionRecipeå®ä¾ |
| | | CVisionRecipe *pRecipe = CVisionRecipe::getInstance(); |
| | | // è·åæå®æ¹åä¸çç¸æºç´¢å¼ |
| | | int iCam = pRecipe->getCameraIndex(eDir); |
| | | // è·åæå®æ¹åä¸çç¸æºæ«ææ¹å |
| | | int iScan = pRecipe->getCameraScan(eDir); |
| | | // è·åæå®ç¸æºä¸çCGrabberControlå®ä¾ |
| | | CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam); |
| | | // 妿pGrabCtrl为空ï¼åè¿å |
| | | if (NULL == pGrabCtrl) return; |
| | | |
| | | // è·åCFrameBufferControllerå®ä¾ |
| | | CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer(); |
| | | // 妿pBuffer为空ï¼åè¿å |
| | | if (nullptr == pBuffer) return; |
| | | // è·åCMultiBufferå®ä¾ |
| | | CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer(); |
| | | // 妿pMultBuffer为空ï¼åè¿å |
| | | if (NULL == pMultBuffer)return; |
| | | |
| | | // è·å帧é«åº¦ |
| | | nFrameHeight = pMultBuffer->GetFrameHeight(); |
| | | // è·å帧宽度 |
| | | nFrameWidth = pMultBuffer->GetFrameWidth(); |
| | | } |
| | | |
| | | bool CVisionBufferPro::GetMeasurePos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int step, Point2D &ptStart, Point2D &ptEnd) { |
| | | /* code */ |
| | | if (!ClsVision::ObjectExist(hObject)) return false; |
| | | |
| | | try { |
| | | HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0; |
| | | LineRowStart_Measure_01_0 = line.pt0.y; |
| | | LineColumnStart_Measure_01_0 = line.pt0.x; |
| | | LineRowEnd_Measure_01_0 = line.pt1.y; |
| | | LineColumnEnd_Measure_01_0 = line.pt1.x; |
| | | |
| | | HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2; |
| | | TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0); |
| | | TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0); |
| | | TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0; |
| | | TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0; |
| | | |
| | | HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi); |
| | | |
| | | HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1); |
| | | TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1; |
| | | TmpCtrl_Len2 = 0.5 * step; |
| | | |
| | | HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0; |
| | | HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight); |
| | | |
| | | HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0); |
| | | |
| | | HalconCpp::HTuple Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0; |
| | | std::string strMode = "all"; |
| | | if (0 == modeTrans) { |
| | | strMode = "all"; |
| | | } |
| | | else if (1 == modeTrans) { |
| | | strMode = "positive"; |
| | | } |
| | | else if (2 == modeTrans) { |
| | | strMode = "negative"; |
| | | } |
| | | HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0); |
| | | HalconCpp::CloseMeasure(MsrHandle_Measure_01_0); |
| | | |
| | | bool result = false; |
| | | HalconCpp::HTuple hvLenth; |
| | | HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth); |
| | | int iCount = hvLenth[0].I(); |
| | | if (iCount > 0) { |
| | | double dx = abs(line.pt0.x - line.pt1.x); |
| | | bool isInit = false; |
| | | |
| | | Point2D pt; |
| | | if (dx > 1.0f) { |
| | | for (int i = 0; i < iCount; i++) { |
| | | pt.x = Column_Measure_01_0[i].D(); |
| | | pt.y = Row_Measure_01_0[i].D(); |
| | | if (!isInit) { |
| | | ptStart.x = Column_Measure_01_0[i].D(); |
| | | ptStart.y = Row_Measure_01_0[i].D(); |
| | | ptEnd.x = Column_Measure_01_0[i].D(); |
| | | ptEnd.y = Row_Measure_01_0[i].D(); |
| | | isInit = true; |
| | | } |
| | | |
| | | result = true; |
| | | if (pt.x < ptStart.x) ptStart = pt; |
| | | if (pt.x > ptEnd.x) ptEnd = pt; |
| | | } |
| | | } |
| | | else { |
| | | for (int i = 0; i < iCount; i++) { |
| | | pt.x = Column_Measure_01_0[i].D(); |
| | | pt.y = Row_Measure_01_0[i].D(); |
| | | if (!isInit) { |
| | | ptStart.x = Column_Measure_01_0[i].D(); |
| | | ptStart.y = Row_Measure_01_0[i].D(); |
| | | ptEnd.x = Column_Measure_01_0[i].D(); |
| | | ptEnd.y = Row_Measure_01_0[i].D(); |
| | | isInit = true; |
| | | } |
| | | |
| | | result = true; |
| | | if (pt.y < ptStart.y) ptStart = pt; |
| | | if (pt.y > ptEnd.y) ptEnd = pt; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | catch (...) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::GetMeasureNearPos(HalconCpp::HObject& hObject, Line2D line, int threshold, int modeTrans, int step, Point2D& ptStart, Point2D& ptEnd) { |
| | | /* code */ |
| | | if (!ClsVision::ObjectExist(hObject)) return false; |
| | | |
| | | try { |
| | | HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0; |
| | | LineRowStart_Measure_01_0 = line.pt0.y; |
| | | LineColumnStart_Measure_01_0 = line.pt0.x; |
| | | LineRowEnd_Measure_01_0 = line.pt1.y; |
| | | LineColumnEnd_Measure_01_0 = line.pt1.x; |
| | | |
| | | HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2; |
| | | TmpCtrl_Row = 0.5 * (LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0); |
| | | TmpCtrl_Column = 0.5 * (LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0); |
| | | TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0; |
| | | TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0; |
| | | |
| | | HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi); |
| | | |
| | | HalconCpp::TupleSqrt(TmpCtrl_Dr * TmpCtrl_Dr + TmpCtrl_Dc * TmpCtrl_Dc, &TmpCtrl_Len1); |
| | | TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1; |
| | | TmpCtrl_Len2 = 0.5 * step; |
| | | |
| | | HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0; |
| | | HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight); |
| | | |
| | | HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0); |
| | | |
| | | HalconCpp::HTuple Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0; |
| | | std::string strMode = "all"; |
| | | if (0 == modeTrans) { |
| | | strMode = "all"; |
| | | } |
| | | else if (1 == modeTrans) { |
| | | strMode = "positive"; |
| | | } |
| | | else if (2 == modeTrans) { |
| | | strMode = "negative"; |
| | | } |
| | | HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0); |
| | | HalconCpp::CloseMeasure(MsrHandle_Measure_01_0); |
| | | |
| | | bool result = false; |
| | | HalconCpp::HTuple hvLenth; |
| | | HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth); |
| | | int iCount = hvLenth[0].I(); |
| | | if (iCount > 0) { |
| | | ptStart.x = Column_Measure_01_0[0].D(); |
| | | ptStart.y = Row_Measure_01_0[0].D(); |
| | | |
| | | if (1 == iCount) { |
| | | ptEnd = ptStart; |
| | | return true; |
| | | } |
| | | |
| | | ptEnd.x = Column_Measure_01_0[1].D(); |
| | | ptEnd.y = Row_Measure_01_0[1].D(); |
| | | result = true; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | catch (...) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::GetMeasureRCutPos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int chamberSize, double proDist, Point2D &ptStart, Point2D &ptEnd) { |
| | | /* code */ |
| | | if (!ClsVision::ObjectExist(hObject)) return false; |
| | | |
| | | try { |
| | | HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0; |
| | | LineRowStart_Measure_01_0 = line.pt0.y; |
| | | LineColumnStart_Measure_01_0 = line.pt0.x; |
| | | LineRowEnd_Measure_01_0 = line.pt1.y; |
| | | LineColumnEnd_Measure_01_0 = line.pt1.x; |
| | | |
| | | HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2; |
| | | TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0); |
| | | TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0); |
| | | TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0; |
| | | TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0; |
| | | |
| | | TmpCtrl_Phi = TmpCtrl_Dr.TupleAtan2(TmpCtrl_Dc); |
| | | |
| | | HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1); |
| | | TmpCtrl_Len1 = 0.5 * (((TmpCtrl_Dr * TmpCtrl_Dr) + (TmpCtrl_Dc * TmpCtrl_Dc)).TupleSqrt()); |
| | | TmpCtrl_Len2 = 5.0f; |
| | | |
| | | HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0; |
| | | HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight); |
| | | |
| | | HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0); |
| | | |
| | | HalconCpp::HTuple Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0; |
| | | std::string strMode = "all"; |
| | | if (0 == modeTrans) { |
| | | strMode = "all"; |
| | | } |
| | | else if (1 == modeTrans) { |
| | | strMode = "positive"; |
| | | } |
| | | else if (2 == modeTrans) { |
| | | strMode = "negative"; |
| | | } |
| | | HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", |
| | | &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0); |
| | | HalconCpp::CloseMeasure(MsrHandle_Measure_01_0); |
| | | |
| | | double fzMinDist = 0.4 * chamberSize; |
| | | if (proDist > 1.0f) { |
| | | double temp = 0.8 * proDist; |
| | | if (temp > fzMinDist) { |
| | | fzMinDist = temp; |
| | | } |
| | | } |
| | | |
| | | HalconCpp::HTuple hvLenth = Row_Measure_01_0.TupleLength(); |
| | | int sz = hvLenth[0].I(); |
| | | if (sz < 1) return false; |
| | | if (Amplitude_Measure_01_0[0].D() > 0) return false; |
| | | ptStart.x = Column_Measure_01_0[0].D(); |
| | | ptStart.y = Row_Measure_01_0[0].D(); |
| | | |
| | | bool isFind = false; |
| | | double dist = 0.0f; |
| | | if (sz > 1) { |
| | | for (int i = 1; i < sz; i++) { |
| | | if (Amplitude_Measure_01_0[i].D() < 0.0f) { |
| | | dist += Distance_Measure_01_0[i - 1].D(); |
| | | continue; |
| | | } |
| | | ptEnd.x = Column_Measure_01_0[i].D(); |
| | | ptEnd.y = Row_Measure_01_0[i].D(); |
| | | dist += Distance_Measure_01_0[i - 1].D(); |
| | | if (dist > fzMinDist && dist < chamberSize) { |
| | | isFind = true; |
| | | break; |
| | | } |
| | | |
| | | if (dist > chamberSize) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ((!isFind) && proDist > 1.0f) { |
| | | dist = ClsVision::DistancePP(ptStart, line.pt1); |
| | | Point2D pose; |
| | | std::vector<Point2D> vPtStd, vPtReal; |
| | | pose.x = 0.0f; |
| | | pose.y = 0.0f; |
| | | vPtStd.push_back(pose); |
| | | pose.x = dist; |
| | | pose.y = 0.0f; |
| | | vPtStd.push_back(pose); |
| | | vPtReal.push_back(ptStart); |
| | | vPtReal.push_back(line.pt1); |
| | | |
| | | ParaAffine2D affine = ClsVision::VectorToRigid(vPtStd, vPtReal); |
| | | pose.x = proDist; |
| | | pose.y = 0.0f; |
| | | ptEnd = ClsVision::CoordinateTransform(pose, affine); |
| | | isFind = true; |
| | | } |
| | | |
| | | return isFind; |
| | | } |
| | | catch (...) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::GetMeasurePosKeyLimit(HalconCpp::HObject &hObject, Line2D line, int nTypePoint, int threshold, int modeTrans, int step, int distLimit, Point2D &ptStart, Point2D &ptEnd) { |
| | | /* code */ |
| | | if (!ClsVision::ObjectExist(hObject)) return false; |
| | | |
| | | try { |
| | | HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0; |
| | | LineRowStart_Measure_01_0 = line.pt0.y; |
| | | LineColumnStart_Measure_01_0 = line.pt0.x; |
| | | LineRowEnd_Measure_01_0 = line.pt1.y; |
| | | LineColumnEnd_Measure_01_0 = line.pt1.x; |
| | | |
| | | HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2; |
| | | TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0); |
| | | TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0); |
| | | TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0; |
| | | TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0; |
| | | HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi); |
| | | HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1); |
| | | TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1; |
| | | TmpCtrl_Len2 = 0.5 * step; |
| | | |
| | | HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0; |
| | | HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight); |
| | | |
| | | HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0); |
| | | |
| | | HalconCpp::HTuple Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0; |
| | | std::string strMode = "all"; |
| | | if (0 == modeTrans) { |
| | | strMode = "all"; |
| | | } |
| | | else if (1 == modeTrans) { |
| | | strMode = "positive"; |
| | | } |
| | | else if (2 == modeTrans) { |
| | | strMode = "negative"; |
| | | } |
| | | HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0); |
| | | HalconCpp::CloseMeasure(MsrHandle_Measure_01_0); |
| | | |
| | | HalconCpp::HTuple hvLenth; |
| | | HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth); |
| | | int nCount = hvLenth[0].I(); |
| | | if (nCount < 1) return false; |
| | | |
| | | ptStart.x = Column_Measure_01_0[0].D(); |
| | | ptStart.y = Row_Measure_01_0[0].D(); |
| | | ptEnd.x = Column_Measure_01_0[nCount - 1].D(); |
| | | ptEnd.y = Row_Measure_01_0[nCount - 1].D(); |
| | | |
| | | Point2D point; |
| | | if (0 == nTypePoint) { |
| | | point = ptStart; |
| | | } |
| | | else { |
| | | point = ptEnd; |
| | | } |
| | | |
| | | int idx = -1; |
| | | double maxDist = MININT; |
| | | Point2D pt; |
| | | for (int i = 0; i < nCount; i++) { |
| | | pt.x = Column_Measure_01_0[i].D(); |
| | | pt.y = Row_Measure_01_0[i].D(); |
| | | double dx = pt.x - point.x; |
| | | double dy = pt.y - point.y; |
| | | double dist = sqrt(dx * dx + dy * dy); |
| | | if (dist < distLimit && dist > maxDist) { |
| | | maxDist = dist; |
| | | idx = i; |
| | | } |
| | | } |
| | | if (idx < 0) return false; |
| | | |
| | | point.x = Column_Measure_01_0[idx].D(); |
| | | point.y = Row_Measure_01_0[idx].D(); |
| | | if (0 == nTypePoint) { |
| | | ptStart = point; |
| | | } |
| | | else { |
| | | ptEnd = point; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | catch (...) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &result, int &xPosPxl, int &yPosPxl) { |
| | | /* code */ |
| | | xPosPxl = 0; |
| | | yPosPxl = 0; |
| | | result = 0.0f; |
| | | CCornerDistProcess *dotCorner = CVisionRecipe::getInstance()->getCornerDistProcess(eDir); |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | if (NULL == pSideData) return true; |
| | | if (NULL == dotCorner) return true; |
| | | if (NULL == dot) return true; |
| | | |
| | | |
| | | Point2D locResult = dot->m_ptMatchResult; |
| | | Point2D measureResult = dot->m_ptMeasureResult; |
| | | Point2D nearResult = dot->m_ptNearResult; |
| | | |
| | | xPosPxl = dot->m_locPointResult.x; |
| | | yPosPxl = dot->m_locPointResult.y; |
| | | |
| | | int distMode = dot->m_distMode; |
| | | if (0 == distMode) { |
| | | double dx = measureResult.x - nearResult.x; |
| | | result = fabs(pSideData->m_dPixelSizeX * dx); |
| | | } |
| | | else if (1 == distMode) { |
| | | Point2I topMark = pSideData->getPose(0); |
| | | Point2I botMark = pSideData->getPose(1); |
| | | |
| | | Line2D line1, line2; |
| | | line1.pt0.x = topMark.x; |
| | | line1.pt0.y = topMark.y; |
| | | line1.pt1.x = botMark.x; |
| | | line1.pt1.y = botMark.y; |
| | | |
| | | line2.pt0.x = measureResult.x; |
| | | line2.pt0.y = measureResult.y; |
| | | line2.pt1.x = measureResult.x + 1000.0f; |
| | | line2.pt1.y = measureResult.y; |
| | | |
| | | Point2D pose = ClsVision::LineIntersection(line1, line2); |
| | | double dx = measureResult.x - pose.x; |
| | | result = fabs(pSideData->m_dPixelSizeX * dx); |
| | | } |
| | | else if (2 == distMode) { |
| | | Point2I pose = pSideData->getPose(0); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (3 == distMode) { |
| | | Point2I pose = pSideData->getPose(1); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (4 == distMode) { |
| | | Point2I pose = pSideData->getPose(2); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (5 == distMode) { |
| | | Point2I pose = pSideData->getPose(3); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (6 == distMode) { |
| | | Point2D pose = nearResult; |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (7 == distMode) { |
| | | Point2D pose = locResult; |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | result = sqrt(dx * dx + dy * dy); |
| | | } |
| | | |
| | | if (dot->m_maxValue < 0.1) return true; |
| | | if (dot->m_minValue > dot->m_maxValue) return true; |
| | | |
| | | if (result < dot->m_minValue || result > dot->m_maxValue) return false; |
| | | |
| | | return true; |
| | | } |
| | | |
| | | int CVisionBufferPro::getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &distResult) { |
| | | /* code */ |
| | | //1. åå§åç»æ |
| | | distResult = 0.0f; |
| | | int nRet = 0; |
| | | CCornerDistProcess *dotCorner = CVisionRecipe::getInstance()->getCornerDistProcess(eDir); |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | if (NULL == pSideData) return nRet; |
| | | if (NULL == dotCorner) return nRet; |
| | | if (NULL == dot) return nRet; |
| | | |
| | | |
| | | Point2D locResult = dot->m_ptMatchResult; |
| | | Point2D measureResult = dot->m_ptMeasureResult; |
| | | Point2D nearResult = dot->m_ptNearResult; |
| | | |
| | | int distMode = dot->m_distMode; |
| | | if (0 == distMode) { |
| | | double dx = measureResult.x - nearResult.x; |
| | | distResult = fabs(pSideData->m_dPixelSizeX * dx); |
| | | } |
| | | else if (1 == distMode) { |
| | | Point2I topMark = pSideData->getPose(0); |
| | | Point2I botMark = pSideData->getPose(1); |
| | | |
| | | Line2D line1, line2; |
| | | line1.pt0.x = topMark.x; |
| | | line1.pt0.y = topMark.y; |
| | | line1.pt1.x = botMark.x; |
| | | line1.pt1.y = botMark.y; |
| | | |
| | | line2.pt0.x = measureResult.x; |
| | | line2.pt0.y = measureResult.y; |
| | | line2.pt1.x = measureResult.x + 1000.0f; |
| | | line2.pt1.y = measureResult.y; |
| | | |
| | | Point2D pose = ClsVision::LineIntersection(line1, line2); |
| | | double dx = measureResult.x - pose.x; |
| | | distResult = fabs(pSideData->m_dPixelSizeX * dx); |
| | | } |
| | | else if (2 == distMode) { |
| | | Point2I pose = pSideData->getPose(0); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | distResult = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (3 == distMode) { |
| | | Point2I pose = pSideData->getPose(1); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | distResult = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (4 == distMode) { |
| | | Point2I pose = pSideData->getPose(2); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | distResult = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (5 == distMode) { |
| | | Point2I pose = pSideData->getPose(3); |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | distResult = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (6 == distMode){ |
| | | Point2D pose = nearResult; |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | distResult = sqrt(dx * dx + dy * dy); |
| | | } |
| | | else if (7 == distMode) { |
| | | Point2D pose = locResult; |
| | | double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x); |
| | | double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y); |
| | | distResult = sqrt(dx * dx + dy * dy); |
| | | } |
| | | |
| | | if (dot->m_maxValue < 0.1) return 0; |
| | | if (dot->m_minValue > dot->m_maxValue) return 0; |
| | | |
| | | if (distResult < dot->m_minValue || distResult > dot->m_maxValue) return 1; |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | bool CVisionBufferPro::TransformToReal(DimensionDir eDir, Point2I point, int nType, Point2I &result) { |
| | | /* code */ |
| | | result.x = 0; |
| | | result.y = 0; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | if (NULL == pSideData) return false; |
| | | if (0 == nType) { |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | } |
| | | else { |
| | | if (!pSideData->m_bTopPoint_Find) return false; |
| | | if (!pSideData->m_bBotPoint_Find) return false; |
| | | } |
| | | |
| | | double xMmvsp = pSideData->m_dPixelSizeX; |
| | | double yMmvsp = pSideData->m_dPixelSizeY; |
| | | |
| | | Point2I ptTop, ptBot; |
| | | if (0 == nType) { //Origine Mark Line |
| | | ptTop = pSideData->m_mTopMark; |
| | | ptBot = pSideData->m_mBotMark; |
| | | } |
| | | else if (1 == nType) { //Top MarkPoint |
| | | ptTop = pSideData->m_mTopPoint; |
| | | ptBot = pSideData->m_mBotPoint; |
| | | } |
| | | else if (2 == nType) { //Bot MarkLine |
| | | ptTop = pSideData->m_mTopPoint; |
| | | ptBot = pSideData->m_mBotPoint; |
| | | } |
| | | double dx = xMmvsp * (ptBot.x - ptTop.x); |
| | | double dy = yMmvsp * (ptBot.y - ptTop.y); |
| | | double dist = sqrt(dx * dx + dy * dy); |
| | | |
| | | Point2D posTopReal, posBotReal, poseReal; |
| | | posTopReal.x = 0.0f; |
| | | posTopReal.y = 0.0f; |
| | | posBotReal.x = 0.0f; |
| | | posBotReal.y = dist; |
| | | if (0 == nType) { |
| | | poseReal = posTopReal; |
| | | poseReal.x += point.x; |
| | | poseReal.y += point.y; |
| | | } |
| | | else if (1 == nType) { |
| | | poseReal = posTopReal; |
| | | poseReal.x += point.x; |
| | | poseReal.y += point.y; |
| | | } |
| | | else if (2 == nType) { |
| | | poseReal = posBotReal; |
| | | poseReal.x += point.x; |
| | | poseReal.y += point.y; |
| | | } |
| | | |
| | | std::vector<Point2D> vPtOrigine, vPtReal; |
| | | vPtOrigine.push_back(posTopReal); |
| | | vPtOrigine.push_back(posBotReal); |
| | | Point2D pose; |
| | | pose.x = 0.0f; |
| | | pose.y = 0.0f; |
| | | vPtReal.push_back(pose); |
| | | pose.x = xMmvsp * (ptBot.x - ptTop.x); |
| | | pose.y = yMmvsp * (ptBot.y - ptTop.y); |
| | | vPtReal.push_back(pose); |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal); |
| | | Point2D ptResult = ClsVision::CoordinateTransform(poseReal, affine); |
| | | result.x = (int)(ptTop.x + ptResult.x / xMmvsp); |
| | | result.y = (int)(ptTop.y + ptResult.y / yMmvsp); |
| | | |
| | | |
| | | #if 0 //Modify, jiang, 09-24, 2024 |
| | | Point2D ptImage; |
| | | ptImage.x = point.x; |
| | | ptImage.y = point.y; |
| | | if (1 == nType) { |
| | | std::vector<Point2D> vPtStd, vPtPoint; |
| | | Point2D pt; |
| | | pt.x = pSideData->m_stdTopPoint[0].x; |
| | | pt.y = pSideData->m_stdTopPoint[0].y; |
| | | vPtStd.push_back(pt); |
| | | pt.x = pSideData->m_stdBotPoint[0].x; |
| | | pt.y = pSideData->m_stdBotPoint[0].y; |
| | | vPtStd.push_back(pt); |
| | | |
| | | pt.x = pSideData->m_mTopPoint.x; |
| | | pt.y = pSideData->m_mTopPoint.y; |
| | | vPtPoint.push_back(pt); |
| | | pt.x = pSideData->m_mBotPoint.x; |
| | | pt.y = pSideData->m_mBotPoint.y; |
| | | vPtPoint.push_back(pt); |
| | | |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtStd, vPtPoint); |
| | | pt = ClsVision::CoordinateTransform(ptImage, affine); |
| | | result.x = (int)(pt.x); |
| | | result.y = (int)(pt.y); |
| | | } |
| | | else if (2 == nType) { |
| | | std::vector<Point2D> vPtStd, vPtPoint; |
| | | Point2D pt; |
| | | pt.x = pSideData->m_stdTopPoint[0].x; |
| | | pt.y = pSideData->m_stdTopPoint[0].y; |
| | | vPtStd.push_back(pt); |
| | | pt.x = pSideData->m_stdTopPoint[1].x; |
| | | pt.y = pSideData->m_stdTopPoint[1].y; |
| | | vPtStd.push_back(pt); |
| | | |
| | | pt.x = pSideData->m_mTopPoint.x; |
| | | pt.y = pSideData->m_mTopPoint.y; |
| | | vPtPoint.push_back(pt); |
| | | pt.x = pSideData->m_mTopPoint2.x; |
| | | pt.y = pSideData->m_mTopPoint2.y; |
| | | vPtPoint.push_back(pt); |
| | | |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtStd, vPtPoint); |
| | | pt = ClsVision::CoordinateTransform(ptImage, affine); |
| | | result.x = (int)(pt.x); |
| | | result.y = (int)(pt.y); |
| | | } |
| | | else if (3 == nType) { |
| | | std::vector<Point2D> vPtStd, vPtPoint; |
| | | Point2D pt; |
| | | pt.x = pSideData->m_stdBotPoint[0].x; |
| | | pt.y = pSideData->m_stdBotPoint[0].y; |
| | | vPtStd.push_back(pt); |
| | | pt.x = pSideData->m_stdBotPoint[1].x; |
| | | pt.y = pSideData->m_stdBotPoint[1].y; |
| | | vPtStd.push_back(pt); |
| | | |
| | | pt.x = pSideData->m_mBotPoint.x; |
| | | pt.y = pSideData->m_mBotPoint.y; |
| | | vPtPoint.push_back(pt); |
| | | pt.x = pSideData->m_mBotPoint2.x; |
| | | pt.y = pSideData->m_mBotPoint2.y; |
| | | vPtPoint.push_back(pt); |
| | | |
| | | ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtStd, vPtPoint); |
| | | pt = ClsVision::CoordinateTransform(ptImage, affine); |
| | | result.x = (int)(pt.x); |
| | | result.y = (int)(pt.y); |
| | | } |
| | | #endif |
| | | |
| | | return true; |
| | | } |
| | | |
| | | void CVisionBufferPro::getRect2Point(Point2D rect2CenterPoint, double rect2Phi, double rect2Length1, double rect2Length2, Point2D *rect2Points) { |
| | | /* code */ |
| | | double cosValue = cos(rect2Phi); |
| | | double sinValue = sin(rect2Phi); |
| | | |
| | | double Row = rect2CenterPoint.y; |
| | | double Column = rect2CenterPoint.x; |
| | | double Length1 = rect2Length1; |
| | | double Length2 = rect2Length2; |
| | | |
| | | //LeftTop Point |
| | | double TopLeft_X = -Length1*cosValue - Length2*sinValue; |
| | | double TopLeft_Y = -Length1*sinValue + Length2*cosValue; |
| | | rect2Points[0].x = Row - TopLeft_Y; |
| | | rect2Points[0].y = Column + TopLeft_X; |
| | | |
| | | //RightTop Point |
| | | double TopRight_X = Length1*cosValue - Length2*sinValue; |
| | | double TopRight_Y = Length1*sinValue + Length2*cosValue; |
| | | rect2Points[1].x = Row - TopRight_Y; |
| | | rect2Points[1].y = Column + TopRight_X; |
| | | |
| | | //RightDown Point |
| | | double LowerRight_X = Length1*cosValue + Length2*sinValue; |
| | | double LowerRight_Y = Length1*sinValue - Length2*cosValue; |
| | | rect2Points[2].x = Row - LowerRight_Y; |
| | | rect2Points[2].y = Column + LowerRight_X; |
| | | |
| | | //LeftDown Point |
| | | double LowerLeft_X = -Length1*cosValue + Length2*sinValue; |
| | | double LowerLeft_Y = -Length1*sinValue - Length2*cosValue; |
| | | rect2Points[3].x = Row - LowerLeft_Y; |
| | | rect2Points[3].y = Column + LowerLeft_X; |
| | | } |
| | | |
| | | Line2D CVisionBufferPro::getRect2Line(Point2D rect2CenterPoint, double rect2Phi, int rect2Length2) { |
| | | /* code */ |
| | | Point2D rect2Points[4]; |
| | | double rect2Length1 = 100.0f; |
| | | double length2 = rect2Length2; |
| | | getRect2Point(rect2CenterPoint, rect2Phi, rect2Length1, length2, rect2Points); |
| | | Line2D line; |
| | | line.pt0.x = 0.5 *(rect2Points[0].x + rect2Points[1].x); |
| | | line.pt0.y = 0.5 *(rect2Points[0].y + rect2Points[1].y); |
| | | line.pt1.x = 0.5 *(rect2Points[2].x + rect2Points[3].x); |
| | | line.pt1.y = 0.5 *(rect2Points[2].y + rect2Points[3].y); |
| | | return line; |
| | | } |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////////// |
| | | void SetMetrologyTransition(int hHandle, int iIndex, int getLineMode){ |
| | | /* code */ |
| | | if (hHandle < 0 || iIndex < 0) return; |
| | | |
| | | if (0 == getLineMode){ |
| | | HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "all"); |
| | | } |
| | | else if (1 == getLineMode){ |
| | | HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "positive"); |
| | | } |
| | | else if (2 == getLineMode){ |
| | | HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "negative"); |
| | | } |
| | | } |
| | | |
| | | void SetMetrologySelect(int hHandle, int iIndex, int getLineDirection){ |
| | | /* code */ |
| | | if (hHandle < 0 || iIndex < 0) return; |
| | | |
| | | if (0 == getLineDirection){ |
| | | HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "all"); |
| | | } |
| | | else if (1 == getLineDirection){ |
| | | HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "first"); |
| | | } |
| | | else if (2 == getLineDirection){ |
| | | HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "last"); |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::LineMeasureByRuler(HalconCpp::HObject &hObject, Line2D line, |
| | | LineMetrologyPara shapeMetrologyPara, Line2D &lineResult) |
| | | { |
| | | /* code */ |
| | | lineResult = line; |
| | | if (!ClsVision::ObjectExist(hObject)){ |
| | | return false; |
| | | } |
| | | |
| | | try |
| | | { |
| | | //1. å¾å尺寸 |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hObject, width, height); |
| | | |
| | | //2. å建æµé奿 |
| | | HalconCpp::HTuple hvMetrologyHandle; |
| | | HalconCpp::CreateMetrologyModel(&hvMetrologyHandle); |
| | | HalconCpp::SetMetrologyModelImageSize(hvMetrologyHandle, width, height); |
| | | |
| | | //3. å建æµç´çº¿çåæ° |
| | | HalconCpp::HTuple hvLineParams; |
| | | if (true){ |
| | | Line2D curLine = line; |
| | | int lineDirection = shapeMetrologyPara.direction; |
| | | if (0 == lineDirection){ |
| | | if (line.pt0.x < line.pt1.x) { |
| | | curLine = line; |
| | | } |
| | | else { |
| | | curLine.pt1 = line.pt0; |
| | | curLine.pt0 = line.pt1; |
| | | } |
| | | } |
| | | else if (1 == lineDirection){ |
| | | if (line.pt0.y < line.pt1.y){ |
| | | curLine = line; |
| | | } |
| | | else{ |
| | | curLine.pt0 = line.pt1; |
| | | curLine.pt1 = line.pt0; |
| | | } |
| | | } |
| | | //ç´çº¿æ¹å |
| | | hvLineParams.Clear(); |
| | | hvLineParams.Append(curLine.pt0.y); |
| | | hvLineParams.Append(curLine.pt0.x); |
| | | hvLineParams.Append(curLine.pt1.y); |
| | | hvLineParams.Append(curLine.pt1.x); |
| | | } |
| | | |
| | | HalconCpp::HTuple hvIndex, hvLen; |
| | | double stepLength = shapeMetrologyPara.stepLength; |
| | | double stepDist = shapeMetrologyPara.stepDist; |
| | | int threshold = shapeMetrologyPara.threshold; |
| | | HalconCpp::AddMetrologyObjectGeneric(hvMetrologyHandle, "line", hvLineParams, stepLength, stepDist, 1, threshold, |
| | | HalconCpp::HTuple(), HalconCpp::HTuple(), &hvIndex); |
| | | int iHandle = hvMetrologyHandle[0].I(); |
| | | |
| | | HalconCpp::TupleLength(hvIndex, &hvLen); |
| | | if (hvLen[0].I() < 1){ |
| | | HalconCpp::ClearMetrologyModel(iHandle); |
| | | return false; |
| | | } |
| | | |
| | | int iIndex = hvIndex[0].I(); |
| | | if (iIndex < 0){ |
| | | HalconCpp::ClearMetrologyModel(iHandle); |
| | | return false; |
| | | } |
| | | |
| | | //ç´çº¿çè¾¹çç¹ç±»å |
| | | int getLineMode = shapeMetrologyPara.getMode; |
| | | SetMetrologyTransition(iHandle, iIndex, getLineMode); |
| | | |
| | | HalconCpp::SetMetrologyObjectParam(iHandle, iIndex, "num_measures", shapeMetrologyPara.numSample); |
| | | HalconCpp::SetMetrologyObjectParam(iHandle, iIndex, "min_score", shapeMetrologyPara.minScore); |
| | | |
| | | //设置ç´çº¿æåæ¨¡å¼ |
| | | SetMetrologySelect(iHandle, iIndex, shapeMetrologyPara.getDirection); |
| | | HalconCpp::ApplyMetrologyModel(hObject, iHandle); |
| | | HalconCpp::HTuple hvParameter, hvLength; |
| | | HalconCpp::GetMetrologyObjectResult(iHandle, iIndex, "all", "result_type", "all_param", &hvParameter); |
| | | HalconCpp::TupleLength(hvParameter, &hvLength); |
| | | if (hvLength[0].I() < 1){ |
| | | HalconCpp::ClearMetrologyModel(iHandle); |
| | | return false; |
| | | } |
| | | |
| | | lineResult.pt0.y = hvParameter[0].D(); |
| | | lineResult.pt0.x = hvParameter[1].D(); |
| | | lineResult.pt1.y = hvParameter[2].D(); |
| | | lineResult.pt1.x = hvParameter[3].D(); |
| | | HalconCpp::ClearMetrologyModel(iHandle); |
| | | |
| | | return true; |
| | | } |
| | | catch (...) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | bool CVisionBufferPro::findCutLine(DimensionDir eDir, Point2I keyPoint, int keyRange, int keyThres, Point2I &result) { |
| | | /* code */ |
| | | result.x = 0; |
| | | result.y = 0; |
| | | CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir); |
| | | if (NULL == pSideData) return false; |
| | | if (!pSideData->m_bTopMark_Find) return false; |
| | | if (!pSideData->m_bBotMark_Find) return false; |
| | | |
| | | int x1 = keyPoint.x - keyRange; |
| | | int y1 = keyPoint.y - 31; |
| | | int x2 = keyPoint.x + keyRange; |
| | | int y2 = keyPoint.y + 31; |
| | | Point2I leftTop; |
| | | leftTop.x = x1; |
| | | leftTop.y = y1; |
| | | HalconCpp::HObject hImage; |
| | | if (!getImageROI(eDir, hImage, x1, y1, x2, y2)) return false; |
| | | |
| | | HalconCpp::HObject hMeanImage; |
| | | HalconCpp::MeanImage(hImage, &hMeanImage, 1, 20); |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 10 || height < 25) return false; |
| | | |
| | | HalconCpp::HObject hLineRegionRoi; |
| | | HalconCpp::GenRegionLine(&hLineRegionRoi, 0.5 * height - 1, 0, 0.5 * height - 1, width - 1); |
| | | HalconCpp::HTuple hvY, hvX, hvGray; |
| | | HalconCpp::GetRegionPoints(hLineRegionRoi, &hvY, &hvX); |
| | | HalconCpp::GetGrayval(hMeanImage, hvY, hvX, &hvGray); |
| | | HalconCpp::HTuple hvLength = hvX.TupleLength(); |
| | | int num = hvLength[0].I(); |
| | | if (num < 10) return false; |
| | | |
| | | HalconCpp::HTuple hvCyValue; |
| | | for (int i = 0; i < num; i++) { |
| | | if (hvGray[i].I() < keyThres) { |
| | | hvCyValue[i] = 255; |
| | | } |
| | | else { |
| | | hvCyValue[i] = 0; |
| | | } |
| | | } |
| | | |
| | | bool isStart = false; |
| | | bool isFind = false; |
| | | int nEdgeLine = 0; |
| | | for (int i = 0; i < num - 1; i++) { |
| | | if (isFind) break; |
| | | |
| | | if (hvCyValue[i].I() > 120 || hvCyValue[i + 1].I() > 120) { |
| | | isStart = true; |
| | | nEdgeLine = i; |
| | | } |
| | | |
| | | if (isStart && hvCyValue[i].I() < 120 && hvCyValue[i + 1].I() < 120) { |
| | | isFind = true; |
| | | } |
| | | } |
| | | if (!isFind) return false; |
| | | |
| | | result.x = leftTop.x + nEdgeLine; |
| | | result.y = leftTop.y + (int)(height / 2); |
| | | return true; |
| | | } |
| | | |
| | | int CVisionBufferPro::findNorchDefect(DimensionDir eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, |
| | | int szType, int xFzSize, int yFzSize, CRect* aryResult) { |
| | | /* code */ |
| | | if (roiRect.Width() < 10 || roiRect.Height() < 10) return 0; |
| | | if (nThres < 5 || nBinThres < 5) return 0; |
| | | if (0 == szType) return 0; |
| | | |
| | | int sz = (int)(vPoints.size()); |
| | | if (sz < 3) return 0; |
| | | |
| | | std::vector<Point2D> vEdgePoints; |
| | | for (auto item : vPoints) { |
| | | Point2D point = item; |
| | | vEdgePoints.push_back(point); |
| | | } |
| | | //1. è¿è¡èªä¸èä¸çæåº |
| | | for (int i = 0; i < sz - 1; i++) { |
| | | for (int j = i + 1; j < sz; j++) { |
| | | if (vEdgePoints[i].y > vEdgePoints[j].y) { |
| | | Point2D temp = vEdgePoints[i]; |
| | | vEdgePoints[i] = vEdgePoints[j]; |
| | | vEdgePoints[j] = temp; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //2. æªåROIå¾å |
| | | int x1 = roiRect.left; |
| | | int y1 = roiRect.top; |
| | | int x2 = roiRect.right; |
| | | int y2 = roiRect.bottom; |
| | | HalconCpp::HObject hImage; |
| | | if (!getImageROI(eDir, hImage, x1, y1, x2, y2)) return 0; |
| | | |
| | | int width = 0; |
| | | int height = 0; |
| | | ClsVision::GetImageSize(hImage, width, height); |
| | | if (width < 10 || height < 10) return 0; |
| | | |
| | | |
| | | //3. ç¹ä½åç§» |
| | | for (int i = 0; i < sz; i++) { |
| | | vEdgePoints[i].x -= roiRect.left; |
| | | vEdgePoints[i].y -= roiRect.top; |
| | | } |
| | | |
| | | int edgeThres = nThres; |
| | | if (nThres > 10) { |
| | | edgeThres = 10; |
| | | } |
| | | |
| | | std::vector<vec> vEdgeCtrlPoint; |
| | | for (int i = 0; i < sz; i++) { |
| | | if (0 != i) { |
| | | double dy = vEdgePoints[i].y - vEdgePoints[i - 1].y; |
| | | double dx = vEdgePoints[i].x - vEdgePoints[i - 1].x; |
| | | if (dy > 450) { |
| | | for (int j = 0; j < 3; j++) { |
| | | Line2D line; |
| | | line.pt0.x = vEdgePoints[i - 1].x + (j + 1) * dx / 4 - 75; |
| | | line.pt0.y = vEdgePoints[i - 1].y + (j + 1) * dy / 4; |
| | | line.pt1.x = vEdgePoints[i - 1].x + (j + 1) * dx / 4 + 75; |
| | | line.pt1.y = vEdgePoints[i - 1].y + (j + 1) * dy / 4; |
| | | if (line.pt0.x < 0) line.pt0.x = 1; |
| | | if (line.pt0.x > width - 1) line.pt0.x = width - 2; |
| | | if (line.pt0.y < 0) line.pt0.y = 1; |
| | | if (line.pt0.y > height - 1) line.pt0.y = height - 2; |
| | | if (line.pt1.x < 0) line.pt1.x = 1; |
| | | if (line.pt1.x > width - 1) line.pt1.x = width - 2; |
| | | if (line.pt1.y < 0) line.pt1.y = 1; |
| | | if (line.pt1.y > height - 1) line.pt1.y = height - 2; |
| | | if (line.pt1.x > line.pt0.x) { |
| | | Point2D ptStart, ptEnd; |
| | | if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) { |
| | | float xPos = (float)(ptEnd.x); |
| | | float yPos = (float)(ptEnd.y); |
| | | vec p1(xPos, yPos, 0); |
| | | vEdgeCtrlPoint.push_back(p1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else if (dy > 300) { |
| | | for (int j = 0; j < 2; j++) { |
| | | Line2D line; |
| | | line.pt0.x = vEdgePoints[i - 1].x + (j + 1) * dx / 3 - 75; |
| | | line.pt0.y = vEdgePoints[i - 1].y + (j + 1) * dy / 3; |
| | | line.pt1.x = vEdgePoints[i - 1].x + (j + 1) * dx / 3 + 75; |
| | | line.pt1.y = vEdgePoints[i - 1].y + (j + 1) * dy / 3; |
| | | if (line.pt0.x < 0) line.pt0.x = 1; |
| | | if (line.pt0.x > width - 1) line.pt0.x = width - 2; |
| | | if (line.pt0.y < 0) line.pt0.y = 1; |
| | | if (line.pt0.y > height - 1) line.pt0.y = height - 2; |
| | | if (line.pt1.x < 0) line.pt1.x = 1; |
| | | if (line.pt1.x > width - 1) line.pt1.x = width - 2; |
| | | if (line.pt1.y < 0) line.pt1.y = 1; |
| | | if (line.pt1.y > height - 1) line.pt1.y = height - 2; |
| | | if (line.pt1.x > line.pt0.x) { |
| | | Point2D ptStart, ptEnd; |
| | | if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) { |
| | | float xPos = (float)(ptEnd.x); |
| | | float yPos = (float)(ptEnd.y); |
| | | vec p1(xPos, yPos, 0); |
| | | vEdgeCtrlPoint.push_back(p1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | Line2D line; |
| | | line.pt0.x = 0.5 * (vEdgePoints[i].x + vEdgePoints[i - 1].x) - 75; |
| | | line.pt0.y = 0.5 * (vEdgePoints[i].y + vEdgePoints[i - 1].y); |
| | | line.pt1.x = 0.5 * (vEdgePoints[i].x + vEdgePoints[i - 1].x) + 75; |
| | | line.pt1.y = 0.5 * (vEdgePoints[i].y + vEdgePoints[i - 1].y); |
| | | if (line.pt0.x < 0) line.pt0.x = 1; |
| | | if (line.pt0.x > width - 1) line.pt0.x = width - 2; |
| | | if (line.pt0.y < 0) line.pt0.y = 1; |
| | | if (line.pt0.y > height - 1) line.pt0.y = height - 2; |
| | | if (line.pt1.x < 0) line.pt1.x = 1; |
| | | if (line.pt1.x > width - 1) line.pt1.x = width - 2; |
| | | if (line.pt1.y < 0) line.pt1.y = 1; |
| | | if (line.pt1.y > height - 1) line.pt1.y = height - 2; |
| | | if (line.pt1.x > line.pt0.x) { |
| | | Point2D ptStart, ptEnd; |
| | | if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) { |
| | | float xPos = (float)(ptEnd.x); |
| | | float yPos = (float)(ptEnd.y); |
| | | vec p1(xPos, yPos, 0); |
| | | vEdgeCtrlPoint.push_back(p1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | Point2D point = vEdgePoints[i]; |
| | | vec p0((float)point.x, (float)point.y, 0); |
| | | vEdgeCtrlPoint.push_back(p0); |
| | | } |
| | | |
| | | CBspline bspline(vEdgeCtrlPoint); |
| | | bspline.execute(); |
| | | |
| | | int number = (int)(bspline.m_vPtResults.size()); |
| | | if (number < 10) return 0; |
| | | |
| | | std::vector<Point2D> vPointResults; |
| | | for (int i = 0; i < number; i++) { |
| | | Point2D point; |
| | | point.x = bspline.m_vPtResults[i][0] + nOffset; |
| | | point.y = bspline.m_vPtResults[i][1]; |
| | | vPointResults.push_back(point); |
| | | } |
| | | |
| | | HalconCpp::HTuple hvY, hvX; |
| | | int idx = 0; |
| | | for (auto item : vPointResults) { |
| | | hvX[idx] = item.x; |
| | | hvY[idx] = item.y; |
| | | idx += 1; |
| | | } |
| | | |
| | | hvX[idx] = width - 5; |
| | | hvY[idx] = height - 5; |
| | | idx += 1; |
| | | |
| | | hvX[idx] = width - 5; |
| | | hvY[idx] = 5; |
| | | idx += 1; |
| | | |
| | | HalconCpp::HObject hRoiRegion; |
| | | HalconCpp::GenRegionPolygonFilled(&hRoiRegion, hvY, hvX); |
| | | |
| | | #if 0 |
| | | HalconCpp::HWindow hDispWin(0, 0, 0.4 * width, 0.4 * height); |
| | | hDispWin.SetPart(0, 0, height-1, width-1); |
| | | hDispWin.SetColor("green"); |
| | | hDispWin.SetDraw("margin"); |
| | | hDispWin.DispObj(hImage); |
| | | hDispWin.DispObj(hRoiRegion); |
| | | hDispWin.Click(); |
| | | #endif |
| | | |
| | | HalconCpp::HObject hBinRegion, hRegion, hConnectRegion, hSelectRegion; |
| | | HalconCpp::ReduceDomain(hImage, hRoiRegion, &hBinRegion); |
| | | HalconCpp::Threshold(hBinRegion, &hRegion, 0, nBinThres); |
| | | HalconCpp::Connection(hRegion, &hConnectRegion); |
| | | if (1 == szType) { |
| | | HalconCpp::HObject hSelectRegionX, hSelectRegionY, hConcatRegion, hUinonRegion, hClosngRegion; |
| | | HalconCpp::SelectShape(hConnectRegion, &hSelectRegionX, "width", "and", xFzSize, 99999999); |
| | | HalconCpp::SelectShape(hConnectRegion, &hSelectRegionY, "height", "and", yFzSize, 99999999); |
| | | HalconCpp::ConcatObj(hSelectRegionX, hSelectRegionY, &hConcatRegion); |
| | | HalconCpp::Union1(hConcatRegion, &hUinonRegion); |
| | | HalconCpp::ClosingCircle(hUinonRegion, &hClosngRegion, 7.5); |
| | | HalconCpp::Connection(hClosngRegion, &hSelectRegion); |
| | | } |
| | | else { |
| | | HalconCpp::HObject hSelectRegionX, hSelectRegionY, hConcatRegion, hUinonRegion, hClosngRegion; |
| | | HalconCpp::SelectShape(hConnectRegion, &hSelectRegionX, "width", "and", xFzSize, 99999999); |
| | | HalconCpp::SelectShape(hSelectRegionX, &hSelectRegion, "height", "and", yFzSize, 99999999); |
| | | HalconCpp::Union1(hSelectRegion, &hUinonRegion); |
| | | HalconCpp::ClosingCircle(hUinonRegion, &hClosngRegion, 7.5); |
| | | hSelectRegion.Clear(); |
| | | HalconCpp::Connection(hClosngRegion, &hSelectRegion); |
| | | } |
| | | #if 0 |
| | | hDispWin.SetColored(6); |
| | | hDispWin.SetDraw("fill"); |
| | | hDispWin.DispObj(hSelectRegion); |
| | | hDispWin.Click(); |
| | | #endif |
| | | int nRet = ClsVision::ObjectNumber(hSelectRegion); |
| | | if (nRet < 1) return 0; |
| | | |
| | | HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2; |
| | | HalconCpp::SmallestRectangle1(hSelectRegion, &hvY1, &hvX1, &hvY2, &hvX2); |
| | | int nNumber = 0; |
| | | for (int i = 0; i < nRet; i++) { |
| | | aryResult[i].left = hvX1[i].I() + roiRect.left; |
| | | aryResult[i].top = hvY1[i].I() + roiRect.top; |
| | | aryResult[i].right = hvX2[i].I() + roiRect.left; |
| | | aryResult[i].bottom = hvY2[i].I() + roiRect.top; |
| | | nNumber += 1; |
| | | if (i > 99) break; |
| | | } |
| | | |
| | | return nNumber; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef VISION_BUFFER_PRO |
| | | #define VISION_BUFFER_PRO |
| | | |
| | | #include "VisionRecipe.h" |
| | | |
| | | typedef struct _LineMetrologyPara |
| | | { |
| | | int direction; |
| | | int getMode; |
| | | int getDirection; |
| | | double stepLength; |
| | | double stepDist; |
| | | int threshold; |
| | | int numSample; |
| | | double minScore; |
| | | }LineMetrologyPara; |
| | | |
| | | class CVisionBufferPro |
| | | { |
| | | public: |
| | | CVisionBufferPro(); |
| | | ~CVisionBufferPro(); |
| | | |
| | | public: |
| | | //1. å¾åè½¬æ¢ |
| | | static bool bufferToObject(DimensionDir eDir, int height, HalconCpp::HObject &hImage); |
| | | |
| | | //2. æªå¾å¾å |
| | | static bool getImageROI(DimensionDir eDir, HalconCpp::HObject &hImage, int x1, int y1, int x2, int y2); |
| | | static bool getIndexImage(DimensionDir eDir, HalconCpp::HObject *hImage, int index); |
| | | |
| | | //3. è·åè·ç¦»çæ£æµç»æ |
| | | static bool getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &result, int &xPosPxl, int &yPosPxl); |
| | | |
| | | //4. æ¥æ¾ç¹ |
| | | static bool GetMeasurePos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int step, Point2D &ptStart, Point2D &ptEnd); |
| | | static bool GetMeasurePosKeyLimit(HalconCpp::HObject &hObject, Line2D line, int nTypePoint, int threshold, int modeTrans, int step, int distLimit, Point2D &ptStart, Point2D &ptEnd); |
| | | static bool GetMeasureRCutPos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int chamberSize, double proDist, Point2D &ptStart, Point2D &ptEnd); |
| | | static bool GetMeasureNearPos(HalconCpp::HObject& hObject, Line2D line, int threshold, int modeTrans, int step, Point2D& ptStart, Point2D& ptEnd); |
| | | |
| | | //5. è·åè·ç¦»çæ£æµç»æ |
| | | static int getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &distResult); |
| | | |
| | | //6. åæ è½¬æ¢ |
| | | static bool TransformToReal(DimensionDir eDir, Point2I point, int nType, Point2I &result); |
| | | |
| | | //7. è·ååæ åä¸ç¹åæ ãå³ä¸ç¹åæ ï¼å³ä¸ç¹åæ ï¼å·¦ä¸ç¹åæ |
| | | static void getRect2Point(Point2D rect2CenterPoint, double rect2Phi, double rect2Length1, double rect2Length2, Point2D *rect2Points); |
| | | |
| | | //8. è·åç©å½¢çæç´çº¿ |
| | | static Line2D getRect2Line(Point2D rect2CenterPoint, double rect2Phi, int rect2Length2); |
| | | |
| | | //9. æ¥æ¾ç´çº¿ |
| | | static bool LineMeasureByRuler(HalconCpp::HObject &hObject, Line2D line, |
| | | LineMetrologyPara shapeMetrologyPara, Line2D &lineResult); |
| | | |
| | | //10. è·å线æ«çå¾å帧ç宽度åé«åº¦ |
| | | static void getLineFrameSize(DimensionDir eDir, int &nFrameWidth, int &nFrameHeight); |
| | | |
| | | //11. æ¥æ¾åå² |
| | | static bool findCutLine(DimensionDir eDir, Point2I keyPoint, int keyRange, int keyThres, Point2I &result); |
| | | |
| | | //12. æ¥æ¾Norchç¼ºé· |
| | | static int findNorchDefect(DimensionDir eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, |
| | | int szType, int xFzSize, int yFzSize, CRect *aryResult); |
| | | |
| | | private: |
| | | |
| | | }; |
| | | |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "VisionRecipe.h" |
| | | #include "FileRecipe.h" |
| | | #include "SoftVisionApp.h" |
| | | #include <fstream> // IO æä½ |
| | | |
| | | CVisionRecipe::CVisionRecipe() { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | m_pCornerDistProcess[i] = NULL; |
| | | m_pCornerRcutProcess[i] = NULL; |
| | | m_pLocProcese[i] = NULL; |
| | | m_pBlSideData[i] = NULL; |
| | | m_pCutProcess[i] = NULL; |
| | | m_pKDistProcess[i] = NULL; |
| | | m_pThresProcess[i] = NULL; |
| | | } |
| | | |
| | | m_mScanSetting.lengthSize = 0; |
| | | m_mScanSetting.shortSize = 0; |
| | | m_mScanSetting.nStdIndex = 0; |
| | | m_mScanSetting.nIndex0 = 0; |
| | | m_mScanSetting.nIndex1 = 1; |
| | | m_mScanSetting.nIndex2 = 2; |
| | | m_mScanSetting.nIndex3 = 3; |
| | | m_mScanSetting.nLengthScan = 0; |
| | | m_mScanSetting.nShortScan = 0; |
| | | |
| | | m_isInit = false; |
| | | m_pMainDlg = NULL; |
| | | |
| | | m_visionDisplayInfo.isVisionDisplay = false; |
| | | m_visionDisplayInfo.isDistDisplay = false; |
| | | m_visionDisplayInfo.isRcutDisplay = false; |
| | | m_strVisionName = "system"; |
| | | |
| | | for (int i = 0; i < 8; i++) { |
| | | m_visionUseInfo[i].isVisionUse = false; |
| | | m_visionUseInfo[i].isLocUse = false; |
| | | m_visionUseInfo[i].isDistUse = false; |
| | | m_visionUseInfo[i].isRcutUse = false; |
| | | } |
| | | |
| | | m_keyInfo.isDebugTool = false; |
| | | m_keyInfo.isInspectKey = false; |
| | | m_keyInfo.isLocKey = false; |
| | | m_keyInfo.isGrindKey = false; |
| | | m_keyInfo.isDistKey = false; |
| | | m_keyInfo.isCutLineKey = false; |
| | | m_keyInfo.isRcutKey = false; |
| | | |
| | | //é»è®¤ä¸ä¸ªé
æ¹æ°æ® |
| | | m_workDir = ClsVision::GetAppPathA() + "Recipe"; |
| | | m_configVision.SetWorkDir(m_workDir.c_str(), m_strVisionName.c_str()); |
| | | readVisionConfig(); |
| | | m_isOpenVisionDlg = FALSE; |
| | | |
| | | m_nFrameX1 = -1; |
| | | m_nFrameY1 = -1; |
| | | m_nFrameX1 = -1; |
| | | m_nFrameY2 = -1; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | CVisionRecipe::~CVisionRecipe() { |
| | | /* code */ |
| | | release(); |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | static CVisionRecipe _gVisionRecipe; |
| | | CVisionRecipe* CVisionRecipe::getInstance(void) { |
| | | /* code */ |
| | | return &_gVisionRecipe; |
| | | } |
| | | |
| | | int CVisionRecipe::setWorkDir(const char *pszPath) { |
| | | /* code */ |
| | | m_workDir = pszPath; |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::save(void) { |
| | | /* code */ |
| | | std::string filePath = m_workDir; |
| | | int len = (int)(filePath.length()); |
| | | if (len < 1) return -1; |
| | | int pos = (int)(filePath.rfind(".dat")); |
| | | if (pos >= 0) return -1; |
| | | |
| | | int nRet = saveRecipeFile(filePath); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::saveRecipeFile(std::string filePath) { |
| | | /* code */ |
| | | //1. é¦å
å建æä»¶ç®å½ |
| | | std::string strDir = filePath + "\\" + m_strVisionName + "\\"; |
| | | CFileRecipe::makeDir(strDir); |
| | | |
| | | //2. æ¸
空ç®å½ä¸çæææä»¶ |
| | | CFileRecipe::removeDir(strDir); |
| | | |
| | | //3. æ°å»ºé
æ¹æä»¶ |
| | | //std::string fileName = strDir + "vision.csv"; |
| | | //CString strFile = CFileRecipe::toCString(fileName); |
| | | //if (!CFileRecipe::openRecipeFile(m_recipeFile, strFile)) return -1; |
| | | |
| | | CSoftVisionApp::getInstance()->Log(1, "Trace Save Vision Recipe!"); |
| | | |
| | | WriteRecipeVisionFile(); |
| | | |
| | | //if (CStdioFile::hFileNull != m_recipeFile.m_hFile) { |
| | | // m_recipeFile.Close(); |
| | | //} |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::WriteRecipeVisionFile(void) { |
| | | /* code */ |
| | | // if (CStdioFile::hFileNull == m_recipeFile.m_hFile) return -1; |
| | | |
| | | saveVisionConfig(); |
| | | |
| | | std::string strDir = m_workDir + "\\" + m_strVisionName + "\\"; |
| | | Json::Value root; |
| | | |
| | | int nCount = (int)(DIMENSION_NONE); |
| | | for (int i = 0; i < nCount; i++) { |
| | | CLocProcess *dot = m_pLocProcese[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("Loc%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(strDir); //ä¿åæ°æ® |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CGrindProcess *dot = m_pGrindProcess[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("Grind%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(); //ä¿åæ°æ® |
| | | } |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CCutProcess *dot = m_pCutProcess[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("Cut%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(); //ä¿åæ°æ® |
| | | } |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CKDistProcess *dot = m_pKDistProcess[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("KDist%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(); //ä¿åæ°æ® |
| | | } |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CCornerRcutProcess *dot = m_pCornerRcutProcess[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("RCut%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(); //ä¿åæ°æ® |
| | | } |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CThresProcess *dot = m_pThresProcess[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("Thres%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(); //ä¿åæ°æ® |
| | | } |
| | | |
| | | for (int i = 0; i < nCount; i++) { |
| | | CHoleProcess* dot = m_pHoleProcess[i]; |
| | | if (NULL == dot) continue; |
| | | |
| | | // dot->WriteToFile(m_recipeFile, strDir); |
| | | |
| | | std::string name = ClsVision::FormatString("Hole%d", i); |
| | | root[name.c_str()] = dot->WriteToJson(strDir); //ä¿åæ°æ® |
| | | } |
| | | |
| | | std::string fileName = strDir + "vision.json"; |
| | | std::string strText = root.toStyledString(); |
| | | ofstream ofs(fileName.c_str()); |
| | | ofs << strText; |
| | | ofs.close(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::open(void) { |
| | | /* code */ |
| | | std::string filePath = m_workDir; |
| | | if (!CFileRecipe::fileIsExist(filePath.c_str())) { |
| | | return -1; |
| | | } |
| | | |
| | | CSoftVisionApp::getInstance()->Log(1, "Trace Load Vision Recipe!"); |
| | | int nRet = openRecipeFile(filePath); |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::openRecipeFile(std::string filePath) { |
| | | /* code */ |
| | | readVisionConfig(); |
| | | |
| | | #if 0 |
| | | std::string strDir = filePath + "\\" + m_strVisionName + "\\"; |
| | | std::string jsFile = strDir + "vision.json"; |
| | | bool isExist = CFileRecipe::fileIsExist(jsFile.c_str()); |
| | | if (!isExist) { |
| | | if (!CFileRecipe::fileIsExist(strDir)) return -1; |
| | | |
| | | std::string fileName = strDir + "vision.csv"; |
| | | CString strFile = CFileRecipe::toCString(fileName); |
| | | if (!CFileRecipe::readRecileFile(m_recipeFile, strFile)) { |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | ReadRecipeFile(isExist); |
| | | #endif |
| | | |
| | | ReadRecipeFile(); |
| | | |
| | | #if 0 |
| | | if (!isExist) { |
| | | if (CStdioFile::hFileNull != m_recipeFile.m_hFile) { |
| | | m_recipeFile.Close(); |
| | | } |
| | | } |
| | | #endif |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CVisionRecipe::ReadRecipeFile(void) { |
| | | /* code */ |
| | | std::string strDir = m_workDir + "\\" + m_strVisionName + "\\"; |
| | | #if 0 |
| | | if (!isExist) { |
| | | if (CStdioFile::hFileNull == m_recipeFile.m_hFile) return; |
| | | |
| | | while (true) { |
| | | CString strReadText; |
| | | if (!CFileRecipe::ReadString(m_recipeFile, strReadText)) break; |
| | | |
| | | DecodeRecipeText(strReadText); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | #endif |
| | | |
| | | std::string fileName = strDir + "vision.json"; |
| | | if(!CFileRecipe::fileIsExist(fileName)) return; |
| | | |
| | | Json::Value jsFileRoot; |
| | | std::ifstream ifFile(fileName.c_str()); |
| | | Json::Reader jsReader; |
| | | jsReader.parse(ifFile, jsFileRoot); |
| | | ifFile.close(); |
| | | |
| | | DecodeJson(jsFileRoot); |
| | | jsFileRoot.clear(); |
| | | } |
| | | |
| | | void CVisionRecipe::DecodeJson(Json::Value jsFileRoot) { |
| | | /* code */ |
| | | int num = (int)(jsFileRoot.size()); |
| | | if (num < 1) return; |
| | | |
| | | std::string strDir = m_workDir + "\\" + m_strVisionName + "\\"; |
| | | |
| | | //1. Loc |
| | | int nCount = (int)(DIMENSION_NONE); |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("Loc%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CLocProcess *dot = m_pLocProcese[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(strDir, jsValue); |
| | | } |
| | | |
| | | //2. Grind |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("Grind%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CGrindProcess *dot = m_pGrindProcess[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(jsValue); |
| | | } |
| | | |
| | | //3. Cut |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("Cut%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CCutProcess *dot = m_pCutProcess[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(jsValue); |
| | | } |
| | | |
| | | //6. KDist |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("KDist%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CKDistProcess *dot = m_pKDistProcess[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(jsValue); |
| | | } |
| | | |
| | | //7. RCut |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("RCut%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CCornerRcutProcess *dot = m_pCornerRcutProcess[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(jsValue); |
| | | } |
| | | |
| | | //8. Thres |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("Thres%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CThresProcess *dot = m_pThresProcess[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(jsValue); |
| | | } |
| | | |
| | | //9. Hole |
| | | for (int i = 0; i < nCount; i++) { |
| | | std::string name = ClsVision::FormatString("Hole%d", i); |
| | | if (!jsFileRoot.isMember(name.c_str())) continue; |
| | | |
| | | Json::Value jsValue = jsFileRoot[name.c_str()]; |
| | | if (!jsValue.isObject()) continue; |
| | | |
| | | CHoleProcess* dot = m_pHoleProcess[i]; |
| | | if (NULL == dot) continue; |
| | | dot->DecodeJson(jsValue, strDir); |
| | | } |
| | | } |
| | | |
| | | #if 0 |
| | | void CVisionRecipe::DecodeRecipeText(CString strText) { |
| | | /* code */ |
| | | std::string strDir = m_workDir + "\\" + m_strVisionName + "\\"; |
| | | std::vector<std::string> vStrings; |
| | | int nRet = CFileRecipe::CStringSplit(strText, ",", vStrings); |
| | | if (nRet < 1) return; |
| | | |
| | | int nVisionType = CFileRecipe::StringToInt(vStrings[0]); |
| | | int idx = CFileRecipe::StringToInt(vStrings[1]); |
| | | switch (nVisionType){ |
| | | case LOC_VISION_TYPE: { |
| | | CLocProcess *dot = m_pLocProcese[idx]; |
| | | if (NULL == dot) return; |
| | | int id = CFileRecipe::StringToInt(vStrings[2]); |
| | | CNccDotProcess *pNccDot = dot->getDot(id); |
| | | if (NULL == pNccDot) return; |
| | | pNccDot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case LOC_VISION_PROCESS: { |
| | | CLocProcess *dot = m_pLocProcese[idx]; |
| | | if (NULL == dot) return; |
| | | dot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case GRIND_VISION_TYPE: { |
| | | CGrindProcess *dot = m_pGrindProcess[idx]; |
| | | if (NULL == dot) return; |
| | | int id = CFileRecipe::StringToInt(vStrings[2]); |
| | | CGrindDotProcess *pGrindDot = dot->m_dots[id - 1]; |
| | | if (NULL == pGrindDot) return; |
| | | pGrindDot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case GRIND_VISION_PROCESS: { |
| | | CGrindProcess *dot = m_pGrindProcess[idx]; |
| | | if (NULL == dot) return; |
| | | dot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case CUT_VISION_TYPE: { |
| | | CCutProcess *dot = m_pCutProcess[idx]; |
| | | if (NULL == dot) return; |
| | | int id = CFileRecipe::StringToInt(vStrings[2]); |
| | | CCutDotProcess *pCutDot = dot->m_dots[id - 1]; |
| | | if (NULL == pCutDot) return; |
| | | pCutDot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case CUT_VISION_PROCESS: { |
| | | CCutProcess *dot = m_pCutProcess[idx]; |
| | | if (NULL == dot) return; |
| | | dot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case KDIST_VISION_TYPE: { |
| | | CKDistProcess *dot = m_pKDistProcess[idx]; |
| | | if (NULL == dot) return; |
| | | int id = CFileRecipe::StringToInt(vStrings[2]); |
| | | CKeyDistDotProcess *pKDistDot = dot->m_dots[id - 1]; |
| | | if (NULL == pKDistDot) return; |
| | | pKDistDot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case KDIST_VISION_PROCESS: { |
| | | CKDistProcess *dot = m_pKDistProcess[idx]; |
| | | if (NULL == dot) return; |
| | | dot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case RCUT_VISION_TYPE: { |
| | | CCornerRcutProcess *dot = m_pCornerRcutProcess[idx]; |
| | | if (NULL == dot) return; |
| | | int id = CFileRecipe::StringToInt(vStrings[2]); |
| | | CRcutDotProcess *pRcutDot = dot->m_dots[id - 1]; |
| | | if (NULL == pRcutDot) return; |
| | | pRcutDot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case RCUT_VISION_PROCESS: { |
| | | CCornerRcutProcess *dot = m_pCornerRcutProcess[idx]; |
| | | if (NULL == dot) return; |
| | | dot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | case THRES_VISION_TYPE: { |
| | | CThresProcess *dot = m_pThresProcess[idx]; |
| | | if (NULL == dot) return; |
| | | int id = CFileRecipe::StringToInt(vStrings[2]); |
| | | CThresDotProcess *pThresDot = dot->m_dots[id - 1]; |
| | | if (NULL == pThresDot) return; |
| | | pThresDot->ReadFile(strText, strDir); |
| | | |
| | | break; |
| | | } |
| | | |
| | | case THRES_VISION_PROCESS: { |
| | | CThresProcess *dot = m_pThresProcess[idx]; |
| | | if (NULL == dot) return; |
| | | dot->ReadFile(strText, strDir); |
| | | break; |
| | | } |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | #endif |
| | | |
| | | CGrabberControl* CVisionRecipe::getGrabberControl(int iCam) { |
| | | /* code */ |
| | | if (iCam < 0 || iCam >= MAX_CAMERA_COUNT) return nullptr; |
| | | |
| | | Lock(); |
| | | CGrabberControl *pGrabberControl = m_pGrabberControl[iCam]; |
| | | Unlock(); |
| | | |
| | | return pGrabberControl; |
| | | } |
| | | |
| | | int CVisionRecipe::setGrabberControl(CGrabberControl *pGrabberControl, int iCam) { |
| | | /* code */ |
| | | if (iCam < 0 || iCam >= MAX_CAMERA_COUNT) return -1; |
| | | |
| | | Lock(); |
| | | m_pGrabberControl[iCam] = pGrabberControl; |
| | | Unlock(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::setCameraSetting(DimensionDir eDir, int iCam, int iScan) { |
| | | /* code */ |
| | | if (DIMENSION_NONE == eDir) return -1; |
| | | |
| | | int idx = (int)(eDir); |
| | | auto iter = m_mapLineCameraSetting.find(idx); |
| | | if (iter == m_mapLineCameraSetting.end()) { |
| | | LineCameraSetting *p = new LineCameraSetting(); |
| | | p->eDir = eDir; |
| | | p->nCam = iCam; |
| | | p->nScan = iScan; |
| | | m_mapLineCameraSetting[idx] = p; |
| | | return 0; |
| | | } |
| | | |
| | | iter->second->eDir = eDir; |
| | | iter->second->nCam = iCam; |
| | | iter->second->nScan = iScan; |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::init(void) { |
| | | /* code */ |
| | | if (m_isInit) return 0; |
| | | |
| | | // HalconCpp::SetSystem("temporary_mem_cache", "false"); |
| | | |
| | | //1. å建SideData |
| | | createSideData(); |
| | | |
| | | //3. å建RCUTæ°æ® |
| | | createAllCornerRcutProcess(); |
| | | |
| | | //4. å建å®ä½ |
| | | createAllLocProcess(); |
| | | |
| | | //5. å建åå²çº¿ |
| | | createCutProcess(); |
| | | |
| | | //6. å建KDist |
| | | createKDistProcess(); |
| | | |
| | | //7. å建 |
| | | createGrindProcess(); |
| | | |
| | | //8. å建Thres |
| | | createThresProcess(); |
| | | |
| | | //9. å建Hole |
| | | createHoleProcess(); |
| | | |
| | | m_isInit = true; |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | void CVisionRecipe::createSideData(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CBlSideData *pSide = m_pBlSideData[i]; |
| | | if (NULL != pSide) { |
| | | delete pSide; |
| | | pSide = NULL; |
| | | m_pBlSideData[i] = NULL; |
| | | } |
| | | m_pBlSideData[i] = new CBlSideData(); |
| | | } |
| | | } |
| | | |
| | | int CVisionRecipe::getCameraIndex(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | auto iter = m_mapLineCameraSetting.find(idx); |
| | | if (iter == m_mapLineCameraSetting.end()) return -1; |
| | | |
| | | int nRet = iter->second->nCam; |
| | | return nRet; |
| | | } |
| | | |
| | | int CVisionRecipe::getCameraScan(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | auto iter = m_mapLineCameraSetting.find(idx); |
| | | if (iter == m_mapLineCameraSetting.end()) return -1; |
| | | |
| | | int nRet = iter->second->nScan; |
| | | return nRet; |
| | | } |
| | | |
| | | void CVisionRecipe::release(void) { |
| | | /* code */ |
| | | releaseLineCameraSetting(); |
| | | |
| | | #if 0 |
| | | releaaseAllCornerDistProcess(); |
| | | #endif |
| | | |
| | | releaseAllCornerRcutProcess(); |
| | | |
| | | releaseAllLocProcess(); |
| | | |
| | | releaseAllCutProcess(); |
| | | |
| | | releaseAllKDistProcess(); |
| | | |
| | | releaseAllGrindProcess(); |
| | | |
| | | releaseAllThresProcess(); |
| | | |
| | | releaseAllHoleProcess(); |
| | | } |
| | | |
| | | void CVisionRecipe::releaseLineCameraSetting(void) { |
| | | /* code */ |
| | | for (auto iter = m_mapLineCameraSetting.begin(); iter != m_mapLineCameraSetting.end(); iter++) { |
| | | if (NULL == iter->second) continue; |
| | | delete iter->second; |
| | | iter->second = NULL; |
| | | } |
| | | |
| | | m_mapLineCameraSetting.clear(); |
| | | } |
| | | |
| | | void CVisionRecipe::createAllCornerDistProcess(void) { |
| | | /* code */ |
| | | return; |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CCornerDistProcess *pDot = m_pCornerDistProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pCornerDistProcess[i] = NULL; |
| | | } |
| | | m_pCornerDistProcess[i] = new CCornerDistProcess(); |
| | | m_pCornerDistProcess[i]->m_eDir = (DimensionDir)(i); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createAllLocProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CLocProcess *dot = m_pLocProcese[i]; |
| | | if (NULL == dot) { |
| | | delete dot; |
| | | dot = NULL; |
| | | m_pLocProcese[i] = NULL; |
| | | } |
| | | DimensionDir edir = (DimensionDir)(i);; |
| | | m_pLocProcese[i] = new CLocProcess(edir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createCutProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CCutProcess *dot = m_pCutProcess[i]; |
| | | if (NULL == dot) { |
| | | delete dot; |
| | | dot = NULL; |
| | | m_pCutProcess[i] = NULL; |
| | | } |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | m_pCutProcess[i] = new CCutProcess(eDir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createKDistProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CKDistProcess *dot = m_pKDistProcess[i]; |
| | | if (NULL == dot) { |
| | | delete dot; |
| | | dot = NULL; |
| | | m_pKDistProcess[i] = NULL; |
| | | } |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | m_pKDistProcess[i] = new CKDistProcess(eDir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createGrindProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CGrindProcess *dot = m_pGrindProcess[i]; |
| | | if (NULL == dot) { |
| | | delete dot; |
| | | dot = NULL; |
| | | m_pGrindProcess[i] = NULL; |
| | | } |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | m_pGrindProcess[i] = new CGrindProcess(eDir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createThresProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CThresProcess *dot = m_pThresProcess[i]; |
| | | if (NULL == dot) { |
| | | delete dot; |
| | | dot = NULL; |
| | | m_pThresProcess[i] = NULL; |
| | | } |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | m_pThresProcess[i] = new CThresProcess(eDir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createHoleProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CHoleProcess* dot = m_pHoleProcess[i]; |
| | | if (NULL == dot) { |
| | | delete dot; |
| | | dot = NULL; |
| | | m_pHoleProcess[i] = NULL; |
| | | } |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | m_pHoleProcess[i] = new CHoleProcess(eDir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::createAllCornerRcutProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CCornerRcutProcess *pDot = m_pCornerRcutProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pCornerRcutProcess[i] = NULL; |
| | | } |
| | | |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | m_pCornerRcutProcess[i] = new CCornerRcutProcess(eDir); |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaaseAllCornerDistProcess(void) { |
| | | /* code */ |
| | | return; |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CCornerDistProcess *pDot = m_pCornerDistProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pCornerDistProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllCornerRcutProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CCornerRcutProcess *pDot = m_pCornerRcutProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pCornerRcutProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllLocProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CLocProcess *pDot = m_pLocProcese[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pLocProcese[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllCutProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CCutProcess *pDot = m_pCutProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pCutProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllKDistProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CKDistProcess *pDot = m_pKDistProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pKDistProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllGrindProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CGrindProcess *pDot = m_pGrindProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pGrindProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllThresProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CThresProcess *pDot = m_pThresProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pThresProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaseAllHoleProcess(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CHoleProcess* pDot = m_pHoleProcess[i]; |
| | | if (NULL != pDot) { |
| | | delete pDot; |
| | | pDot = NULL; |
| | | m_pThresProcess[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CVisionRecipe::releaaseAllSideData(void) { |
| | | /* code */ |
| | | for (int i = 0; i < DIMENSION_NONE; i++) { |
| | | CBlSideData *pSide = m_pBlSideData[i]; |
| | | if (NULL != pSide) { |
| | | delete pSide; |
| | | pSide = NULL; |
| | | m_pBlSideData[i] = NULL; |
| | | } |
| | | } |
| | | } |
| | | |
| | | CCornerDistProcess* CVisionRecipe::getCornerDistProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CCornerDistProcess *dot = m_pCornerDistProcess[idx]; |
| | | Unlock(); |
| | | |
| | | return dot; |
| | | } |
| | | |
| | | CBlSideData* CVisionRecipe::getSideData(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CBlSideData *pSideData = m_pBlSideData[idx]; |
| | | Unlock(); |
| | | |
| | | return pSideData; |
| | | } |
| | | |
| | | int CVisionRecipe::setRecipeType(int nType) { |
| | | /* code */ |
| | | m_nRecipeType = nType; |
| | | return 0; |
| | | } |
| | | |
| | | int CVisionRecipe::getRecipeType(void) { |
| | | /* code */ |
| | | return m_nRecipeType; |
| | | } |
| | | |
| | | bool CVisionRecipe::getVisionUse(void) { |
| | | /* code */ |
| | | return m_visionDisplayInfo.isVisionDisplay; |
| | | } |
| | | |
| | | int CVisionRecipe::setVisionName(const char* pszPath) { |
| | | /* code */ |
| | | if (nullptr == pszPath || std::string(pszPath).length() < 1){ |
| | | return -1; |
| | | } |
| | | |
| | | m_strVisionName = pszPath; |
| | | m_configVision.SetWorkDir(m_workDir.c_str() , m_strVisionName.c_str()); |
| | | return true; |
| | | } |
| | | |
| | | int CVisionRecipe::setProductNo(const char* pszNo) { |
| | | /* code */ |
| | | m_strProductNo = pszNo; |
| | | return 0; |
| | | } |
| | | |
| | | //14. è·åé
æ¹åç§° |
| | | std::string CVisionRecipe::getVisionName() { |
| | | /* code */ |
| | | return m_strVisionName; |
| | | } |
| | | |
| | | std::string CVisionRecipe::getProductNo(void) { |
| | | /* code */ |
| | | return m_strProductNo; |
| | | } |
| | | |
| | | void CVisionRecipe::setGlassSize(int x, int y) { |
| | | /* code */ |
| | | m_mScanSetting.lengthSize = x; |
| | | m_mScanSetting.shortSize = y; |
| | | } |
| | | |
| | | void CVisionRecipe::SetMainDlg(CDialogEx *pDlg) { |
| | | /* code */ |
| | | m_pMainDlg = pDlg; |
| | | } |
| | | |
| | | CDialogEx* CVisionRecipe::GetMainDlg(void) { |
| | | /* code */ |
| | | return m_pMainDlg; |
| | | } |
| | | |
| | | CCornerRcutProcess* CVisionRecipe::getCornerRcutProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CCornerRcutProcess *dot = m_pCornerRcutProcess[idx]; |
| | | Unlock(); |
| | | return dot; |
| | | } |
| | | |
| | | CLocProcess* CVisionRecipe::getLocProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CLocProcess *dot = m_pLocProcese[idx]; |
| | | Unlock(); |
| | | |
| | | return dot; |
| | | } |
| | | |
| | | CCutProcess* CVisionRecipe::getCutProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CCutProcess *dot = m_pCutProcess[idx]; |
| | | Unlock(); |
| | | |
| | | return dot; |
| | | } |
| | | |
| | | CKDistProcess* CVisionRecipe::getKDistProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CKDistProcess *dot = m_pKDistProcess[idx]; |
| | | Unlock(); |
| | | |
| | | return dot; |
| | | } |
| | | |
| | | CGrindProcess* CVisionRecipe::getGrindProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CGrindProcess *dot = m_pGrindProcess[idx]; |
| | | Unlock(); |
| | | return dot; |
| | | } |
| | | |
| | | CThresProcess* CVisionRecipe::getThresProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CThresProcess *dot = m_pThresProcess[idx]; |
| | | Unlock(); |
| | | return dot; |
| | | } |
| | | |
| | | CHoleProcess* CVisionRecipe::getHoleProcess(DimensionDir eDir) { |
| | | /* code */ |
| | | int idx = (int)(eDir); |
| | | int fz = (int)(DIMENSION_NONE); |
| | | if (idx < 0 || idx >= fz) return NULL; |
| | | |
| | | Lock(); |
| | | CHoleProcess* dot = m_pHoleProcess[idx]; |
| | | Unlock(); |
| | | return dot; |
| | | } |
| | | |
| | | ScanSetting CVisionRecipe::getScanSetting(void) { |
| | | /* code */ |
| | | return m_mScanSetting; |
| | | } |
| | | |
| | | void CVisionRecipe::setScanSetting(ScanSetting inf) { |
| | | /* code */ |
| | | m_mScanSetting = inf; |
| | | } |
| | | |
| | | void CVisionRecipe::saveVisionConfig(void) { |
| | | /* code */ |
| | | //ä¿åæ¾ç¤º |
| | | std::string strSection = "Vision Display"; |
| | | m_configVision.WriteBool(strSection.c_str(), "Vision Show", m_visionDisplayInfo.isVisionDisplay); |
| | | m_configVision.WriteBool(strSection.c_str(), "Dist Show", m_visionDisplayInfo.isDistDisplay); |
| | | m_configVision.WriteBool(strSection.c_str(), "RCUT Show", m_visionDisplayInfo.isRcutDisplay); |
| | | m_configVision.WriteBool(strSection.c_str(), "Grind Show", m_visionDisplayInfo.isGrindDisplay); |
| | | m_configVision.WriteBool(strSection.c_str(), "CUT Show", m_visionDisplayInfo.isCutDisplay); |
| | | m_configVision.WriteBool(strSection.c_str(), "Thres Show", m_visionDisplayInfo.isThresDisplay); |
| | | m_configVision.WriteBool(strSection.c_str(), "Hole Show", m_visionDisplayInfo.isHoleDisplay); |
| | | |
| | | std::string array_dir_use[8] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT" }; |
| | | for (int i = 0; i < 8; i++) { |
| | | strSection = array_dir_use[i]; |
| | | m_configVision.WriteBool(strSection.c_str(), "Vision Use", m_visionUseInfo[i].isVisionUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "LOC Use", m_visionUseInfo[i].isLocUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "Dist Use", m_visionUseInfo[i].isDistUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "RCUT Use", m_visionUseInfo[i].isRcutUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "Grind Use", m_visionUseInfo[i].isGrindUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "Cut Use", m_visionUseInfo[i].isCutUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "Thres Use", m_visionUseInfo[i].isThresUse); |
| | | m_configVision.WriteBool(strSection.c_str(), "Hole Use", m_visionUseInfo[i].isHoleUse); |
| | | } |
| | | |
| | | strSection = "Scan"; |
| | | m_configVision.WriteInt(strSection.c_str(), "Length Size", m_mScanSetting.lengthSize); |
| | | m_configVision.WriteInt(strSection.c_str(), "Short Size", m_mScanSetting.shortSize); |
| | | m_configVision.WriteInt(strSection.c_str(), "Standard Point", m_mScanSetting.nStdIndex); |
| | | m_configVision.WriteInt(strSection.c_str(), "First Point", m_mScanSetting.nIndex0); |
| | | m_configVision.WriteInt(strSection.c_str(), "Second Point", m_mScanSetting.nIndex1); |
| | | m_configVision.WriteInt(strSection.c_str(), "Third Point", m_mScanSetting.nIndex2); |
| | | m_configVision.WriteInt(strSection.c_str(), "Fourth Point", m_mScanSetting.nIndex3); |
| | | m_configVision.WriteInt(strSection.c_str(), "Length Scan", m_mScanSetting.nLengthScan); |
| | | m_configVision.WriteInt(strSection.c_str(), "Short Scan", m_mScanSetting.nShortScan); |
| | | } |
| | | |
| | | void CVisionRecipe::readVisionConfig(void) { |
| | | /* code */ |
| | | std::string strSection = "Vision Display"; |
| | | m_visionDisplayInfo.isVisionDisplay = m_configVision.ReadBool(strSection.c_str(), "Vision Show", false); |
| | | m_visionDisplayInfo.isDistDisplay = m_configVision.ReadBool(strSection.c_str(), "Dist Show", false); |
| | | m_visionDisplayInfo.isRcutDisplay = m_configVision.ReadBool(strSection.c_str(), "RCUT Show", false); |
| | | m_visionDisplayInfo.isGrindDisplay = m_configVision.ReadBool(strSection.c_str(), "Grind Show", false); |
| | | m_visionDisplayInfo.isCutDisplay = m_configVision.ReadBool(strSection.c_str(), "CUT Show", false); |
| | | m_visionDisplayInfo.isThresDisplay = m_configVision.ReadBool(strSection.c_str(), "Thres Show", false); |
| | | m_visionDisplayInfo.isHoleDisplay = m_configVision.ReadBool(strSection.c_str(), "Hole Show", false); |
| | | |
| | | |
| | | std::string array_dir_use[8] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT" }; |
| | | for (int i = 0; i < 8; i++) { |
| | | strSection = array_dir_use[i]; |
| | | m_visionUseInfo[i].isVisionUse = m_configVision.ReadBool(strSection.c_str(), "Vision Use", false); |
| | | m_visionUseInfo[i].isLocUse = m_configVision.ReadBool(strSection.c_str(), "LOC Use", false); |
| | | m_visionUseInfo[i].isDistUse = m_configVision.ReadBool(strSection.c_str(), "Dist Use", false); |
| | | m_visionUseInfo[i].isRcutUse = m_configVision.ReadBool(strSection.c_str(), "RCUT Use", false); |
| | | m_visionUseInfo[i].isGrindUse = m_configVision.ReadBool(strSection.c_str(), "Grind Use", false); |
| | | m_visionUseInfo[i].isCutUse = m_configVision.ReadBool(strSection.c_str(), "Cut Use", false); |
| | | m_visionUseInfo[i].isThresUse = m_configVision.ReadBool(strSection.c_str(), "Thres Use", false); |
| | | m_visionUseInfo[i].isHoleUse = m_configVision.ReadBool(strSection.c_str(), "Hole Use", false); |
| | | } |
| | | |
| | | strSection = "Scan"; |
| | | m_mScanSetting.lengthSize = m_configVision.ReadInt(strSection.c_str(), "Length Size", 0); |
| | | m_mScanSetting.shortSize = m_configVision.ReadInt(strSection.c_str(), "Short Size",0); |
| | | m_mScanSetting.nStdIndex = m_configVision.ReadInt(strSection.c_str(), "Standard Point", 0); |
| | | m_mScanSetting.nIndex0 = m_configVision.ReadInt(strSection.c_str(), "First Point", 0); |
| | | m_mScanSetting.nIndex1 = m_configVision.ReadInt(strSection.c_str(), "Second Point", 0); |
| | | m_mScanSetting.nIndex2 = m_configVision.ReadInt(strSection.c_str(), "Third Point", 0); |
| | | m_mScanSetting.nIndex3 = m_configVision.ReadInt(strSection.c_str(), "Fourth Point", 0); |
| | | m_mScanSetting.nLengthScan = m_configVision.ReadInt(strSection.c_str(), "Length Scan", 0); |
| | | m_mScanSetting.nShortScan = m_configVision.ReadInt(strSection.c_str(), "Short Scan", 0); |
| | | } |
| | | |
| | | VisionUseInfo CVisionRecipe::getVisionUse(DimensionDir eDir) { |
| | | /* code */ |
| | | VisionUseInfo inf; |
| | | inf.isVisionUse = false; |
| | | inf.isLocUse = false; |
| | | inf.isDistUse = false; |
| | | inf.isRcutUse = false; |
| | | int index = (int)(eDir); |
| | | if (index < 0 || index > 7) return inf; |
| | | |
| | | inf = m_visionUseInfo[index]; |
| | | return inf; |
| | | } |
| | | |
| | | void CVisionRecipe::setVisionUse(VisionUseInfo inf, DimensionDir eDir) { |
| | | /* code */ |
| | | int index = (int)(eDir); |
| | | if (index < 0 || index > 7) return; |
| | | |
| | | m_visionUseInfo[index] = inf; |
| | | } |
| | | |
| | | VisionDisplayInfo CVisionRecipe::getVisionDisplay(void) { |
| | | /* code */ |
| | | return m_visionDisplayInfo; |
| | | } |
| | | |
| | | void CVisionRecipe::setVisionDisplay(VisionDisplayInfo inf) { |
| | | /* code */ |
| | | m_visionDisplayInfo = inf; |
| | | } |
| | | |
| | | KeyDebugInfo CVisionRecipe::getKeyInfo(void) { |
| | | /* code */ |
| | | return m_keyInfo; |
| | | } |
| | | |
| | | void CVisionRecipe::setKeyInfo(KeyDebugInfo info) { |
| | | /* code */ |
| | | m_keyInfo = info; |
| | | } |
| | | |
| | | void CVisionRecipe::setVisionSetOpen(BOOL isOpen) { |
| | | /* code */ |
| | | m_isOpenVisionDlg = isOpen; |
| | | } |
| | | |
| | | BOOL CVisionRecipe::getVisionSetOpen(void) { |
| | | /* code */ |
| | | return m_isOpenVisionDlg; |
| | | } |
| | | |
| | | void CVisionRecipe::setFrame(int x1, int y1, int x2, int y2) { |
| | | /* code */ |
| | | m_nFrameX1 = x1; |
| | | m_nFrameY1 = y1; |
| | | m_nFrameX2 = x2; |
| | | m_nFrameY2 = y2; |
| | | } |
| | | |
| | | bool CVisionRecipe::getFrame(int &x1, int &y1, int &x2, int &y2) { |
| | | /* code */ |
| | | x1 = m_nFrameX1; |
| | | y1 = m_nFrameY1; |
| | | x2 = m_nFrameX2; |
| | | y2 = m_nFrameY2; |
| | | bool result = false; |
| | | if (x1 >= 0 && y1 >= 0 && x2 > x1 && y2 > y1) result = true; |
| | | return true; |
| | | } |
| BlVisionPro/Vision/VisionRecipe.h
BlVisionPro/res/BlVisionPro.rc2
BlVisionPro/res/navigate_down.ico
BlVisionPro/res/navigate_left.ico
BlVisionPro/res/navigate_right.ico
BlVisionPro/res/navigate_up.ico
BlVisionPro/resource.h
BlVisionPro/stdafx.cpp
BlVisionPro/stdafx.h
BlVisionPro/targetver.h
Common_Class/AutoFileCleanupTool/AutoFileCleanupTool.cpp
Common_Class/AutoFileCleanupTool/AutoFileCleanupTool.h
Common_Class/AutoFileCleanupTool/AutoFileCleanupTool.rc
Common_Class/AutoFileCleanupTool/AutoFileCleanupTool.vcxproj
Common_Class/AutoFileCleanupTool/AutoFileCleanupTool.vcxproj.filters
Common_Class/AutoFileCleanupTool/AutoFileCleanupToolDlg.cpp
Common_Class/AutoFileCleanupTool/AutoFileCleanupToolDlg.h
Common_Class/AutoFileCleanupTool/framework.h
Common_Class/AutoFileCleanupTool/pch.cpp
Common_Class/AutoFileCleanupTool/pch.h
Common_Class/AutoFileCleanupTool/res/AutoFileCleanupTool.ico
Common_Class/AutoFileCleanupTool/res/AutoFileCleanupTool.rc2
Common_Class/AutoFileCleanupTool/resource.h
Common_Class/AutoFileCleanupTool/targetver.h
Common_Class/BlGrabber/BlGrabber.cpp
Common_Class/BlGrabber/BlGrabber.def
Common_Class/BlGrabber/BlGrabber.h
Common_Class/BlGrabber/BlGrabber.rc
Common_Class/BlGrabber/BlGrabber.vcxproj
Common_Class/BlGrabber/BlGrabber.vcxproj.filters
Common_Class/BlGrabber/FrameBufferController.cpp
Common_Class/BlGrabber/GrabberControl.cpp
Common_Class/BlGrabber/Header/FrameBufferController.h
Common_Class/BlGrabber/Header/GrabberControl.h
Common_Class/BlGrabber/ReadMe.txt
Common_Class/BlGrabber/Resource.h
Common_Class/BlGrabber/res/BlGrabber.rc2
Common_Class/BlGrabber/stdafx.cpp
Common_Class/BlGrabber/stdafx.h
Common_Class/BlGrabber/targetver.h
Common_Class/CHImageBuffer/CHImageBuffer.cpp
Common_Class/CHImageBuffer/CHImageBuffer.def
Common_Class/CHImageBuffer/CHImageBuffer.rc
Common_Class/CHImageBuffer/CHImageBuffer.sln
Common_Class/CHImageBuffer/CHImageBuffer.vcxproj
Common_Class/CHImageBuffer/CHImageBuffer.vcxproj.filters
Common_Class/CHImageBuffer/CHImageBufferD.def
Common_Class/CHImageBuffer/Header/ImageBuffer.h
Common_Class/CHImageBuffer/Header/ImageViewer.h
Common_Class/CHImageBuffer/ImageBuffer.cpp
Common_Class/CHImageBuffer/ImageTracker.cpp
Common_Class/CHImageBuffer/ImageTracker.h
Common_Class/CHImageBuffer/ImageViewer.cpp
Common_Class/CHImageBuffer/ReadMe.txt
Common_Class/CHImageBuffer/Resource.h
Common_Class/CHImageBuffer/dllmain.cpp
Common_Class/CHImageBuffer/res/CHImageBuffer.rc2
Common_Class/CHImageBuffer/stdafx.cpp
Common_Class/CHImageBuffer/stdafx.h
Common_Class/CHImageBuffer/targetver.h
Common_Class/CHThreadPool/CHThreadPool.cpp
Common_Class/CHThreadPool/CHThreadPool.def
Common_Class/CHThreadPool/CHThreadPool.rc
Common_Class/CHThreadPool/CHThreadPool.sln
Common_Class/CHThreadPool/CHThreadPool.vcxproj
Common_Class/CHThreadPool/CHThreadPool.vcxproj.filters
Common_Class/CHThreadPool/Header/PriorityThread.h
Common_Class/CHThreadPool/Header/ThreadData.h
Common_Class/CHThreadPool/Header/ThreadPool.h
Common_Class/CHThreadPool/Header/TimerThreadPool.h
Common_Class/CHThreadPool/Header/WaitThreadPool.h
Common_Class/CHThreadPool/Header/WorkThreadArray.h
Common_Class/CHThreadPool/Header/WorkThreadPool.h
Common_Class/CHThreadPool/PriorityThread.cpp
Common_Class/CHThreadPool/ReadMe.txt
Common_Class/CHThreadPool/Resource.h
Common_Class/CHThreadPool/ThreadPool.cpp
Common_Class/CHThreadPool/TimerThreadPool.cpp
Common_Class/CHThreadPool/WaitThreadPool.cpp
Common_Class/CHThreadPool/WorkThreadArray.cpp
Common_Class/CHThreadPool/WorkThreadPool.cpp
Common_Class/CHThreadPool/dllmain.cpp
Common_Class/CHThreadPool/res/CHThreadPool.rc2
Common_Class/CHThreadPool/stdafx.cpp
Common_Class/CHThreadPool/stdafx.h
Common_Class/CHThreadPool/targetver.h
Common_Class/ConfigFileManager/BasedConfig.cpp
Common_Class/ConfigFileManager/Config.cpp
Common_Class/ConfigFileManager/ConfigFileManager.cpp
Common_Class/ConfigFileManager/ConfigFileManager.def
Common_Class/ConfigFileManager/ConfigFileManager.rc
Common_Class/ConfigFileManager/ConfigFileManager.sln
Common_Class/ConfigFileManager/ConfigFileManager.vcxproj
Common_Class/ConfigFileManager/ConfigFileManager.vcxproj.filters
Common_Class/ConfigFileManager/ConfigFileManagerD.def
Common_Class/ConfigFileManager/FileIOInterface.cpp
Common_Class/ConfigFileManager/FileList.cpp
Common_Class/ConfigFileManager/FileMap.cpp
Common_Class/ConfigFileManager/FileVersionManager.cpp
Common_Class/ConfigFileManager/Header/BasedConfig.h
Common_Class/ConfigFileManager/Header/Config.h
Common_Class/ConfigFileManager/Header/FileIOInterface.h
Common_Class/ConfigFileManager/Header/FileList.h
Common_Class/ConfigFileManager/Header/FileMap.h
Common_Class/ConfigFileManager/Header/FileVersionManager.h
Common_Class/ConfigFileManager/Header/IniManager.h
Common_Class/ConfigFileManager/Header/Registery.h
Common_Class/ConfigFileManager/IniManager.cpp
Common_Class/ConfigFileManager/ReadMe.txt
Common_Class/ConfigFileManager/Registery.cpp
Common_Class/ConfigFileManager/Resource.h
Common_Class/ConfigFileManager/dllmain.cpp
Common_Class/ConfigFileManager/res/ConfigFileManager.rc2
Common_Class/ConfigFileManager/stdafx.cpp
Common_Class/ConfigFileManager/stdafx.h
Common_Class/ConfigFileManager/targetver.h
Common_Class/EdgeInspect/BLOB_Tool.cpp
Common_Class/EdgeInspect/ChamferInspect.cpp
Common_Class/EdgeInspect/CornerCut.cpp
Common_Class/EdgeInspect/Crystal.txt
Common_Class/EdgeInspect/EdgeFind.cpp
Common_Class/EdgeInspect/EdgeInspect.cpp
Common_Class/EdgeInspect/EdgeInspect.def
Common_Class/EdgeInspect/EdgeInspect.rc
Common_Class/EdgeInspect/EdgeInspect.vcproj
Common_Class/EdgeInspect/EdgeInspect.vcxproj
Common_Class/EdgeInspect/EdgeInspect.vcxproj.filters
Common_Class/EdgeInspect/EdgeInspectD.def
Common_Class/EdgeInspect/EdgeProc.cpp
Common_Class/EdgeInspect/Edge_Log.cpp
Common_Class/EdgeInspect/Header/BLOB_Tool.h
Common_Class/EdgeInspect/Header/ChamferInspect.h
Common_Class/EdgeInspect/Header/CornerCut.h
Common_Class/EdgeInspect/Header/EDGE_DIPM.h
Common_Class/EdgeInspect/Header/EdgeFind.h
Common_Class/EdgeInspect/Header/EdgeProc.h
Common_Class/EdgeInspect/Header/Edge_Log.h
Common_Class/EdgeInspect/Header/NotchCut.h
Common_Class/EdgeInspect/Header/ProfileCADProc.h
Common_Class/EdgeInspect/Header/RANSAC_LineFittingAlgorithm.h
Common_Class/EdgeInspect/Header/SISEdgeFind.h
Common_Class/EdgeInspect/Header/SplineInspect.h
Common_Class/EdgeInspect/Library/FreeImage.lib
Common_Class/EdgeInspect/Library/ImageHandlerM.lib
Common_Class/EdgeInspect/MosisProfiles.txt
Common_Class/EdgeInspect/NotchCut.cpp
Common_Class/EdgeInspect/ProfileCADProc.cpp
Common_Class/EdgeInspect/RANSAC_LineFittingAlgorithm.cpp
Common_Class/EdgeInspect/ReadMe.txt
Common_Class/EdgeInspect/Resource.h
Common_Class/EdgeInspect/SISEdgeFind.cpp
Common_Class/EdgeInspect/SplineInspect.cpp
Common_Class/EdgeInspect/dllmain.cpp
Common_Class/EdgeInspect/res/EdgeInspect.rc2
Common_Class/EdgeInspect/stdafx.cpp
Common_Class/EdgeInspect/stdafx.h
Common_Class/EdgeInspect/targetver.h
Common_Class/EuresysCam/Dll/MultiCam.dll
Common_Class/EuresysCam/Include/CCallbacks.h
Common_Class/EuresysCam/Include/ESFilter.h
Common_Class/EuresysCam/Include/MCpp_Board.h
Common_Class/EuresysCam/Include/MCpp_BoardImpl.h
Common_Class/EuresysCam/Include/MCpp_BoardList.h
Common_Class/EuresysCam/Include/MCpp_BoardListImpl.h
Common_Class/EuresysCam/Include/MCpp_Callback.h
Common_Class/EuresysCam/Include/MCpp_CallbackImpl.h
Common_Class/EuresysCam/Include/MCpp_Channel.h
Common_Class/EuresysCam/Include/MCpp_ChannelImpl.h
Common_Class/EuresysCam/Include/MCpp_Configuration.h
Common_Class/EuresysCam/Include/MCpp_ConfigurationImpl.h
Common_Class/EuresysCam/Include/MCpp_Exception.h
Common_Class/EuresysCam/Include/MCpp_ExceptionImpl.h
Common_Class/EuresysCam/Include/MCpp_MultiCamObject.h
Common_Class/EuresysCam/Include/MCpp_MultiCamObjectImpl.h
Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h
Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h
Common_Class/EuresysCam/Include/MCpp_SignalInfo.h
Common_Class/EuresysCam/Include/MCpp_SignalInfoImpl.h
Common_Class/EuresysCam/Include/MCpp_Surface.h
Common_Class/EuresysCam/Include/MCpp_SurfaceImpl.h
Common_Class/EuresysCam/Include/MCpp_global.h
Common_Class/EuresysCam/Include/MCpp_globalImpl.h
Common_Class/EuresysCam/Include/McDef.h
Common_Class/EuresysCam/Include/McIo.h
Common_Class/EuresysCam/Include/McParams.h
Common_Class/EuresysCam/Include/McParamsCompat1x.h
Common_Class/EuresysCam/Include/MultiCamCpp.h
Common_Class/EuresysCam/Include/MultiCamCppExternal.h
Common_Class/EuresysCam/Include/MultiCamCppInternal.h
Common_Class/EuresysCam/Include/MultiCam_DataTypes.h
Common_Class/EuresysCam/Include/containers.h
Common_Class/EuresysCam/Include/multicam.h
Common_Class/EuresysCam/Lib/MultiCam.def
Common_Class/EuresysCam/Lib/MultiCam.lib
Common_Class/EuresysCam/Lib/amd64/MultiCam.def
Common_Class/EuresysCam/Lib/amd64/MultiCam.lib
Common_Class/ExpireDay/ExpireDay.cpp
Common_Class/ExpireDay/ExpireDay.h
Common_Class/ExpireDay/ExpireDay.rc
Common_Class/ExpireDay/ExpireDay.vcxproj
Common_Class/ExpireDay/ExpireDay.vcxproj.filters
Common_Class/ExpireDay/ExpireDayDlg.cpp
Common_Class/ExpireDay/ExpireDayDlg.h
Common_Class/ExpireDay/ReadMe.txt
Common_Class/ExpireDay/res/ExpireDay.ico
Common_Class/ExpireDay/res/ExpireDay.rc2
Common_Class/ExpireDay/resource.h
Common_Class/ExpireDay/stdafx.cpp
Common_Class/ExpireDay/stdafx.h
Common_Class/ExpireDay/targetver.h
Common_Class/LogView/Header/InsertPathDlg.h
Common_Class/LogView/Header/LogView.h
Common_Class/LogView/Header/LogViewDoc.h
Common_Class/LogView/Header/LogViewOption.h
Common_Class/LogView/Header/LogViewView.h
Common_Class/LogView/Header/MainFrm.h
Common_Class/LogView/Header/MemoryManager.h
Common_Class/LogView/Header/PathData.h
Common_Class/LogView/Header/PathSettingDlg.h
Common_Class/LogView/InsertPathDlg.cpp
Common_Class/LogView/LogView.cpp
Common_Class/LogView/LogView.rc
Common_Class/LogView/LogView.vcxproj
Common_Class/LogView/LogView.vcxproj.filters
Common_Class/LogView/LogViewDoc.cpp
Common_Class/LogView/LogViewOption.cpp
Common_Class/LogView/LogViewView.cpp
Common_Class/LogView/MainFrm.cpp
Common_Class/LogView/MemoryManager.cpp
Common_Class/LogView/PathData.cpp
Common_Class/LogView/PathSettingDlg.cpp
Common_Class/LogView/ReadMe.txt
Common_Class/LogView/res/LogView.ico
Common_Class/LogView/res/LogView.rc2
Common_Class/LogView/res/LogViewDoc.ico
Common_Class/LogView/res/LogViewer.ico
Common_Class/LogView/res/Toolbar.bmp
Common_Class/LogView/resource.h
Common_Class/LogView/stdafx.cpp
Common_Class/LogView/stdafx.h
Common_Class/LogView/targetver.h
Common_Class/Matrox/Include/MILDyn/PFNC.h
Common_Class/Matrox/Include/MILDyn/mil3ddisp.h
Common_Class/Matrox/Include/MILDyn/mil3dgeo.h
Common_Class/Matrox/Include/MILDyn/mil3dgra.h
Common_Class/Matrox/Include/MILDyn/milcom.h
Common_Class/Matrox/Include/MILDyn/mildisplay.h
Common_Class/Matrox/Include/MILDyn/milim.h
Common_Class/Matrox/Include/Mil.h
Common_Class/Matrox/Include/MilDSFCapture.h
Common_Class/Matrox/Include/MilDSFCaptureGUID.h
Common_Class/Matrox/Include/MilDSFSequence.h
Common_Class/Matrox/Include/MilDSFSequenceGUID.h
Common_Class/Matrox/Include/MilDyn.h
Common_Class/Matrox/Include/MilFunc.h
Common_Class/Matrox/Include/MilFunctionCode.h
Common_Class/Matrox/Include/Mildec.h
Common_Class/Matrox/Include/Milerr.h
Common_Class/Matrox/Include/Milos.h
Common_Class/Matrox/Include/Milproto.h
Common_Class/Matrox/Include/Milsetup.h
Common_Class/Matrox/Include/mbasictypes.h
Common_Class/Matrox/Include/milfpga.h
Common_Class/Matrox/Include/milfuncll.h
Common_Class/Matrox/Include/milstring.h
Common_Class/Matrox/Include/miluniqueid.h
Common_Class/Matrox/Include/milvector.h
Common_Class/Matrox/Include/milweb.h
Common_Class/Matrox/dll/DigitizerController.dll
Common_Class/Matrox/dll/Liberatus.dll
Common_Class/Matrox/dll/MILIrisGTRFocusDelay.dll
Common_Class/Matrox/dll/MILPerf.dll
Common_Class/Matrox/dll/MILQSVEngine.dll
Common_Class/Matrox/dll/McomController.dll
Common_Class/Matrox/dll/MilAux.dll
Common_Class/Matrox/dll/MilClarityUHD.dll
Common_Class/Matrox/dll/MilClarityUHDUI.dll
Common_Class/Matrox/dll/MilCodec.dll
Common_Class/Matrox/dll/MilConcordPoE.dll
Common_Class/Matrox/dll/MilConcordPoEUI.dll
Common_Class/Matrox/dll/MilDSFCapture.dll
Common_Class/Matrox/dll/MilDSFCommon.dll
Common_Class/Matrox/dll/MilDSFSequence.dll
Common_Class/Matrox/dll/MilDirectX.dll
Common_Class/Matrox/dll/MilDisplay.dll
Common_Class/Matrox/dll/MilGPU.dll
Common_Class/Matrox/dll/MilGPUd3d10.dll
Common_Class/Matrox/dll/MilGPUd3d11.dll
Common_Class/Matrox/dll/MilGPUd3d9.dll
Common_Class/Matrox/dll/MilGenTL.dll
Common_Class/Matrox/dll/MilGenTLUI.dll
Common_Class/Matrox/dll/MilGigEVision.dll
Common_Class/Matrox/dll/MilGrabc.dll
Common_Class/Matrox/dll/MilIrisGTRUI.dll
Common_Class/Matrox/dll/MilMorphis.dll
Common_Class/Matrox/dll/MilMorphisQxt.dll
Common_Class/Matrox/dll/MilNetwork.dll
Common_Class/Matrox/dll/MilNetworkSlave.dll
Common_Class/Matrox/dll/MilOrionHd.dll
Common_Class/Matrox/dll/MilRadient.dll
Common_Class/Matrox/dll/MilRadientCXP.dll
Common_Class/Matrox/dll/MilRadientCXPUI.dll
Common_Class/Matrox/dll/MilRadientPro.dll
Common_Class/Matrox/dll/MilRadientProUI.dll
Common_Class/Matrox/dll/MilRadientUI.dll
Common_Class/Matrox/dll/MilRadientevcl.dll
Common_Class/Matrox/dll/MilRadientevclUI.dll
Common_Class/Matrox/dll/MilRapixoCXP.dll
Common_Class/Matrox/dll/MilRapixoCXPUI.dll
Common_Class/Matrox/dll/MilSoliosUI.dll
Common_Class/Matrox/dll/MilgigevisionUI.dll
Common_Class/Matrox/dll/Milim.dll
Common_Class/Matrox/dll/Milnetworkinfo.dll
Common_Class/Matrox/dll/Milsolios.dll
Common_Class/Matrox/dll/Milusb3visionUI.dll
Common_Class/Matrox/dll/RadientPfpga.dll
Common_Class/Matrox/dll/SoliosPFpga.dll
Common_Class/Matrox/dll/libmfxsw64.dll
Common_Class/Matrox/dll/mil.dll
Common_Class/Matrox/dll/mil3d.dll
Common_Class/Matrox/dll/milcacheinfo.dll
Common_Class/Matrox/dll/milcom.dll
Common_Class/Matrox/dll/mildig.dll
Common_Class/Matrox/dll/milfpga.dll
Common_Class/Matrox/dll/milhttpserver.dll
Common_Class/Matrox/dll/milirisgtr.dll
Common_Class/Matrox/dll/milmp.dll
Common_Class/Matrox/dll/milnetworkserver.dll
Common_Class/Matrox/dll/milpcie.dll
Common_Class/Matrox/dll/milshm.dll
Common_Class/Matrox/dll/milusb3vision.dll
Common_Class/Matrox/dll/milwebclient.dll
Common_Class/Matrox/dll/milwebserver.dll
Common_Class/Matrox/lib/Mil3d.lib
Common_Class/Matrox/lib/Milim.lib
Common_Class/Matrox/lib/mil.lib
Common_Class/Matrox/lib/milcom.lib
Common_Class/Matrox/lib/milfpga.lib
Common_Class/Matrox/lib/milwebclient.lib
Common_Class/MegaLock/lib/l_mega64.lib
Common_Class/MegaLock/lib/l_mega64__.lib
Common_Class/OpenCV/opencv_3.1/include/opencv/cv.h
Common_Class/OpenCV/opencv_3.1/include/opencv/cv.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.h
Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv/cvwimage.h
Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.h
Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv/cxmisc.h
Common_Class/OpenCV/opencv_3.1/include/opencv/highgui.h
Common_Class/OpenCV/opencv_3.1/include/opencv/ml.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/core.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/base.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/version.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/cvconfig.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/any.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/config.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/defines.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dist.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/general.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/heap.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/logger.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/params.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/random.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/saving.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/timer.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/ml.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/photo.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/shape.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/superres.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/video.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/video/video.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp
Common_Class/OpenCV/opencv_3.1/include/opencv2/world.hpp
Common_Class/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_calib3d310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_core310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_features2d310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_features2d310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_flann310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_flann310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_ml310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_ml310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_objdetect310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_photo310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_photo310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_shape310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_shape310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_stitching310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_stitching310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_superres310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_superres310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_ts310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_ts310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_video310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_video310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_videoio310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_videoio310d.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_videostab310.lib
Common_Class/OpenCV/opencv_3.1/lib/opencv_videostab310d.lib
Common_Class/PLCConnector/MainFrm.cpp
Common_Class/PLCConnector/MainFrm.h
Common_Class/PLCConnector/PLCConnector.cpp
Common_Class/PLCConnector/PLCConnector.h
Common_Class/PLCConnector/PLCConnector.ini
Common_Class/PLCConnector/PLCConnector.rc
Common_Class/PLCConnector/PLCConnector.vcxproj
Common_Class/PLCConnector/PLCConnector.vcxproj.filters
Common_Class/PLCConnector/PLCConnectorDoc.cpp
Common_Class/PLCConnector/PLCConnectorDoc.h
Common_Class/PLCConnector/PLCConnectorView.cpp
Common_Class/PLCConnector/PLCConnectorView.h
Common_Class/PLCConnector/ReadMe.txt
Common_Class/PLCConnector/SetOptionDlg.cpp
Common_Class/PLCConnector/SetOptionDlg.h
Common_Class/PLCConnector/UserImages.bmp
Common_Class/PLCConnector/acteasyif1.cpp
Common_Class/PLCConnector/acteasyif1.h
Common_Class/PLCConnector/res/PLCConnector.ico
Common_Class/PLCConnector/res/PLCConnector.rc2
Common_Class/PLCConnector/res/PLCConnectorDoc.ico
Common_Class/PLCConnector/res/Toolbar.bmp
Common_Class/PLCConnector/res/Toolbar256.bmp
Common_Class/PLCConnector/resource.h
Common_Class/PLCConnector/stdafx.cpp
Common_Class/PLCConnector/stdafx.h
Common_Class/PLCConnector/targetver.h
Common_Class/SISAssem/.gitignore
Common_Class/SISAssem/20101008_ConvFloat.asm
Common_Class/SISAssem/20101008_ConvPixel.asm
Common_Class/SISAssem/20101008_ConvZone.asm
Common_Class/SISAssem/ASGInspection.cpp
Common_Class/SISAssem/AssemDefect.cpp
Common_Class/SISAssem/AssemParam.cpp
Common_Class/SISAssem/AssemPitch.asm
Common_Class/SISAssem/AssemPitch_BOE.asm
Common_Class/SISAssem/AssemUtil.cpp
Common_Class/SISAssem/AssemUtil2.asm
Common_Class/SISAssem/AssemUtil2E.asm
Common_Class/SISAssem/AssemUtil2_1by1.asm
Common_Class/SISAssem/BinalizeInspection.cpp
Common_Class/SISAssem/BlobStorage.cpp
Common_Class/SISAssem/ConvFloat.asm
Common_Class/SISAssem/ConvFloat2.asm
Common_Class/SISAssem/ConvFloat6.asm
Common_Class/SISAssem/ConvFloat9.asm
Common_Class/SISAssem/ConvFloatDPC.asm
Common_Class/SISAssem/ConvFloatDPC6.asm
Common_Class/SISAssem/ConvFloatDPC_BOE.asm
Common_Class/SISAssem/ConvFloatVTD.asm
Common_Class/SISAssem/ConvFloatVTD_BOE.asm
Common_Class/SISAssem/ConvFloatVTD_DPCAIAu.asm
Common_Class/SISAssem/ConvFloatVert.asm
Common_Class/SISAssem/ConvFloatVert6.asm
Common_Class/SISAssem/ConvFloatVert9.asm
Common_Class/SISAssem/ConvFloatVert_BOE.asm
Common_Class/SISAssem/ConvFloat_BOE.asm
Common_Class/SISAssem/ConvPixel.asm
Common_Class/SISAssem/ConvPixel222.asm
Common_Class/SISAssem/ConvPixelD.asm
Common_Class/SISAssem/ConvPixelEE.asm
Common_Class/SISAssem/ConvPixelVTDS.asm
Common_Class/SISAssem/ConvPixelVTDSBW.asm
Common_Class/SISAssem/ConvPixelVTDSBW_BOE.asm
Common_Class/SISAssem/ConvPixelVert.asm
Common_Class/SISAssem/ConvPixelVertMS.asm
Common_Class/SISAssem/ConvPixelVertS.asm
Common_Class/SISAssem/ConvPixelVertSBW.asm
Common_Class/SISAssem/ConvPixelVertSBW_BOE.asm
Common_Class/SISAssem/ConvTrap.asm
Common_Class/SISAssem/ConvTrapFD.asm
Common_Class/SISAssem/ConvTrapVert.asm
Common_Class/SISAssem/ConvVert2-DoubleCmp.asm
Common_Class/SISAssem/ConvZgSpVtSkB1.asm
Common_Class/SISAssem/ConvZgSpVtSkB2.asm
Common_Class/SISAssem/ConvZone.asm
Common_Class/SISAssem/ConvZone2.asm
Common_Class/SISAssem/ConvZoneDPC.asm
Common_Class/SISAssem/ConvZoneDPC2.asm
Common_Class/SISAssem/ConvZoneMVert2S.asm
Common_Class/SISAssem/ConvZoneVTD.asm
Common_Class/SISAssem/ConvZoneVTDMS.asm
Common_Class/SISAssem/ConvZoneVTDS.asm
Common_Class/SISAssem/ConvZoneVTD_BOE.asm
Common_Class/SISAssem/ConvZoneVTD_ExThAIAu.asm
Common_Class/SISAssem/ConvZoneVert.asm
Common_Class/SISAssem/ConvZoneVert2.asm
Common_Class/SISAssem/ConvZoneVert2S.asm
Common_Class/SISAssem/ConvZoneVert2S2b2.asm
Common_Class/SISAssem/ConvZoneVert2S_BOE.asm
Common_Class/SISAssem/ConvZoneVertMS.asm
Common_Class/SISAssem/Header/ASGInspection.h
Common_Class/SISAssem/Header/AssemDefect.h
Common_Class/SISAssem/Header/AssemParam.h
Common_Class/SISAssem/Header/AssemUtil.h
Common_Class/SISAssem/Header/BlobStorage.h
Common_Class/SISAssem/Header/Pad.h
Common_Class/SISAssem/Header/PairStorage.h
Common_Class/SISAssem/Header/PixelStorage.h
Common_Class/SISAssem/Header/SISAssem.h
Common_Class/SISAssem/Header/SISStrg.h
Common_Class/SISAssem/MathImpl.asm
Common_Class/SISAssem/Pad.cpp
Common_Class/SISAssem/PairStorage.cpp
Common_Class/SISAssem/PixelStorage.cpp
Common_Class/SISAssem/ReadMe.txt
Common_Class/SISAssem/Resource.h
Common_Class/SISAssem/SISAssem.cpp
Common_Class/SISAssem/SISAssem.def
Common_Class/SISAssem/SISAssem.rc
Common_Class/SISAssem/SISAssem.sln
Common_Class/SISAssem/SISAssem.vcproj
Common_Class/SISAssem/SISAssem.vcxproj
Common_Class/SISAssem/SISAssem.vcxproj.filters
Common_Class/SISAssem/SISAssemD.def
Common_Class/SISAssem/SISAssem_Unuse.cpp
Common_Class/SISAssem/SISFloatIntrin.cpp
Common_Class/SISAssem/SISPixelIntrin.cpp
Common_Class/SISAssem/SISZoneIntrin.cpp
Common_Class/SISAssem/StopWatch3.cpp
Common_Class/SISAssem/StopWatch3.h
Common_Class/SISAssem/dllmain.cpp
Common_Class/SISAssem/res/SISAssem.rc2
Common_Class/SISAssem/stdafx.cpp
Common_Class/SISAssem/stdafx.h
Common_Class/SISAssem/targetver.h
Common_Class/SISBuffer/ConvInt1.cpp
Common_Class/SISBuffer/CopyBuffer.cpp
Common_Class/SISBuffer/CrossCorr.cpp
Common_Class/SISBuffer/FileBuffer.cpp
Common_Class/SISBuffer/FrameSave.cpp
Common_Class/SISBuffer/Header/Broadcast.h
Common_Class/SISBuffer/Header/InspectionBuffer.h
Common_Class/SISBuffer/Header/NoiseLevel.h
Common_Class/SISBuffer/Header/SISBuffer.h
Common_Class/SISBuffer/Header/SISMatch.h
Common_Class/SISBuffer/Header/SISMath.h
Common_Class/SISBuffer/Header/SISPitch.h
Common_Class/SISBuffer/InspectionBuffer.cpp
Common_Class/SISBuffer/LeastSquare.cpp
Common_Class/SISBuffer/LeastSquare.h
Common_Class/SISBuffer/MatchBuffer.cpp
Common_Class/SISBuffer/MatchBuffer.h
Common_Class/SISBuffer/MatchImpl.cpp
Common_Class/SISBuffer/MatchImpl.h
Common_Class/SISBuffer/MatchImpl_unuse.cpp
Common_Class/SISBuffer/NoiseLevel.cpp
Common_Class/SISBuffer/ReadMe.txt
Common_Class/SISBuffer/Resource.h
Common_Class/SISBuffer/SISBuffer.cpp
Common_Class/SISBuffer/SISBuffer.def
Common_Class/SISBuffer/SISBuffer.rc
Common_Class/SISBuffer/SISBuffer.sln
Common_Class/SISBuffer/SISBuffer.vcproj
Common_Class/SISBuffer/SISBuffer.vcxproj
Common_Class/SISBuffer/SISBuffer.vcxproj.filters
Common_Class/SISBuffer/SISBufferD.def
Common_Class/SISBuffer/SISBufferDll.cpp
Common_Class/SISBuffer/SISMatch.cpp
Common_Class/SISBuffer/SISMath.cpp
Common_Class/SISBuffer/SISMath_omp.cpp
Common_Class/SISBuffer/SISMath_unuse.cpp
Common_Class/SISBuffer/SISPitch.cpp
Common_Class/SISBuffer/StdAfx.cpp
Common_Class/SISBuffer/StdAfx.h
Common_Class/SISBuffer/res/SISBuffer.rc2
Common_Class/SISControls/CellCtrl.cpp
Common_Class/SISControls/ColorButton.cpp
Common_Class/SISControls/DefectMap.cpp
Common_Class/SISControls/FontStatic.cpp
Common_Class/SISControls/GradientStatic.cpp
Common_Class/SISControls/GridControl/CellRange.h
Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.cpp
Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.h
Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.cpp
Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.h
Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.cpp
Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.h
Common_Class/SISControls/GridControl/GridCell.cpp
Common_Class/SISControls/GridControl/GridCell.h
Common_Class/SISControls/GridControl/GridCellBase.cpp
Common_Class/SISControls/GridControl/GridCellBase.h
Common_Class/SISControls/GridControl/GridCellButton.cpp
Common_Class/SISControls/GridControl/GridCellButton.h
Common_Class/SISControls/GridControl/GridCtrl.cpp
Common_Class/SISControls/GridControl/GridCtrl.h
Common_Class/SISControls/GridControl/GridDropTarget.cpp
Common_Class/SISControls/GridControl/GridDropTarget.h
Common_Class/SISControls/GridControl/GridInPlaceEdit.cpp
Common_Class/SISControls/GridControl/GridInPlaceEdit.h
Common_Class/SISControls/GridControl/GridMemDC.h
Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.cpp
Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.h
Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.cpp
Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.h
Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.cpp
Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.cpp
Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.cpp
Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.h
Common_Class/SISControls/GridControl/TitleTip.cpp
Common_Class/SISControls/GridControl/TitleTip.h
Common_Class/SISControls/HeadCtrl.cpp
Common_Class/SISControls/Header/CellCtrl.h
Common_Class/SISControls/Header/ColorButton.h
Common_Class/SISControls/Header/DefectMap.h
Common_Class/SISControls/Header/FontStatic.h
Common_Class/SISControls/Header/GradientStatic.h
Common_Class/SISControls/Header/HeadCtrl.h
Common_Class/SISControls/Header/InPlaceComboBox.h
Common_Class/SISControls/Header/InPlaceEdit.h
Common_Class/SISControls/Header/LogCtrl.h
Common_Class/SISControls/Header/SISButton.h
Common_Class/SISControls/Header/SISFolderScheduling.h
Common_Class/SISControls/Header/SISJogBtn2Parent.h
Common_Class/SISControls/Header/SISJogButton.h
Common_Class/SISControls/Header/SISLabel.h
Common_Class/SISControls/Header/SISListBoxLog.h
Common_Class/SISControls/Header/SISListCtrlExt.h
Common_Class/SISControls/Header/SortClass.h
Common_Class/SISControls/Header/StaticMap.h
Common_Class/SISControls/Header/WKButton.h
Common_Class/SISControls/Header/XTabCtrl.h
Common_Class/SISControls/InPlaceComboBox.cpp
Common_Class/SISControls/InPlaceEdit.cpp
Common_Class/SISControls/LogCtrl.cpp
Common_Class/SISControls/PropertyGridControl/CustomItem.h
Common_Class/SISControls/PropertyGridControl/DynDialogEx.cpp
Common_Class/SISControls/PropertyGridControl/DynDialogEx.h
Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.cpp
Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.h
Common_Class/SISControls/PropertyGridControl/PropertyGrid.cpp
Common_Class/SISControls/PropertyGridControl/PropertyGrid.h
Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.cpp
Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.h
Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.cpp
Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.h
Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.cpp
Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.h
Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.cpp
Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.h
Common_Class/SISControls/Resource.h
Common_Class/SISControls/SISButton.cpp
Common_Class/SISControls/SISControls.cpp
Common_Class/SISControls/SISControls.def
Common_Class/SISControls/SISControls.dsp
Common_Class/SISControls/SISControls.dsw
Common_Class/SISControls/SISControls.rc
Common_Class/SISControls/SISControls.sln
Common_Class/SISControls/SISControls.vcxproj
Common_Class/SISControls/SISControls.vcxproj.filters
Common_Class/SISControls/SISControlsD.def
Common_Class/SISControls/SISFolderScheduling.cpp
Common_Class/SISControls/SISJogButton.cpp
Common_Class/SISControls/SISLabel.cpp
Common_Class/SISControls/SISListBoxLog.cpp
Common_Class/SISControls/SISListCtrlExt.cpp
Common_Class/SISControls/SortClass.cpp
Common_Class/SISControls/StaticMap.cpp
Common_Class/SISControls/StdAfx.cpp
Common_Class/SISControls/StdAfx.h
Common_Class/SISControls/WKButton.cpp
Common_Class/SISControls/XTabCtrl.cpp
Common_Class/SISControls/desktop.ini
Common_Class/SISControls/res/SISControls.rc2
Common_Class/SharedMapDll/Header/LogManager.h
Common_Class/SharedMapDll/LogManager.cpp
Common_Class/SharedMapDll/Resource.h
Common_Class/SharedMapDll/SharedMapDll.cpp
Common_Class/SharedMapDll/SharedMapDll.def
Common_Class/SharedMapDll/SharedMapDll.rc
Common_Class/SharedMapDll/SharedMapDll.sln
Common_Class/SharedMapDll/SharedMapDll.vcproj
Common_Class/SharedMapDll/SharedMapDll.vcxproj
Common_Class/SharedMapDll/SharedMapDll.vcxproj.filters
Common_Class/SharedMapDll/SharedMapDllD.def
Common_Class/SharedMapDll/dllmain.cpp
Common_Class/SharedMapDll/res/SharedMapDll.rc2
Common_Class/SharedMapDll/stdafx.cpp
Common_Class/SharedMapDll/stdafx.h
Common_Class/SharedMapDll/targetver.h
Common_Class/VisionLib/ApiVisionSDK/include/ClsVision.h
Common_Class/VisionLib/ApiVisionSDK/include/IClsDisplay.h
Common_Class/VisionLib/ApiVisionSDK/include/VisionLib.h
Common_Class/VisionLib/BaseDisplaySDK/include/BaseDisplayLib.h
Common_Class/VisionLib/BaseDisplaySDK/include/BaseVision.h
Common_Class/VisionLib/BaseDisplaySDK/include/IClsShape.h
Common_Class/VisionLib/BaseDisplaySDK/include/IImageDisplay.h
Common_Class/VisionLib/BaseDisplaySDK/include/typesdef.h
Common_Class/VisionLib/BlGrabber/include/FrameBufferController.h
Common_Class/VisionLib/BlGrabber/include/GrabberControl.h
Common_Class/VisionLib/LogSDK/include/IDayLog.h
Common_Class/VisionLib/LogSDK/include/ILogger.h
Common_Class/VisionLib/LogSDK/include/LogLib.h
Common_Class/VisionLib/SISControls/GridControl/CellRange.h
Common_Class/VisionLib/SISControls/GridControl/GridCell.h
Common_Class/VisionLib/SISControls/GridControl/GridCellBase.h
Common_Class/VisionLib/SISControls/GridControl/GridCellButton.h
Common_Class/VisionLib/SISControls/GridControl/GridCtrl.h
Common_Class/VisionLib/SISControls/GridControl/GridDropTarget.h
Common_Class/VisionLib/SISControls/GridControl/GridInPlaceEdit.h
Common_Class/VisionLib/SISControls/GridControl/GridMemDC.h
Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCheck.h
Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCombo.h
Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridURLCell.h
Common_Class/VisionLib/SISControls/GridControl/TitleTip.h
Common_Class/VisionLib/SISControls/include/CellCtrl.h
Common_Class/VisionLib/SISControls/include/ColorButton.h
Common_Class/VisionLib/SISControls/include/DefectMap.h
Common_Class/VisionLib/SISControls/include/FontStatic.h
Common_Class/VisionLib/SISControls/include/GradientStatic.h
Common_Class/VisionLib/SISControls/include/HeadCtrl.h
Common_Class/VisionLib/SISControls/include/InPlaceComboBox.h
Common_Class/VisionLib/SISControls/include/InPlaceEdit.h
Common_Class/VisionLib/SISControls/include/LogCtrl.h
Common_Class/VisionLib/SISControls/include/SISButton.h
Common_Class/VisionLib/SISControls/include/SISFolderScheduling.h
Common_Class/VisionLib/SISControls/include/SISJogBtn2Parent.h
Common_Class/VisionLib/SISControls/include/SISJogButton.h
Common_Class/VisionLib/SISControls/include/SISLabel.h
Common_Class/VisionLib/SISControls/include/SISListBoxLog.h
Common_Class/VisionLib/SISControls/include/SISListCtrlExt.h
Common_Class/VisionLib/SISControls/include/SortClass.h
Common_Class/VisionLib/SISControls/include/StaticMap.h
Common_Class/VisionLib/SISControls/include/WKButton.h
Common_Class/VisionLib/SISControls/include/XTabCtrl.h
EdgeInspector_App.sln
EdgeInspector_App/BICommon.h
EdgeInspector_App/CHDataFitting.cpp
EdgeInspector_App/CHDataFitting.h
EdgeInspector_App/Data/DefectStorage.cpp
EdgeInspector_App/Data/DefectStorage.h
EdgeInspector_App/Data/Glass_Data.cpp
EdgeInspector_App/Data/Glass_Data.h
EdgeInspector_App/Data/History.h
EdgeInspector_App/Data/PostProcess.cpp
EdgeInspector_App/Data/PostProcess.h
EdgeInspector_App/Data/StopWatch.cpp
EdgeInspector_App/Data/StopWatch.h
EdgeInspector_App/Data/TransDataManager.cpp
EdgeInspector_App/Data/TransDataManager.h
EdgeInspector_App/Data/Transfer_Data.cpp
EdgeInspector_App/Data/Transfer_Data.h
EdgeInspector_App/Defect.h
EdgeInspector_App/Define/Global_Define.h
EdgeInspector_App/Define/InspectionBase.cpp
EdgeInspector_App/Define/InspectionBase.h
EdgeInspector_App/Define/StatusMonitor.cpp
EdgeInspector_App/Define/StatusMonitor.h
EdgeInspector_App/DlgLicenseInfo.cpp
EdgeInspector_App/DlgLicenseInfo.h
EdgeInspector_App/DlgSideDimensionSetting.cpp
EdgeInspector_App/DlgSideDimensionSetting.h
EdgeInspector_App/DlgSideExceptoinSetting.cpp
EdgeInspector_App/DlgSideExceptoinSetting.h
EdgeInspector_App/DlgSideNotchSetting.cpp
EdgeInspector_App/DlgSideNotchSetting.h
EdgeInspector_App/DlgSideUserDefectSetting.cpp
EdgeInspector_App/DlgSideUserDefectSetting.h
EdgeInspector_App/EdgeInspector_App.cpp
EdgeInspector_App/EdgeInspector_App.h
EdgeInspector_App/EdgeInspector_App.rc
EdgeInspector_App/EdgeInspector_App.vcxproj
EdgeInspector_App/EdgeInspector_App.vcxproj.filters
EdgeInspector_App/EdgeInspector_AppDoc.cpp
EdgeInspector_App/EdgeInspector_AppDoc.h
EdgeInspector_App/EdgeInspector_AppView.cpp
EdgeInspector_App/EdgeInspector_AppView.h
EdgeInspector_App/Fitting/CHDataFitting.cpp
EdgeInspector_App/Fitting/CHDataFitting.h
EdgeInspector_App/Grabber/MulticamControl.cpp
EdgeInspector_App/Grabber/MulticamControl.h
EdgeInspector_App/Grabber/RadientControl.cpp
EdgeInspector_App/Grabber/RadientControl.h
EdgeInspector_App/Grabber/SapControl.cpp
EdgeInspector_App/Grabber/SapControl.h
EdgeInspector_App/Grabber/SapLineGrab.cpp
EdgeInspector_App/Grabber/SapLineGrab.h
EdgeInspector_App/Grabber/SoliosControl.cpp
EdgeInspector_App/Grabber/SoliosControl.h
EdgeInspector_App/InterfaceManager.cpp
EdgeInspector_App/InterfaceManager.h
EdgeInspector_App/LanguageControl.cpp
EdgeInspector_App/LanguageControl.h
EdgeInspector_App/License/Worker_UpdateLicense.cpp
EdgeInspector_App/License/Worker_UpdateLicense.h
EdgeInspector_App/LicenseChecker.cpp
EdgeInspector_App/LicenseChecker.h
EdgeInspector_App/Light/ExternLightControl.cpp
EdgeInspector_App/Light/ExternLightControl.h
EdgeInspector_App/Light/ExternLightControlAKPNV.cpp
EdgeInspector_App/Light/ExternLightControlAKPNV.h
EdgeInspector_App/Light/ExternLightControlLCP.cpp
EdgeInspector_App/Light/ExternLightControlLCP.h
EdgeInspector_App/Light/LightManager.cpp
EdgeInspector_App/Light/LightManager.h
EdgeInspector_App/MainFrm.cpp
EdgeInspector_App/MainFrm.h
EdgeInspector_App/MilControl_Common.h
EdgeInspector_App/PLC/Control_Interface.cpp
EdgeInspector_App/PLC/Control_Interface.h
EdgeInspector_App/PLC/Control_Interface_New.cpp
EdgeInspector_App/PLC/Control_Interface_New.h
EdgeInspector_App/Process/EI/InspectCamera.cpp
EdgeInspector_App/Process/EI/InspectCamera.h
EdgeInspector_App/Process/InspectCamera.cpp
EdgeInspector_App/Process/InspectCamera.h
EdgeInspector_App/Process/ThreadControl.cpp
EdgeInspector_App/Process/ThreadControl.h
EdgeInspector_App/Process/mini/InspectCamera.cpp
EdgeInspector_App/Process/mini/InspectCamera.h
EdgeInspector_App/ReadMe.txt
EdgeInspector_App/Recipe/GlassRecipe.cpp
EdgeInspector_App/Recipe/GlassRecipe.h
EdgeInspector_App/Recipe/HardwareSettings.cpp
EdgeInspector_App/Recipe/HardwareSettings.h
EdgeInspector_App/Side_Data.cpp
EdgeInspector_App/Side_Data.h
EdgeInspector_App/Thread/PriorityThread.cpp
EdgeInspector_App/Thread/PriorityThread.h
EdgeInspector_App/Thread/Thread_CheckSeq.cpp
EdgeInspector_App/Thread/Thread_CheckSeq.h
EdgeInspector_App/Thread/Thread_ControlIF.cpp
EdgeInspector_App/Thread/Thread_ControlIF.h
EdgeInspector_App/Thread/Thread_Send.cpp
EdgeInspector_App/Thread/Thread_Send.h
EdgeInspector_App/Thread/Thread_ViewRefresh.cpp
EdgeInspector_App/Thread/Thread_ViewRefresh.h
EdgeInspector_App/TriggerBoard/TriggerControl_Mvsol.cpp
EdgeInspector_App/TriggerBoard/TriggerControl_Mvsol.h
EdgeInspector_App/UITool/DisplayMessage.cpp
EdgeInspector_App/UITool/DisplayMessage.h
EdgeInspector_App/UITool/General_Draw.cpp
EdgeInspector_App/UITool/General_Draw.h
EdgeInspector_App/UITool/MImageStatic.cpp
EdgeInspector_App/UITool/MImageStatic.h
EdgeInspector_App/UITool/PixelPtr.h
EdgeInspector_App/UITool/Server_MemDC.h
EdgeInspector_App/UITool/Singleton.h
EdgeInspector_App/UITool/Splash.cpp
EdgeInspector_App/UITool/Splash.h
EdgeInspector_App/UITool/btnenh.cpp
EdgeInspector_App/UITool/btnenh.h
EdgeInspector_App/UITool/cellsmanager.cpp
EdgeInspector_App/UITool/cellsmanager.h
EdgeInspector_App/UITool/font.cpp
EdgeInspector_App/UITool/font.h
EdgeInspector_App/UITool/surfacecolor.cpp
EdgeInspector_App/UITool/surfacecolor.h
EdgeInspector_App/UITool/textdescriptor.cpp
EdgeInspector_App/UITool/textdescriptor.h
EdgeInspector_App/UITool/texture.cpp
EdgeInspector_App/UITool/texture.h
EdgeInspector_App/UserImages.bmp
EdgeInspector_App/View/DlgLogin.cpp
EdgeInspector_App/View/DlgLogin.h
EdgeInspector_App/View/EdgeImageViewer.cpp
EdgeInspector_App/View/EdgeImageViewer.h
EdgeInspector_App/View/FrameImg.cpp
EdgeInspector_App/View/FrameImg.h
EdgeInspector_App/View/GlassMap.cpp
EdgeInspector_App/View/GlassMap.h
EdgeInspector_App/View/ImgDefect.cpp
EdgeInspector_App/View/ImgDefect.h
EdgeInspector_App/View/ImgListView.cpp
EdgeInspector_App/View/ImgListView.h
EdgeInspector_App/View/ViewLampControl.cpp
EdgeInspector_App/View/ViewLampControl.h
EdgeInspector_App/View/ViewMain_Defect.cpp
EdgeInspector_App/View/ViewMain_Defect.h
EdgeInspector_App/View/ViewMain_HWSetting.cpp
EdgeInspector_App/View/ViewMain_HWSetting.h
EdgeInspector_App/View/ViewMain_LiveCam.cpp
EdgeInspector_App/View/ViewMain_LiveCam.h
EdgeInspector_App/View/ViewMain_ScanImage.cpp
EdgeInspector_App/View/ViewMain_ScanImage.h
EdgeInspector_App/View/ViewMain_Status.cpp
EdgeInspector_App/View/ViewMain_Status.h
EdgeInspector_App/View/ViewPPIDNew.cpp
EdgeInspector_App/View/ViewPPIDNew.h
EdgeInspector_App/View/ViewRecipeList.cpp
EdgeInspector_App/View/ViewRecipeList.h
EdgeInspector_App/View/ViewRecipeNew.cpp
EdgeInspector_App/View/ViewRecipeNew.h
EdgeInspector_App/View/ViewSettingNotch.cpp
EdgeInspector_App/View/ViewSettingNotch.h
EdgeInspector_App/ViewMain_Information.cpp
EdgeInspector_App/ViewMain_Information.h
EdgeInspector_App/ViewMain_Recipe.cpp
EdgeInspector_App/ViewMain_Recipe.h
EdgeInspector_App/WebSocket/ThreadPool.cpp
EdgeInspector_App/WebSocket/ThreadPool.h
EdgeInspector_App/WebSocket/WebSocketClient.cpp
EdgeInspector_App/WebSocket/WebSocketClient.h
EdgeInspector_App/WebSocket/WebSocketClientPool.cpp
EdgeInspector_App/WebSocket/WebSocketClientPool.h
EdgeInspector_App/res/BmpWarning.bmp
EdgeInspector_App/res/Defect Image.bmp
EdgeInspector_App/res/ENRIT.ico
EdgeInspector_App/res/ENRIT.rc2
EdgeInspector_App/res/ENRITDoc.ico
EdgeInspector_App/res/EdgeInspector_App.ico
EdgeInspector_App/res/EdgeInspector_App.rc2
EdgeInspector_App/res/EdgeInspector_AppDoc.ico
EdgeInspector_App/res/EdgeInspector_Led.ico
EdgeInspector_App/res/ICON/CANCEL.ICO
EdgeInspector_App/res/ICON/China.jpg
EdgeInspector_App/res/ICON/LedOff.ico
EdgeInspector_App/res/ICON/LedOn.ico
EdgeInspector_App/res/ICON/MYSL.ICO
EdgeInspector_App/res/ICON/OK.ICO
EdgeInspector_App/res/ICON/SETUP1.ICO
EdgeInspector_App/res/ICON/add2.ico
EdgeInspector_App/res/ICON/arrow_down_blue.ico
EdgeInspector_App/res/ICON/arrow_left_blue.ico
EdgeInspector_App/res/ICON/arrow_right_blue.ico
EdgeInspector_App/res/ICON/arrow_up_blue.ico
EdgeInspector_App/res/ICON/check.ico
EdgeInspector_App/res/ICON/check1.ico
EdgeInspector_App/res/ICON/check7.ico
EdgeInspector_App/res/ICON/copy.ico
EdgeInspector_App/res/ICON/delete2.ico
EdgeInspector_App/res/ICON/edit.ico
EdgeInspector_App/res/ICON/gear_preferences.ico
EdgeInspector_App/res/ICON/gear_run.ico
EdgeInspector_App/res/ICON/gear_stop.ico
EdgeInspector_App/res/ICON/ico00003.ico
EdgeInspector_App/res/ICON/ico00004.ico
EdgeInspector_App/res/ICON/icon3.ico
EdgeInspector_App/res/ICON/icon4.ico
EdgeInspector_App/res/ICON/icon5.ico
EdgeInspector_App/res/ICON/idisk.ico
EdgeInspector_App/res/ICON/load1.ico
EdgeInspector_App/res/ICON/navigate_down.ico
EdgeInspector_App/res/ICON/navigate_left.ico
EdgeInspector_App/res/ICON/navigate_right.ico
EdgeInspector_App/res/ICON/navigate_up.ico
EdgeInspector_App/res/ICON/replace248.ico
EdgeInspector_App/res/ICON/save1.ico
EdgeInspector_App/res/ICON/save_as.ico
EdgeInspector_App/res/ICON/view.ico
EdgeInspector_App/res/ICON/view_next.ico
EdgeInspector_App/res/ICON/view_previous.ico
EdgeInspector_App/res/ICON/warning.ico
EdgeInspector_App/res/Load1_Nor.bmp
EdgeInspector_App/res/Load1_Push.bmp
EdgeInspector_App/res/MenuBar.bmp
EdgeInspector_App/res/RecipeList_LinkArrow.bmp
EdgeInspector_App/res/Right_Arrow.bmp
EdgeInspector_App/res/SIS_Splash.bmp
EdgeInspector_App/res/Save1_Nor.bmp
EdgeInspector_App/res/Save1_Push.bmp
EdgeInspector_App/res/Toolbar.bmp
EdgeInspector_App/res/Toolbar256.bmp
EdgeInspector_App/res/bitmap1.bmp
EdgeInspector_App/res/bitmap_r.bmp
EdgeInspector_App/res/bmp00001.bmp
EdgeInspector_App/res/bmp00002.bmp
EdgeInspector_App/res/bmp00003.bmp
EdgeInspector_App/res/bmpInfo.bmp
EdgeInspector_App/res/btn_load.bmp
EdgeInspector_App/res/buttons.bmp
EdgeInspector_App/res/check.bmp
EdgeInspector_App/res/check32.bmp
EdgeInspector_App/res/checkno.bmp
EdgeInspector_App/res/checkno32.bmp
EdgeInspector_App/res/filelarge.bmp
EdgeInspector_App/res/filesmall.bmp
EdgeInspector_App/res/image.bmp
EdgeInspector_App/res/led_on.bmp
EdgeInspector_App/res/listCell.bmp
EdgeInspector_App/res/main.bmp
EdgeInspector_App/res/play.bmp
EdgeInspector_App/res/play_hot.bmp
EdgeInspector_App/res/propicons.bmp
EdgeInspector_App/res/radio_of.bmp
EdgeInspector_App/res/radio_of32.bmp
EdgeInspector_App/res/radio_on.bmp
EdgeInspector_App/res/radio_on32.bmp
EdgeInspector_App/res/stop.bmp
EdgeInspector_App/res/stop_hot.bmp
EdgeInspector_App/res/writelarge.bmp
EdgeInspector_App/res/writesmall.bmp
EdgeInspector_App/res/旃措霛_ico
EdgeInspector_App/res/카메라.ico
EdgeInspector_App/resource.h
EdgeInspector_App/stdafx.cpp
EdgeInspector_App/stdafx.h
EdgeInspector_App/targetver.h
Global_Include/ExpireDayDefine.h
Global_Include/FreeImage.h
Global_Include/SharedMemoryDefine.h
ProjectClean.exe
SDK/AIClient/include/AiDetectEx.h
SDK/AIClient/lib/AIClient.lib
SDK/AIClient/lib/cmake/AIClient/AIClientConfig.cmake
SDK/AIClient/lib/cmake/AIClient/AIClientConfigVersion.cmake
SDK/AIClient/lib/cmake/AIClient/AIClientTargets-release.cmake
SDK/AIClient/lib/cmake/AIClient/AIClientTargets.cmake
SDK/ApiVisionSDK/include/ClsVision.h
SDK/ApiVisionSDK/include/IClsDisplay.h
SDK/ApiVisionSDK/include/VisionLib.h
SDK/BaseDisplaySDK/include/BaseDisplayLib.h
SDK/BaseDisplaySDK/include/BaseVision.h
SDK/BaseDisplaySDK/include/IClsShape.h
SDK/BaseDisplaySDK/include/IImageDisplay.h
SDK/BaseDisplaySDK/include/typesdef.h
SDK/BlGrabber/include/FrameBufferController.h
SDK/BlGrabber/include/GrabberControl.h
SDK/BlVisionPro/include/BlSideData.h
SDK/BlVisionPro/include/BlVisionLib.h
SDK/BlVisionPro/include/ISoftVisionApp.h
SDK/BlVisionPro/include/IVisionRecipe.h
SDK/CHImageBuffer/include/ImageBuffer.h
SDK/CHImageBuffer/include/ImageViewer.h
SDK/CHThreadPool/include/ThreadData.h
SDK/CHThreadPool/include/ThreadPool.h
SDK/CHThreadPool/include/TimerThreadPool.h
SDK/CHThreadPool/include/WaitThreadPool.h
SDK/CHThreadPool/include/WorkThreadArray.h
SDK/CHThreadPool/include/WorkThreadPool.h
SDK/ConfigFileManager/include/BasedConfig.h
SDK/ConfigFileManager/include/Config.h
SDK/ConfigFileManager/include/FileIOInterface.h
SDK/ConfigFileManager/include/FileVersionManager.h
SDK/EdgeInspect/include/BLOB_Tool.h
SDK/EdgeInspect/include/ChamferInspect.h
SDK/EdgeInspect/include/CornerCut.h
SDK/EdgeInspect/include/EDGE_DIPM.h
SDK/EdgeInspect/include/EdgeFind.h
SDK/EdgeInspect/include/EdgeProc.h
SDK/EdgeInspect/include/NotchCut.h
SDK/EdgeInspect/include/ProfileCADProc.h
SDK/EdgeInspect/include/RANSAC_LineFittingAlgorithm.h
SDK/EdgeInspect/include/SISEdgeFind.h
SDK/EdgeInspect/include/SplineInspect.h
SDK/EuresysCam/Dll/MultiCam.dll
SDK/EuresysCam/Include/CCallbacks.h
SDK/EuresysCam/Include/ESFilter.h
SDK/EuresysCam/Include/MCpp_Board.h
SDK/EuresysCam/Include/MCpp_BoardImpl.h
SDK/EuresysCam/Include/MCpp_BoardList.h
SDK/EuresysCam/Include/MCpp_BoardListImpl.h
SDK/EuresysCam/Include/MCpp_Callback.h
SDK/EuresysCam/Include/MCpp_CallbackImpl.h
SDK/EuresysCam/Include/MCpp_Channel.h
SDK/EuresysCam/Include/MCpp_ChannelImpl.h
SDK/EuresysCam/Include/MCpp_Configuration.h
SDK/EuresysCam/Include/MCpp_ConfigurationImpl.h
SDK/EuresysCam/Include/MCpp_Exception.h
SDK/EuresysCam/Include/MCpp_ExceptionImpl.h
SDK/EuresysCam/Include/MCpp_MultiCamObject.h
SDK/EuresysCam/Include/MCpp_MultiCamObjectImpl.h
SDK/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h
SDK/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h
SDK/EuresysCam/Include/MCpp_SignalInfo.h
SDK/EuresysCam/Include/MCpp_SignalInfoImpl.h
SDK/EuresysCam/Include/MCpp_Surface.h
SDK/EuresysCam/Include/MCpp_SurfaceImpl.h
SDK/EuresysCam/Include/MCpp_global.h
SDK/EuresysCam/Include/MCpp_globalImpl.h
SDK/EuresysCam/Include/McDef.h
SDK/EuresysCam/Include/McIo.h
SDK/EuresysCam/Include/McParams.h
SDK/EuresysCam/Include/McParamsCompat1x.h
SDK/EuresysCam/Include/MultiCamCpp.h
SDK/EuresysCam/Include/MultiCamCppExternal.h
SDK/EuresysCam/Include/MultiCamCppInternal.h
SDK/EuresysCam/Include/MultiCam_DataTypes.h
SDK/EuresysCam/Include/containers.h
SDK/EuresysCam/Include/multicam.h
SDK/EuresysCam/Lib/MultiCam.def
SDK/EuresysCam/Lib/MultiCam.lib
SDK/EuresysCam/Lib/amd64/MultiCam.def
SDK/EuresysCam/Lib/amd64/MultiCam.lib
SDK/FreeImage/lib/FreeImage.dll
SDK/FreeImage/lib/FreeImage.lib
SDK/JsoncppSDK/include/allocator.h
SDK/JsoncppSDK/include/assertions.h
SDK/JsoncppSDK/include/config.h
SDK/JsoncppSDK/include/forwards.h
SDK/JsoncppSDK/include/json.h
SDK/JsoncppSDK/include/json_features.h
SDK/JsoncppSDK/include/reader.h
SDK/JsoncppSDK/include/value.h
SDK/JsoncppSDK/include/version.h
SDK/JsoncppSDK/include/writer.h
SDK/LogSDK/include/IDayLog.h
SDK/LogSDK/include/ILogger.h
SDK/LogSDK/include/LogLib.h
SDK/MIL/lib/MILPerf.dll
SDK/MIL/lib/MILQSVEngine.dll
SDK/MIL/lib/MilCodec.dll
SDK/MIL/lib/MilDSFCapture.dll
SDK/MIL/lib/MilDirectX.dll
SDK/MIL/lib/MilDisplay.dll
SDK/MIL/lib/MilGPU.dll
SDK/MIL/lib/MilGPUd3d10.dll
SDK/MIL/lib/MilGPUd3d11.dll
SDK/MIL/lib/MilGPUd3d9.dll
SDK/MIL/lib/MilGrabc.dll
SDK/MIL/lib/MilSoliosUI.dll
SDK/MIL/lib/Milim.dll
SDK/MIL/lib/Milsolios.dll
SDK/MIL/lib/MultiCam.dll
SDK/MIL/lib/mil.dll
SDK/MIL/lib/milcacheinfo.dll
SDK/MIL/lib/mildig.dll
SDK/MIL/lib/milfpga.dll
SDK/MIL/lib/milmp.dll
SDK/Matrox/Include/MILDyn/PFNC.h
SDK/Matrox/Include/MILDyn/mil3ddisp.h
SDK/Matrox/Include/MILDyn/mil3dgeo.h
SDK/Matrox/Include/MILDyn/mil3dgra.h
SDK/Matrox/Include/MILDyn/milcom.h
SDK/Matrox/Include/MILDyn/mildisplay.h
SDK/Matrox/Include/MILDyn/milim.h
SDK/Matrox/Include/Mil.h
SDK/Matrox/Include/MilDSFCapture.h
SDK/Matrox/Include/MilDSFCaptureGUID.h
SDK/Matrox/Include/MilDSFSequence.h
SDK/Matrox/Include/MilDSFSequenceGUID.h
SDK/Matrox/Include/MilDyn.h
SDK/Matrox/Include/MilFunc.h
SDK/Matrox/Include/MilFunctionCode.h
SDK/Matrox/Include/Mildec.h
SDK/Matrox/Include/Milerr.h
SDK/Matrox/Include/Milos.h
SDK/Matrox/Include/Milproto.h
SDK/Matrox/Include/Milsetup.h
SDK/Matrox/Include/mbasictypes.h
SDK/Matrox/Include/milfpga.h
SDK/Matrox/Include/milfuncll.h
SDK/Matrox/Include/milstring.h
SDK/Matrox/Include/miluniqueid.h
SDK/Matrox/Include/milvector.h
SDK/Matrox/Include/milweb.h
SDK/Matrox/dll/DigitizerController.dll
SDK/Matrox/dll/Liberatus.dll
SDK/Matrox/dll/MILIrisGTRFocusDelay.dll
SDK/Matrox/dll/MILPerf.dll
SDK/Matrox/dll/MILQSVEngine.dll
SDK/Matrox/dll/McomController.dll
SDK/Matrox/dll/MilAux.dll
SDK/Matrox/dll/MilClarityUHD.dll
SDK/Matrox/dll/MilClarityUHDUI.dll
SDK/Matrox/dll/MilCodec.dll
SDK/Matrox/dll/MilConcordPoE.dll
SDK/Matrox/dll/MilConcordPoEUI.dll
SDK/Matrox/dll/MilDSFCapture.dll
SDK/Matrox/dll/MilDSFCommon.dll
SDK/Matrox/dll/MilDSFSequence.dll
SDK/Matrox/dll/MilDirectX.dll
SDK/Matrox/dll/MilDisplay.dll
SDK/Matrox/dll/MilGPU.dll
SDK/Matrox/dll/MilGPUd3d10.dll
SDK/Matrox/dll/MilGPUd3d11.dll
SDK/Matrox/dll/MilGPUd3d9.dll
SDK/Matrox/dll/MilGenTL.dll
SDK/Matrox/dll/MilGenTLUI.dll
SDK/Matrox/dll/MilGigEVision.dll
SDK/Matrox/dll/MilGrabc.dll
SDK/Matrox/dll/MilIrisGTRUI.dll
SDK/Matrox/dll/MilMorphis.dll
SDK/Matrox/dll/MilMorphisQxt.dll
SDK/Matrox/dll/MilNetwork.dll
SDK/Matrox/dll/MilNetworkSlave.dll
SDK/Matrox/dll/MilOrionHd.dll
SDK/Matrox/dll/MilRadient.dll
SDK/Matrox/dll/MilRadientCXP.dll
SDK/Matrox/dll/MilRadientCXPUI.dll
SDK/Matrox/dll/MilRadientPro.dll
SDK/Matrox/dll/MilRadientProUI.dll
SDK/Matrox/dll/MilRadientUI.dll
SDK/Matrox/dll/MilRadientevcl.dll
SDK/Matrox/dll/MilRadientevclUI.dll
SDK/Matrox/dll/MilRapixoCXP.dll
SDK/Matrox/dll/MilRapixoCXPUI.dll
SDK/Matrox/dll/MilSoliosUI.dll
SDK/Matrox/dll/MilgigevisionUI.dll
SDK/Matrox/dll/Milim.dll
SDK/Matrox/dll/Milnetworkinfo.dll
SDK/Matrox/dll/Milsolios.dll
SDK/Matrox/dll/Milusb3visionUI.dll
SDK/Matrox/dll/RadientPfpga.dll
SDK/Matrox/dll/SoliosPFpga.dll
SDK/Matrox/dll/libmfxsw64.dll
SDK/Matrox/dll/mil.dll
SDK/Matrox/dll/mil3d.dll
SDK/Matrox/dll/milcacheinfo.dll
SDK/Matrox/dll/milcom.dll
SDK/Matrox/dll/mildig.dll
SDK/Matrox/dll/milfpga.dll
SDK/Matrox/dll/milhttpserver.dll
SDK/Matrox/dll/milirisgtr.dll
SDK/Matrox/dll/milmp.dll
SDK/Matrox/dll/milnetworkserver.dll
SDK/Matrox/dll/milpcie.dll
SDK/Matrox/dll/milshm.dll
SDK/Matrox/dll/milusb3vision.dll
SDK/Matrox/dll/milwebclient.dll
SDK/Matrox/dll/milwebserver.dll
SDK/Matrox/lib/Mil3d.lib
SDK/Matrox/lib/Milim.lib
SDK/Matrox/lib/mil.lib
SDK/Matrox/lib/milcom.lib
SDK/Matrox/lib/milfpga.lib
SDK/Matrox/lib/milwebclient.lib
SDK/OpenCV/opencv_3.1/include/opencv/cv.h
SDK/OpenCV/opencv_3.1/include/opencv/cv.hpp
SDK/OpenCV/opencv_3.1/include/opencv/cvaux.h
SDK/OpenCV/opencv_3.1/include/opencv/cvaux.hpp
SDK/OpenCV/opencv_3.1/include/opencv/cvwimage.h
SDK/OpenCV/opencv_3.1/include/opencv/cxcore.h
SDK/OpenCV/opencv_3.1/include/opencv/cxcore.hpp
SDK/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp
SDK/OpenCV/opencv_3.1/include/opencv/cxmisc.h
SDK/OpenCV/opencv_3.1/include/opencv/highgui.h
SDK/OpenCV/opencv_3.1/include/opencv/ml.h
SDK/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/core.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/base.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/core.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/core_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h
SDK/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h
SDK/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/private.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/types.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/types_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/version.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/cvconfig.h
SDK/OpenCV/opencv_3.1/include/opencv2/features2d.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/flann.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/any.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/config.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/defines.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/dist.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/flann/general.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/heap.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/logger.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/params.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/random.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/saving.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h
SDK/OpenCV/opencv_3.1/include/opencv2/flann/timer.h
SDK/OpenCV/opencv_3.1/include/opencv2/highgui.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h
SDK/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/ml.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/opencv.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/photo.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/shape.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/superres.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/video.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/video/video.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videoio.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h
SDK/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h
SDK/OpenCV/opencv_3.1/include/opencv2/videostab.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp
SDK/OpenCV/opencv_3.1/include/opencv2/world.hpp
SDK/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_calib3d310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_core310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_core310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_features2d310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_features2d310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_flann310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_flann310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_highgui310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_ml310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_ml310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_objdetect310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_photo310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_photo310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_shape310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_shape310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_stitching310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_stitching310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_superres310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_superres310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_ts310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_ts310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_video310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_video310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_videoio310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_videoio310d.lib
SDK/OpenCV/opencv_3.1/lib/opencv_videostab310.lib
SDK/OpenCV/opencv_3.1/lib/opencv_videostab310d.lib
SDK/SISAssem/include/ASGInspection.h
SDK/SISAssem/include/AssemDefect.h
SDK/SISAssem/include/AssemParam.h
SDK/SISAssem/include/AssemUtil.h
SDK/SISAssem/include/BlobStorage.h
SDK/SISAssem/include/Pad.h
SDK/SISAssem/include/PairStorage.h
SDK/SISAssem/include/PixelStorage.h
SDK/SISAssem/include/SISAssem.h
SDK/SISAssem/include/SISStrg.h
SDK/SISBuffer/include/Broadcast.h
SDK/SISBuffer/include/InspectionBuffer.h
SDK/SISBuffer/include/NoiseLevel.h
SDK/SISBuffer/include/SISBuffer.h
SDK/SISBuffer/include/SISMatch.h
SDK/SISBuffer/include/SISMath.h
SDK/SISBuffer/include/SISPitch.h
SDK/SISControls/GridControl/CellRange.h
SDK/SISControls/GridControl/GridCell.h
SDK/SISControls/GridControl/GridCellBase.h
SDK/SISControls/GridControl/GridCellButton.h
SDK/SISControls/GridControl/GridCtrl.h
SDK/SISControls/GridControl/GridDropTarget.h
SDK/SISControls/GridControl/GridInPlaceEdit.h
SDK/SISControls/GridControl/GridMemDC.h
SDK/SISControls/GridControl/NewCellTypes/GridCellCheck.h
SDK/SISControls/GridControl/NewCellTypes/GridCellCombo.h
SDK/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
SDK/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
SDK/SISControls/GridControl/NewCellTypes/GridURLCell.h
SDK/SISControls/GridControl/TitleTip.h
SDK/SISControls/include/CellCtrl.h
SDK/SISControls/include/ColorButton.h
SDK/SISControls/include/DefectMap.h
SDK/SISControls/include/FontStatic.h
SDK/SISControls/include/GradientStatic.h
SDK/SISControls/include/HeadCtrl.h
SDK/SISControls/include/InPlaceComboBox.h
SDK/SISControls/include/InPlaceEdit.h
SDK/SISControls/include/LogCtrl.h
SDK/SISControls/include/SISButton.h
SDK/SISControls/include/SISFolderScheduling.h
SDK/SISControls/include/SISJogBtn2Parent.h
SDK/SISControls/include/SISJogButton.h
SDK/SISControls/include/SISLabel.h
SDK/SISControls/include/SISListBoxLog.h
SDK/SISControls/include/SISListCtrlExt.h
SDK/SISControls/include/SortClass.h
SDK/SISControls/include/StaticMap.h
SDK/SISControls/include/WKButton.h
SDK/SISControls/include/XTabCtrl.h
SDK/SharedMapDll/include/LogManager.h
remove.bat |