Journal of Environmental Treatment Techniques
2019, Special Issue on Environment, Management and Economy, Pages: 1108-1111
We can save the image or print it using the Save () and
Print () methods built into C #, respectively.
3
Results and Discussion
Since the image printed and glued onto the computer case
should be read, it is necessary to use some kind of camera.
Since a lot of people in everyday life are not to be without a
smartphone, and enterprises actively install Wi-Fi points for
communication between mills or personnel, it will be
convenient to use a smartphone camera connecting to it via a
local network. Since we will work through an IP camera, it is
necessary to decide how the image will be transmitted. The
main transmission methods are the following: the camera
receives a picture at any interval and uploads it to the server
In all existing programs that read and decode QR codes, a
simple algorithm for detecting a QR code in the image
received from the camera is implemented. Then, the standard
procedure for decoding information from a QR code is
implemented (3). However, this recognition algorithm
requires a very clear positioning of the specially allocated
area on the shooting device and a certain location of the QR
code in space. After the specially defined area on the
shooting device clearly matches the faces of the QR code,
three positioning marks are searched for, which were
discussed in the previous section. These marks are located
strictly in certain places in the selected image area on the
recording device. The disadvantage of this approach is that
the QR code cannot be in any area on the image. A user
himself / herself must first focus on the necessary QR code,
and make sure that the area for shooting the QR code
coincides with the QR code itself, which must be decoded
(
JPEGStream) or video is being broadcast (MJPEGStream ).
Conventional code readers operate according to the first
principle, but for phones it is better to use the second. It’s
best to use the Open Source repository “AForge.Video”,
which is also available for integration into the project in the
“
NuGet Package Manager”.
To obtain an image, it is necessary to designate its class,
and also give it a link where the broadcast will be conducted,
transfer a set of event handlers and, of course, start receiving
the image:
MJPEGStream stream = new MJPEGStream ("some
url");
(
5).
In order to scan a QR code, the program must first "see"
it. Since enterprises around the world are introducing Wi-Fi-
connected points integrated in a network intended for
communication between employees, this is an excellent way
of wireless communication between machines for their joint
work or for quick and remote data collection by employees
from machines.
Given the above, it makes sense to broadcast an image to
the local network. To do this, we need a device with a Wi-Fi
communication module and a camera. It could be a
smartphone, an IP camera, or even a barcode reader. In the
case of the latter, it is necessary to purchase equipment, and
in the case of smartphones, which nowadays are owned by
the majority of the population of our planet, there is no such
need. Even a HD quality picture in is suitable for reading a
QR code. To start the broadcast, an employee only needs to
download the free application, available, for example, on
Google Play (10-13). The next step is to select the quality of
the transmitted image. You should set the resolution to about
streamNewFrame
video_NewFrame);
streamStart ();
+ = new NewFrameEventHandler
(
Some cameras transmit data through an HTTP header that
is not compliant with the standard, which results in an
exception in. NET. To avoid this exception, you must set the
useunsafeheaderparsing
httpWebRequest
configuration
parameter, which can be done using the application
configuration file (7-16).
In order to display an image in a PictureBox, we must
create a method by which the class will be indicated and the
picture will be displayed:
void
stream_NewFrame
(object
sender,
NewFrameEventArgs eventArgs)
{
Bitmap bitmap = (Bitmap) eventArgs.Frame.Clone ();
pictureBox1.Image = bitmap;
}
640 x480 or 1280x 720, and the picture quality would be
from 65 to 90 per cents (the resolution required for setting
and picture quality varies depending on the quality of the
camera). Then, by clicking the “Run” button, we can see the
transmitted image and the IP address of the camera.
To create QR codes in C #, we can use the Barcode
Rendering Framework repository, open for integration into a
project, available on NuGet under the name Zen.Barcode
The last step remained is reading the QR code from the
picture. To do this, the ZXing.Net repository, which is also
available on NuGet, will be used. It supports such formats as
UPC-A, UPC-E, EAN-8, EAN-13, Code 39, Code 93, Code
128, Codabar, ITF, QR Code, Data Matrix, Aztec, PDF 417,
MaxiCode, RSS 14, RSS-Expanded (6-15).
Rendering.Framework" GitHub
BarcodeRenderingFramework". This framework supports
Code 11, Code 25, Code 39, Code 93, Code 128, Code EAN
or
on
To process the image, we should create a timer that
receives the image once a second and works with it. For code
recognition, it is necessary to designate classes and pass the
picture to the handler:
"
13, Code EAN 8, Code PDF417 2D, Code QR 2D (5-14).
To do this, we just need to designate the class:
BarcodeReader Reader = new BarcodeReader ();
ZenBarcode.CodeQrBarcodeDraw
Zen.Barcode.BarcodeDrawFactory.CodeQr;
and then display the image in a PictureBox (pictureBox1
in this case), obtained from some TextBox text field
brcode
=
Result
result
=
Reader.Decode
((Bitmap)
pictureBox1.Image );
The “result” variable will contain the data encrypted in
the QR code, which can then be, for example, written to a
table or displayed in a file using the built-in functions and
methods.
(
textBox1 in this case):
pictureBox1.Image = brcode.Draw (textBox1.Text, 50);,
where 50 is the maximum height of the QR code.
1
109