Real-time image acquisition method based on PC platform

By porting the GIGE image acquisition protocol to the real-time system intime and modifying the timer, the problem of unstable response time of PC-based intelligent equipment under Windows system was solved, and the stability of response time and the safety and controllability of the equipment were achieved.

CN118945464APending Publication Date: 2024-11-12SHENZHEN YOUYIKONG SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410950673.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

When intelligent equipment based on the PC platform acquires images under the Windows system, the response time is unstable and it is easily affected by task delays and blue screens, resulting in unstable equipment production capacity and safety hazards.

Method used

The GIGE image acquisition protocol was ported to the real-time system intime, and the C++ timer was modified. The timer function was implemented using intime's Alarm and thread and function callback technology to ensure that the response time is stable at 250us and to keep the equipment controllable when Windows blue screen occurs.

Benefits of technology

It achieves stable response time for intelligent equipment, reaching 250µs, avoiding the impact of Windows task delays and blue screens on the device, and improving the device's security and controllability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945464A_ABST
    Figure CN118945464A_ABST
Patent Text Reader

Abstract

The invention discloses a real-time image acquisition method based on a PC platform, and relates to the technical field of image acquisition. Comprising the following steps: 1, transplanting an image acquisition protocol GIGE to intime, and enabling an intime system to have an image acquisition capability; 2, transforming a timer of C + +: realizing the function of Timer by using Alarm in intime, a thread and a function callback technology; by introducing a real-time system and transforming a timer, the response time of the intelligent equipment can stably reach 250us and is completely not influenced by a windows task, and the equipment program is not influenced when the windows blue screen is carried out, so that the equipment is safe and controllable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image acquisition technology, and in particular to a real-time image acquisition method based on a PC platform. Background Art

[0002] In the current development of intelligent equipment, the visual application development is generally based on PC, calling the camera API function to realize image acquisition, while the equipment process logic program and image algorithm run in Windows. Figure 1 shown.

[0003] Due to the non-real-time nature of Windows, the response time of intelligent equipment is unstable (several milliseconds to hundreds of milliseconds); when the system is overloaded, there are occasional delays of hundreds or even thousands of milliseconds; the control programs for motion, logic control, communication, machine vision and other tasks in the current mainstream PC-based control solutions in the industry are all running on Windows, which will cause unstable equipment production or reduced product yield. In more serious cases, after Windows blue screen due to computer viruses and other reasons, intelligent equipment is out of control, resulting in safety hazards or damage to product and equipment parts.

[0004] In summary, the present invention designs a real-time image acquisition method based on a PC platform. Summary of the invention

[0005] In view of the deficiencies in the prior art, the purpose of the present invention is to provide a real-time image acquisition method based on a PC platform. By introducing a real-time system and modifying the timer, the response time of the intelligent equipment can be stably reached 250us, which is completely unaffected by the Windows task and does not affect the equipment program when the Windows blue screen appears, making the equipment safe and controllable.

[0006] In order to achieve the above object, the present invention is implemented by the following technical solution: a real-time image acquisition method based on a PC platform, comprising the following steps:

[0007] 1. Port the image acquisition protocol GIGE to intime, and enable the intime system to have the ability to acquire images;

[0008] 2. Modify the C++ timer: Use the Alarm, thread and function callback technology in intime to implement the Timer function.

[0009] The step 1 comprises:

[0010] 1.1 New VS project: YYKGige

[0011] The VS compilation platform will be set to INTime.

[0012] 1.2 Modify project configuration

[0013] Additional library directories added: $(INtime)rt\lib.

[0014] Additional dependencies added: iwin32.lib

[0015] 1.3 Add intime file

[0016] Add files intime.h and intime.c to implement windows API not included in intime.

[0017] 1.4 Reference intime file

[0018] In each project that includes source code, add a reference to the 1.2 file.

[0019] 1.5 Add INTIME macro definition

[0020] Used to distinguish the compilation environment of INTime and Windows.

[0021] 1.6 Remove the reference to the Windows-specific header file

[0022] Use the macro in step 1.4 to control the reference of header files, especially socket-related header files.

[0023] 1.7 API definition and implementation

[0024] Define the Windows API that is not in intime in the files intime.h / intime.c.

[0025] The step 2 comprises:

[0026] 2.1 Class definition and declaration

[0027] Define the class RTimer and declare a global array in Nosys

[0028] 2.2C++ program initializes Timer

[0029] Use DllImport to call and initialize the RTimer interface, passing parameters including the period and callback function handle;

[0030] 2.3RTimer Initialization

[0031] NoSys is instantiated with the corresponding parameters;

[0032] 2.4 Create Alarm

[0033] NoTimer initializes the Alarm in Intime, with a minimum cycle of 150us;

[0034] 2.5 Updating an Array

[0035] NoSys Update A;

[0036] 2.6 Waiting for the trigger signal

[0037] cppapp calls the start timer API, RTimer will create a thread and keep waiting for the Alarm signal (WaitForAlarm);

[0038] 2.7 Triggering callback

[0039] When the time interval is greater than or equal to the set period, RTimer will trigger the callback function;

[0040] 2.8 Execute callback function

[0041] After receiving the callback signal, csapp executes the corresponding function operation.

[0042] Beneficial effects of the present invention: By introducing a real-time system and modifying the timer, the present invention enables the response time of the intelligent equipment to stably reach 250us, which is completely unaffected by the Windows task and does not affect the equipment program when the Windows blue screen appears, making the equipment safe and controllable. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments;

[0044] Figure 1 It is a schematic diagram of the prior art;

[0045] Figure 2 is a system diagram of the present invention;

[0046] Figure 3 Timing diagram using RTimer for a C++ application of the present invention. DETAILED DESCRIPTION

[0047] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.

[0048] Reference Figure 2 , this specific implementation adopts the following technical solution: a real-time image acquisition method based on a PC platform, comprising the following steps:

[0049] 1. Port the image acquisition protocol GIGE to intime, and enable the intime system to have the ability of image acquisition; development environment: VS2019, C++14 and above, C11 and above, INTIme6.4.21125.1.

[0050] 1.1 New VS project: YYKGige

[0051] The VS compilation platform will be set to INTime;

[0052] 1.2 Modify project configuration

[0053] Additional library directories added: $(INtime)rt\lib.

[0054] Additional dependencies added: iwin32.lib;

[0055] 1.3 Add intime file

[0056] Add files intime.h and intime.c to implement windows API not included in intime.

[0057] 1.4 Reference intime file

[0058] In each project that includes source code, add a reference to the 1.2 file.

[0059] 1.5 Add INTIME macro definition

[0060] Used to distinguish the compilation environment of INTime and Windows.

[0061] 1.6 Remove the reference to the Windows-specific header file

[0062] Use the macro in step 1.4 to control the reference of header files, especially socket-related header files.

[0063] 1.7 API definition and implementation

[0064] Define the Windows API that is not in intime in the files intime.h / intime.c.

[0065] 2. Modify the C++ timer: The minimum cycle of the Timer in Windows can only be 1ms, and it is found that it actually takes at least 2ms to run the Timer with a cycle of 1ms. In order to improve efficiency, the Alarm, thread and function callback technology in intime are used to implement the function of the Timer (the Timer is called RTimer for short, located in Nosys.dll). The timing diagram of the C++ application using RTimer is as follows Figure 3 shown.

[0066] 2.1 Class definition and declaration

[0067] Define the class RTimer and declare a global array in Nosys;

[0068] 2.2C++ program initializes Timer

[0069] Use DllImport to call and initialize the RTimer interface, passing parameters including the period and callback function handle;

[0070] 2.3RTimer Initialization

[0071] NoSys is instantiated with the corresponding parameters;

[0072] 2.4 Create Alarm

[0073] NoTimer initializes the Alarm in Intime, with a minimum cycle of 150us;

[0074] 2.5 Updating an Array

[0075] NoSys Update A;

[0076] 2.6 Waiting for the trigger signal

[0077] cppapp calls the start timer API, RTimer will create a thread and keep waiting for the Alarm signal (WaitForAlarm);

[0078] 2.7 Triggering callback

[0079] When the time interval is greater than or equal to the set period, RTimer will trigger the callback function;

[0080] 2.8 Execute callback function

[0081] After receiving the callback signal, csapp executes the corresponding function operation.

[0082] This specific implementation method is based on a method for improving the production efficiency of intelligent equipment on a PC platform, including: porting of camera communication library; porting of visual algorithm library; and calling of machine program API. By introducing a real-time system and modifying the timer, the response time of the intelligent equipment can be stably reached to 250us, which is completely unaffected by Windows tasks, and does not affect the equipment program when Windows blue screen occurs, making the equipment safe and controllable.

[0083] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A real-time image acquisition method based on a PC platform, characterized in that: The following steps are involved: (1) Port the image acquisition protocol GIGE to intime, and enable the intime system to have image acquisition capabilities; (2) Modify the C++ timer: Use the Alarm, thread, and function callback technology in intime to implement the Timer function.

2. A PC-based real-time image acquisition method according to claim 1, characterized in that: The step (1) comprises: (1.1) Create a new VS project: YYKGige The VS compilation platform will be set to INTime; (1.2) Modify project configuration Additional library directories added: $(INtime)rt\lib; Additional dependencies added: iwin32.lib (1.3) Add intime file Add files intime.h, intime.c to implement windows API not included in intime; (1.4) Reference intime file In each project that includes source code, add a reference to the file in step (1.2); (1.5) Add INTIME macro definition Used to distinguish the compilation environment of INTime and Windows; (1.6) Remove the reference to the Windows-specific header file Use the macro in step (1.4) to control the reference of header files, especially socket-related header files; (1.7) API definition and implementation Define the Windows API that is not in intime in the files intime.h / intime.c.

3. The method for real-time image acquisition based on a PC platform according to claim 1, characterized in that: The step (2) comprises: (2.1) Class definition and declaration Define the class RTimer and declare a global array in Nosys; (2.2) C++ program initializes the Timer Use DllImport to call and initialize the RTimer interface, passing parameters including the period and callback function handle; (2.3)RTimer initialization NoSys is instantiated with the corresponding parameters; (2.4) Create Alarm NoTimer initializes the Alarm in Intime, with a minimum cycle of 150us; (2.5) Update the array NoSys Update A; (2.6) Waiting for the trigger signal cppapp calls the start timer API, RTimer will create a thread and keep waiting for the Alarm signal in a loop; (2.7) Trigger callback When the time interval is greater than or equal to the set period, RTimer will trigger the callback function; (2.8) Execute callback function After receiving the callback signal, csapp executes the corresponding function operation.