Delphi

5 EASY Ways To Integrate Image Processing In Your Apps

What does image processing mean? According to Gonzalez and Rafael in 2018, Image Processing or Digital Image Processing refers to processing digital images using a digital computer. Note that a digital image is composed of a finite number of elements, each element has a particular location and value. These elements are called picture elements, image elements, pels, and pixels. Pixel is the term used most widely to denote the elements of a digital image. Since images are defined over two dimensions (perhaps more), digital image processing may be modeled in the form of multidimensional systems. How is digital image processing better? As a subcategory or field of digital signal processing, digital image processing has many advantages over analog image processing. It allows a much wider range of algorithms to be applied to the input data and can avoid problems such as the build-up of noise and distortion during processing. The generation and development of digital image processing are mainly affected by three factors: First, the development of computers; second, the development of mathematics (especially the creation and improvement of discrete mathematics theory); third, the increasing demand for a wide range of applications in environment, agriculture, military, industry, medical science, etc. Image Processing is frequently used in ‘Computer Vision’. Don’t be confused-we are going to talk about the difference between these terms and how they connect. Image Processing vs Computer Vision The main difference between Image Processing and Computer Vision approaches is the goals (not the methods used). For example, if the goal is to enhance an image for later use, then this may be called image processing. If the goal is to emulate human vision, like object recognition, event detection, or automatic driving, then it may be called computer vision. Both Image Processing algorithms and Computer Vision (CV) algorithms take an image as input; however, in image processing, the output is also an image, whereas in computer vision the output can be some features/information about the image. Read our previous article about Computer Vision here: Why use Python for Image Processing? Now, almost every image processing or computer vision library has a form of scripting interface in its main functions. Most of the time, this scripting language is Python (this article shows the power of Delphi to provide a nice GUI for Python scripting power). Developers favor this particular ecosystem because of the following: Easy to learn and easy to use, without losing the quality of programming decisions. Python has been on the market for a long time and has been established. Python continues to evolve dynamically. With Python, you can use the coolest OOP solutions and you can write simple and effective code. Python provides a huge number of libraries that solve the whole range of programming problems. How to use Pillow, Matplotlib, scikit-learn, scikit-image, and Mahotas Python libraries to perform Image Processing tasks All of them would be integrated with Python4Delphi to create Windows Apps with Image Processing capabilities. Prerequisites Before we begin to work, download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out the easy instructions found in the Getting Started With Python4Delphi video by Jim McKeeth. Time to get Started! First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD […]

Read More

Incredible Wind Triangle Solving App Is Made In Delphi

We’ve written before about some of the wonderful ways Delphi developers are helping pilots with the difficult job of defying gravity in their aircraft. The reliability of Delphi applications and the cross-platform power of FireMonkey FMX framework, combined with the skillful craftwork of the software engineer seems to lend itself very neatly to solving problems. Aviation is one of those areas in which modern mobile devices can be the perfect tool to assist with the mind-boggling situations and tasks a pilot must address. Creating a mobile application with RAD Studio and Delphi is extremely easy – freeing up the developer to focus on the complexities of the problem rather than being bogged down in making the mobile app actually work. E6B is a flight computer and it’s written in Delphi The E6B app, from Delphi Developer Micriconsult based in Oostende in Belgium, is a mobile app which solves a “wind triangle” for pilots of light aircraft. The users enter four values out of six. The six values are three speeds and three angles. The app calculates the remaining two unentered values of the six. Micriconsult says  “it then explains how you get these results with a flight computer, by animating it. It rotates the disk, slides it and add marks. It also shows what value to use for each step towards the solution. This app runs on Android devices and preferably on tablets. On devices with smaller screens, you may need to zoom.” What are the features of The E6B Flight Computer app? E6B solves any kind of wind triangle problem and explains how to find those results on a regular flight computer. It contains an accurate visualization of a flight computer. Each of the different steps are animated toward a solution. Users can tap the “explain” tab to get a short explanation of the app. The app supports zooming in (two fingers gesture) and pan (one finger gesture) to ease accessing the data entry controls or to enlarge a part of flight computer. It supports portrait and landscape layout. Users can change the language to the language settings of the Android device. Available languages are English (Default), French, German, Spanish and Dutch. Google Play E6B Basic Flight Computer Screenshot Gallery

Read More

Implementing A Blazing Fast IoT Network With MQTT

What is IoT? The IoT term defines the concept of internet-connected physical devices that can send and/or receive data. To exchange data easily, a protocol of communication must be used in order of any devices can communicate with another one. The only requirement is that all devices must communicate in an agreed way. For IoT, the MQTT protocol is one of the top choices. What is MQTT? MQTT is short for Message Queuing Telemetry Transport. It’s a communication protocol Machine-to-Machine (M2M) designed initially for networks with low bandwidth and preferably bi-directional. It was developed for gas and oil industries in 1999, a time when the network bandwidth was typically very low. Its usage was extended to IoT, automation and is used by Facebook for its well-known Messenger product. Here is an overview of MQTT See below a schema of a typical MQTT protocol architecture: What are MQTT entities? This architecture is Client/Server with an implementation of publish/subscribe. There are three roles in this protocol : The Broker : The broker acts like the server of a network using MQTT. All messages go through it but its only role is to send messages to the targeted clients. The Publishers : these entities send data. The Subscribers : these entities receive data. A client application using the MQTT protocol can be a publisher or a subscriber or even both. How do I build an MQTT message? To summarize: an MQTT message is built with a title that we name Topic. The Topic is a string written with some rules. Some data can be exchange in addition of the Topic to complete the message. We can draw a parallel between MQTT call and REST call like this by comparing the MQTT Topic with URL endpoint in REST. Subscribers ‘listen’ to a message Topic and Publishers send message with a specified Topic. The Broker forwards messages to Subscribers that listen the specified Topic in the message. A client of MQTT network can subscribe to multiple Topics and publish multiple Topics too. MQTT is an extremely flexible messaging protocol to use in your Delphi and C++ Builder applications. What are the rules of writing MQTT Topics? MQTT Topics are structured in a hierarchy similar to folders and files in a file system using the forward slash ( / ) as a delimiter. Some exemples / /house /house/livingroom/conditioner /house/livingroom/lights MQTT protocol introduces some possible wildcard in the Topic : # (hash character) – multi level wildcard + (plus character) -single level wildcard Then a client subscribing to /house/# will listen all message starting with /house . A client subscribing to /house/+/lights will listen to all messages which match the “lights” wildcard specifications (for example living room, kitchen bathroom). It can be used to switch on or off all lights of the house. To develop a Delphi MQTT client, we will use ready-made component provided by TMS Software : TTMSMQTTClient component available for Windows/Android/IOS/Linux. TMS Software provides an installation package with a trial version here. You can use the TTMSMQTTClient component to easily implement MQTT Let’s have a look at the component provided by TMS Software. How do I connect to an MQTT server? This component provides of course several properties. To connect to a MQTT server the minimum settings to set are : BrokerHostName : host name where the MQTT […]

Read More

Powerful Dashboards with REST API & Delphi MVC Framework

The Delphi MVC framework (DMVC) is a popular and powerful framework for web solution, that allows the MVC architecture in Delphi. With it, we can create powerful RESTful servers without effort. In this article we will make a Delphi MVC example and create a dashboard through Serenytics using their REST API. A REST API is an application program interface (API) that uses an architectural style, based on representational state transfer (REST), allowing interactions between REST web services. An API is a set of requests that allow data communication between applications. It uses HTTP requests for data manipulation. REST is a set of restrictions used so that HTTP requests meet the guidelines defined in the architecture. Therefore, REST API means using an API to access back-end applications, so that this communication is done with the standards defined by the Rest architecture style. Creating a Simple REST API Using Delphi MVC Framework To follow our example of creating a simple REST API server in Delphi you need to first install the extremely popular and well-respected Delphi MVC Project – from Embarcadero MVP Daniele Teti – which can be found at this link: https://github.com/danieleteti/delphimvcframework There is an install guide for DelphiMVC, here: https://github.com/danieleteti/delphimvcframework#install-the-latest-stable-version After the installation, go to your Delphi and create a new DelphiMVC Project. You should see a screen like this: Create some classes to use with Delphi MVC and the REST API In this case, I’m getting data from a customer table on my database so, I change the field ‘Controller Class Name’ to TControllerCustomer. If you open your controller, you can see endpoints and methods already created. We need to implement the ‘GetCustomers’ to expose the data but, first, we need to get this data from somewhere. Create a new unit that is gonna be our Model. A Model is a class representation of the data. Our Customer Model looks like this: Finally, create a function to get the data from the database but remember to return a list of your model. In our case: On the Controller unit, go to GetCustomers and call the function you created. Now we need to convert the objects list to JSON. DMVC makes it easy for us with the ‘Render’ method. To convert a list of objects, we can do: Render(TCustomer.GetAllCustomers); RenderTCustomer>(TCustomer.GetAllCustomers); Example results from a Delphi MVC application That is all you need to do. If you run your application and go to the path of the method, you will see: How do I create a dashboard with Delphi using a REST API? Now you have your API endpoint and you can use it to feed an AI, a mobile app, another application, and, of course, create dashboards. As I said in my introduction, I will be using the Serenytics website for this. The Serenytics dashboard visualization is free to use. First, create an account with Serenytics. Then, on the left menu of the main screen, go to DATA and then add ‘New data Source’. Choose WebServices & API and finally, REST API. Note that Serenytics cannot access ‘localhost’ domains. Getting and running the ngrok application We are going to use an application called “ngrok” to help us test our Delphi application. Go to the official ngrok website’s download section here: https://ngrok.com/download Download the ngrok application. When we run ngrok creates […]

Read More

RAD Server CRUD Procedures – Part 2

In this Part 2 post, we will discuss modifying the default generated CRUD (CREATE, READ, UPDATE, DELETE) procedure implementations from the RAD Server Package Wizard, to show one possible way to implement Get, GetItem, Post, PutItem and DeleteItem REST Endpoints. In the Part 1 post, we discussed the default generated CRUD procedure implementations from the RAD Server Package Wizard. In the Part 3 post, we will discuss implementing a FireMonkey (FMX) REST client to call and interact with the RAD Server CRUD procedures. The Embarcadero RAD Server (also known as EMS – Enterprise Mobility Server) uses the industry standards of REST, and to transfer data to and from the RAD Server REST Service, JSON – JavaScript Object Notation, is typically used as the transfer encoding. Due to the Embarcadero RAD Server supporting industry standard REST and JSON, we will use Delphi’s, C++ Builder and/or RAD Studio’s REST Client Library components  (TRESTClient, TRESTRequest, and TRESTResponse ) on the client, and  System.JSON classes (TJSONArray and TJSONObject) and FireDAC on the RAD Server to implement our CRUD procedures. Also note, newer versions of RAD Server have introduced new frameworks and components that allows for greater control of the data retrieved by desktop, multi-device, web and other service-based applications that connect to your RAD Server application. For example the EMSDataSetResource Component is discussed here and other RAD Server Improvements introduced in RAD Studio 10.3.2, like the RAD Server Database Mapping Wizard, and Swagger API Documentation Improvements, are discussed here. OK, now let’s dig into the details! First, for our application we want to access and perform CRUD procedures on our Employee Table from our InterBase Employee Database. For the Employee Table, I’m using the sample InterBase Employee database, located at: localhost:C:UsersPublicDocumentsEmbarcaderoStudio21.0Samplesdataemployee.gdb Recall from the part 1 post, using the RAD Server Package Wizard, , we created a package with resource. This created for us a Data Module. A Data Module is like a special form that contains nonvisual components. We can now add FireDAC data access controls onto our Data Module to access our Employee table. On our uResourceModule unit we can add our FireDAC controls to connect to the InterBase Employee database and Query the Employee Table: The easiest way to do this is to use the IDE’s Data Explorer Tab and create a new FireDAC connection to the InterBase Employee database: Then, select the Employee Table from the Tables node. And then drag and drop the Employee Table onto the Data Module form: This will add two FireDAC components on your data module. EmployeeConnection is the FireDAC connection (FDConnection) to your InterBase Employee database, and the EmployeeTable is your FireDAC Query component (FDQuery) to perform the SQL SELECT * FROM EMPLOYEE, to return all rows from the Employee table. To test the FDQuery EmployeeTable, double-click the FDQuery EmployeeTable component. This will open the FireDAC Query Editor, and show us the SQL Command for this FDQuery EmployeeTable, like this. The SQL is SELECT * FROM EMPLOYEE Click the Execute button, to verify you get all the rows return from the Employee table: Get (READ) Procedure Recall from the part 1 post, we saw the RAD Server Package Wizard, generate a default GET (READ) procedure implementation like this: Here is how we modified the default GET procedure to use FireDAC and System.JSON Classes (TJSONArray […]

Read More

The Future Of Desktop Apps Is Native Code

Desktop apps are powerful execution tools that can natively run on your local machine to provide holistic application navigation and utilization experiences. With the advancement of modern web technologies, the desktop application development paradigm also experienced a major drift in terms of implementation. Technologies such as JavaScript and Python have inspired the hybrid implementation of desktop apps. Hybrid app implementations have enhanced the ability of web developers to deliver desktop apps but the decreased performance and increased memory consumption are a significant downside. Since desktop apps run the application code locally on your machine, we cannot compromise on the performance and memory usage by getting rid of the native code. The future of desktop apps still lies in the native code. In this blog post, we’ll look at why native code is the future of desktop apps by comparing the performance and memory usage of Delphi with other desktop application development frameworks such as WPF .NET and Electron. Can Electron deliver an optimized solution? Visual Studio Code is an Electron app and generally performs pretty well. A developer might think that all Electron apps can achieve the same performance as Visual Studio Code but generally that is probably not the case. Microsoft has a huge task force of developers working on the project and has put a lot of effort, time, and money to optimize the VS Code application. In most cases, other companies do not have the enormous budget as giants like Microsoft and hence cannot match the optimization efforts to deliver a high-performant application using Electron. Running a a few unoptimized applications might still be fine, but we know for a fact that our systems indeed have the capacity to run more. When you choose to operate with more than a few, say five to ten, unoptimized applications then they adversely effect the system and application runtime performance. In such scenarios, RAD Studio that consists of Delphi and C++ Builder becomes an ideal choice of adoption for desktop application development. Now let’s look at the performance test results from the Embarcadero Whitepaper. According to Discovering the Best Developer Framework through Benchmarking by Embarcadero Technologies, the end-product performance, which depends on startup times and runtime memory, is one of the four aspects of effectiveness for the success of applications. The consumers judge applications based on the runtime performance and businesses choose the frameworks that have a higher performance. The specialists at Embarcadero Technologies used the development and analysis of a benchmark Windows calculator app and evaluated its performance against the Delphi, WPF, and Electron frameworks and libraries. How does Delphi Contribute to Application Performance and Startup Time? When it comes to performance and startup time of applications, according to Embarcadero’s commissioned whitepaper, frameworks that produce applications with shorter startup times facilitate good user experiences and minimize the system resources well before the application is ready to be used. Startup time is especially important when loading an executable or application over a network because network speeds can be slower than loading applications via the local hard drive. According to the experimentation done in the whitepaper, the benchmark calculator app built with Delphi gave a startup time of 0.239 seconds on average from the local files, whereas from the network files, the average time was recorded to be 0.439 seconds. The slowest startup […]

Read More

Developer Stories: Serkan Şahinoğlu Shares More About His ForPrompt Studio Software

Serkan Şahinoğlu started programming since 1995. He submitted his ForPrompt Studio showcase entry at the Delphi 26th Showcase Challenge and we interviewed him to get more insight on his experiences with Delphi. Head over to the ForPrompt Studio website for the product and how to use it. When did you start using RAD Studio Delphi and how long have you been using it? Since 1995, I have been developing software in Delphi and various languages for 26 years. It has been part of many of my projects since Delphi 1. Thanks to its practicality, it helps me to finish the product in a short time. What was it like building software before you had RAD Studio Delphi? With Delphi  a simple database application could be developed in minutes without writing any code, even twenty years ago, using embedded components for database. How did RAD Studio Delphi help you create your showcase application? As I mentioned earlier RAD Studio is extremely rapid application-oriented, this is my very first mobile application developed while learning Firemonkey for the first time, this really proves RAD studio has really good features to get the work done fast. When my projects need rich interface and practicality, I mostly turn to Delphi. Several times I prepared DLL libraries and external modules with C++ and C# for custom applications and used Delphi again for the interface. What made RAD Studio Delphi stand out from other options? I usually prefer Delphi when developing software with extensive interfaces. With hundreds of visual components and features ready, I can focus on my actual work without dealing with unnecessary details. After doing projects in Visual Basic, Visual C++, C#, and other programming languages, I came to the conclusion that Delphi is a practical software development tool that can producing rapidly. Now it has reached an advanced level that can compile the same project for Windows, Linux, MacOS, iOS, Android operating systems. What made you happiest about working with RAD Studio Delphi? One of Delphi’s my favorite features is that all libraries have clear and readable source codes. By examining them, we can program them more efficiently and easily to understand what is going on behind our code up to the operating system level because it is written very practically and understandably. They also help you learn how to coding. Since the software we produce with Delphi is standalone exe file, the fact that it can be easily transported and operated without the need for additional installations speeds up our business. I can also share my practical small software with my friends as a single small exe file. The VCL library, which cleverly encapsulates the massive Windows API, its practicality in database applications, and the fact that there is no longer the need to encode heavy DirectX/OpenGL thanks to FireMonkey are all my favorite aspects of Delphi. It’s nice that the DXScene/VGScene library, which I bought a lifetime license a few years ago, soon came across as FireMonkey and evolved to its current level. What have you been able to achieve through using RAD Studio Delphi to create your showcase application? The teleprompter render engine I created in Firemonkey sends floating reading text to the laptop monitor or to screens in the TV studio via I/O cards such as Decklink and AJA. In […]

Read More

Quickly Deploy Powerful Cross-Platform Machine Learning OCR Technology

Are you familiar with the concept of OCR? Wouldn’t it be nice to be able to easily convert images of typed, handwritten or printed text into machine-encoded text? Take a look at the two images below, with just a few lines of code we will make our Windows, Mac, Android or iOS application able to “read” those texts! Whether from a scanned document, a photo of a document or the text on signs and billboards in a landscape photo this process of extracting text from images is called Optical Character Recognition or Optical Character Reader (OCR). We can easily use Google OCR machine-learning AI in our Delphi applications The option for “Text Detection” is part of the Vision API that we can use to detect and extract information about multitple Texts in an image. For each text detected Google returns both a list of words identifed with text, bounding boxes, and textAnnotations , as well as the structural hierarchy for the OCR detected text. Google Cloud’s Vision API offers powerful pre-trained machine learning models that you can easily use on your desktop and mobile applications through REST or RPC API methods calls. Lets say you want your application to detect objects, locations, activities, animal species, products, or maybe you want not only to detect faces but also their emotions, or you may have the need to read printed or handwritten text, this and much more is possible to be done for free (up to first 1000 units/month per feature) or at very affordable prices and scalable to the use you make with no upfront commitments. How do I get my RAD Studio Delphi applications to detect text in images with an API? We can use RAD Studio and Delphi to easily setup its REST client library to take advantage of Google Cloud’s Vision API to empower our desktop and mobile applications and if the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format. Our RAD Studio and Delphi applications will be able to either call the API and perform the detection on a local image file by sending the contents of the image file as a base64 encoded string in the body of the request or rather use an image file located in Google Cloud Storage or on the Web without the need to send the contents of the image file in the body of your request. How do I set up the Google Cloud Vision Logo Detection API? Make sure you refer to Google Cloud Vision API documentation in the Text Detect section (https://cloud.google.com/vision/docs/ocr) and also Document Text Detection optimized for dense text/handwriting (https://cloud.google.com/vision/docs/pdf), but in general lines this is what you need to do on Google’s side: Visit https://cloud.google.com/vision and login with your Gmail account Create or select a Google Cloud Platform (GCP) project Enable the Vision API for that project Enable the Billing for that project Create a API Key credential How do I call Google Vision API Text Detection endpoint? Now all we need to do is to call the API URL via a HTTP POST method passing the request JSON body with type TEXT_DETECTION and source as the link to the image we want to analyze. One can do that using REST Client libraries available on […]

Read More

High-Performance Integration For Humanitas

When your users are trying to access things like their health-plan information, the responsiveness of your apps can often be key. There is nothing more frustrating than clicking on a button in a mobile app and then waiting for what seems like a lifetime to get some sort of response. This is doubly important for healthcare apps like HumaSmart since your users are often attempting to obtain pertinent information to present to a healthcare provider to, for example, prove they have the necessary coverage to obtain treatment. It’s stressful enough if you’re feeling unwell – we software developers don’t want to add to that by having apps which wallow through click after click to get to what the poor user wants. That’s why the high speed and rock-solid reliable performance of Delphi applications is such a critical component of a successful mobile application. Humanitas De Venezuela Website Your app could make a real difference to people’s daily lives HumaSmart allows their users to search for an collate their healthcare information and interact with the national service provider Humanitas of Venezuela. With the Humasmart App, which is written with RAD Studio Delphi using the versatile cross-platform FireMonkey framework, users can access their health plans with Humanitas Administradora de Riesgo information and services in a quick and easy way on their cell phones and other mobile devices. What does the HumaSmart app do? According to the development notes from Humanitas the app provides: Details on family members included on the users health plan along with details of the coverage types Request your letters of endorsement and reimbursements. Quick access to Humanitas Administradora de Riesgos’ hotlines (Telephonic Medical Guidance Service, Home Medical Care and Ambulances). Consult status and details of all the user’s cases and process additional documentation or reconsiderations. Communications about the health plan, as well as health and wellness newsletters. Direct access to emergency care calls. Quick access to Humanitas’ social networks It’s an excellent integration with Humanitas’ APIs and services and a great example of what can be done with Delphi. Website HumaSmart Google Play HumaSmart Screenshot Gallery

Read More

Developer Stories: Ronald Krause Talks To Us About VitiMonitoring

Ronald Krause has been using Pascal Delphi ever since Turbo Pascal 3.0. His showcase entry VitaMonitoring was a fantastic addition to the Delphi 26th Showcase Challenge and we got to interview him regarding his Delphi experiences. When did you start using RAD Studio Delphi and have long have you been using it? I started with Turbo Pascal 3.0 and have been using Delphi ever since. There were ups and downs on this road, but today Delphi is in a good shape. What was it like building software before you had RAD Studio Delphi? I started using Delphi with Version 2.0. Before that was the Stone Age of software development. Just google “Real programmers don’t write Pascal” if you want to know what it was like. How did RAD Studio Delphi help you create your showcase application? The application is built with Delphi and AtoZed Intraweb. Together a perfect tool for creating web apps. What made RAD Studio Delphi stand out from other options? We have build several web apps with Delphi and the Intraweb components. The experience was good, the knowledge was there. Our apps are multi-language. We built a pretty good translation system using RTTI that is quite superior to others I have seen. And there are more goodies. What made you happiest about working with RAD Studio Delphi? The incredible speed of the compiler. Our Apps builds faster than some interpreters start up. The execution speed of the app is alike. What have you been able to achieve through using RAD Studio Delphi to create your showcase application? Compared to the given requirements our app is very flexible. So we hope it will exist quite some time before it needs to be rewritten from scratch. Its goal is to build a stock of long-term observation data for agriculture. I trust in Delphi to be around in 15 years. So the main achievement is probably a kind of sustainability. What are some future plans for your showcase application? A REST API to integrate it better into other applications. Thank you, Ronald! Check out his showcase entry through the link below.

Read More