Region-aware Image Processing and Annotations in Swift for iOS: 25 Projects in 25 Days

Region Processing Screenshot
Region Processing Screenshot

As part of the LEAD Technologies 25th anniversary, we are creating 25 projects in 25 days to celebrate LEAD’s depth of features and ease of use. Today’s project comes from Joe.

What it Does

This project uses annotations to draw regions on which image processing will be performed using LEADTOOLS Version 18.

Features Used

Development Progress Journal

My name is Joe and I am going to create a project that performs Image Processing on a particular region of the image dictated by a rectangle or an ellipse annotation.

I am using LEADTOOLS Document Imaging version 18 (iOS). I’m developing this application using Apple’s native programming environment, Xcode.

Before starting I need to determine which programming language to use, Objective-C or Swift. Our iOS frameworks are written in Objective-C, however, since Objective-C frameworks are able to be used in Swift code (with the help of a Bridging Header File) I am going to program in Swift to showcase how to use LEADTOOLS’ iOS SDK with Swift.

After starting up Xcode, I selected a Single View Application since we only need one view. After looking at the IPDemo that ships with the SDK, I found a helper class (DemoCommandItem) that is going to be useful, so I imported it into the project. I added the Leadtools, Leadtools.Kernel, Leadtools.Controls, Leadtools.Converters, all of the Leadtools.ImageProcessing.* frameworks as well as all of the Leadtools.Annotations.* frameworks.

After I imported all of the frameworks, I added them to the bridging header file for the project (Note that I’m using the LEADTOOLS templates provided here so the precompiled header file and the project settings have been configured for me) so that all of the Objective-C API will be available in the Swift code

Now that I have all of the LEADTOOLS frameworks added, I compiled quickly to make the LEADTOOLS API publically available in all files. I then proceeded to configure my Storyboard. In the main view I added an instance of the LTImageViewer class and a UICollectionView class (for the thumbnails).

Now in my ViewController class, I wrote the code for setting the bar button items (for loading the commands), the array to hold all of the commands, another array to act as a stack for allowing us to undo the commands, and then I set up the delegate and dataSource methods for the UICollectionView that I have in the main view.

Since LEADTOOLS provides all of the Image Processing commands that I’m using, that’s all that I had to do. When I run it now I can scroll through all of the thumbnails to select the command that I want to use. Once I run the command, all of the thumbnails update to show me what running the next command on the current image will look like. Super easy. Part one of this project is now done.

To make the Image Processing work on only the region dictated by the annotation, we need to add a couple of classes to our ViewController class: LTAnnAutomationManager, LTAnnAutomation, and LTAnnObject. We first create our LTAnnAutomationManager with the LTAnnUniversalRenderingEngine, we use our manager to create our LTAnnAutomation class and then we add our LTAnnObject (LTAnnRectangleObject to start off). We then modify the methods that run the image processing commands to set the region in the image before running the image processing command. The region that’s set uses the bounds of the annotation. After doing this, our project is complete!

This project, all in all, took me 6 hours to set up. The main issue that I had was in setting up the custom UICollectionView class (not LEADTOOLS related). The LEADTOOLS portion of this project took no more than an hour to two to fully configure.

Download the Project

The source code for this sample project can be downloaded from here. To run the project, extract it to the \Leadtools 18\Examples\Xcode\iOS\ directory.

Posted in Image Processing | Tagged , , , , , , , , , , | Leave a comment

Directory Word Search for Images and Documents: 25 Projects in 25 Days

Directory Word Search Screenshot
Directory Word Search Screenshot
Directory Word Search Folder Selection
Directory Word Search Folder Selection
Directory Word Search In Progress
Directory Word Search In Progress
Directory Word Search Complete
Directory Word Search Complete

As part of the LEAD Technologies 25th anniversary, we are creating 25 projects in 25 days to celebrate LEAD’s depth of features and ease of use. Today’s project comes from Nathan.

What it Does

This application will search both raster image and document files for text and return matching files using LEADTOOLS Version 19.

Features Used

Development Progress Journal

Hello, my name is Nathan and I am going to write an application that will search a directory of files for a specific word, regardless of whether they are in a raster image or a document format. With LEADTOOLS I should be able to find the word.

I am going to start by building a UI, and then I will work on getting the word search to work with just document formats using our Document class.
Documentation: Document class

That didn’t take long at all, maybe 30 minutes. Now I need to add OCR capabilities so that we can check raster images for the word as well. Since OCR is slower I will add a check box to allow the user to opt-in for OCR.
Documentation: IOcrEngine

That only took about an hour, plus I had to move some pieces around. Everything is in my UI thread which is going to cause some complications. I am going to create a background thread for all of the work to be done on, and create some states for the UI to limit what the user can do in certain scenarios.

That took about 2 hours, I’m relatively new to multi-threading in .NET. Now the UI thread is separate from all the work that is being done and the user can pause or cancel the operation at hand.

I’d like to speed things up since large directories going one file at a time can take quite a bit of time. I’m going to use Parallel.ForEach loops to process not only multiple documents but, multiple pages within each document at a time.

That took about 2 hours, I ran into a few complications I had to work out, but luckily LEADTOOLS OCR and the Document class are thread-safe so that didn’t require any extra coding to allow multiple documents and multiple pages to be done at the same time.

Now we can search a directory full of documents for a specific word and open the documents as they are found without interrupting the processing, and it’s really fast since we are doing several documents at a time and several pages within those documents at a time.

I’m going to do some code clean up and then I’ll be done.

After about 20 minutes of code cleanup, I am finished! In less than 6 hours I was able to create a complete multi-threaded application that allows me to search for text within a directory full of raster images or documents that’s pretty astounding and there is no way I would have been able to accomplish this without LEADTOOLS.

A future improvement for this demo would be to load the images into the viewer and highlight the area(s) where the search term is found.

Download the Project

The source code for this sample project can be downloaded from here. To run the project, extract it to the C:\LEADTOOLS 19\Examples\DotNet\CS directory.

Posted in OCR | Tagged , , , , , , , , , , | Leave a comment

25 Projects in 25 Days: Celebrating LEADTOOLS’ Depth of Features and Ease of Use

In July, we started celebrating LEAD’s 25th anniversary with a brief history lesson, some promos and a series of fun fact tweets.

This month, we’re starting another celebration from the programmer’s point of view. For the next 25 days, our Support Engineers will be creating a new project from scratch and showing how easy it is to use LEADTOOLS to accomplish their goal. These examples will explore the many features within LEADTOOLS: OCR, barcode, PDF, forms recognition and processing, document viewing and converting, virtual printing, annotations, DICOM, PACS, image processing, formats, multimedia, HTML5, mobile platforms, and more.

You can follow their progress on our Twitter feed and on our other social media profiles using the #LEAD25 hashtag. Once it’s all done, their sample project will be available for download and we’ll summarize it here on the blog. We’ll also keep a running list of projects on this post as each project is completed.

  1. Directory Word Search for Images and Documents
  2. Region-aware Image Processing and Annotations in Swift
  3. iOS Stacked Image Processing
  4. Video to GIF
  5. DICOM Encapsulated PDF
  6. Multipass Image Processing for Barcode Recognition
  7. Express PACS Import
  8. Zonal OCR REST Service
  9. File Conversion Right-click Shell Extension
  10. Folder Monitor
  11. HTML5 Image Gallery
  12. Capture, DVR and Stream with RTSP
  13. Universal Viewer
  14. OCR Screen Capture
  15. Page Arranger
  16. OCR in Meteor and Bootstrap
  17. Reverse Animated GIF
  18. Receipt Survey Forms Recognition
  19. Integrate OCR into Web Scanning
  20. Compare Images
  21. Convert to PDF Series
  22. Custom Annotations
  23. Scan to PDF Console
  24. Linux OCR, Barcode and Format Conversion Batch Processor
  25. Get Contact Info from Business Card with OCR
Posted in General | Tagged , , | Leave a comment

New White Paper: Add HTML5 Document Viewer to ASP.NET MVC 5 Project

The latest update of LEADTOOLS V19 includes an MVC project using the LEADTOOLS DocumentViewer. Additionally, the services have been refactored so that the services configuration part of this paper is out of date and no longer applies. However, we have decided to continue to make this paper available because there is useful information on configuring CORS in IIS that applies to many different applications.

If you have any questions about how to use the LEADTOOLS DocumentViewer in an MVC application, please contact support@LEADTOOLS.com.

This “How To” adds document viewing with page thumbnail navigation and full page view to an ASP.NET MVC 5 project. Additionally, add CORS for cross-domain requests to a web service hosted in IIS or IIS Express. The resulting project lays the foundation to add more advanced document functionality including text selection, annotation, bookmarks and conversion to an ASP.NET MVC application.

Add HTML5 Document Viewer to ASP.NET MVC 5 Project

Objectives

  • Set up the LEADTOOLS Documents Service in IIS
  • Configure Documents Service Host to support CORS
  • Add LEADTOOLS HTML5 DocumentViewer control to ASP.NET 4.5 MVC 5 project

The HTML5 Document Viewer is a turnkey solution for viewing documents on any platform and device. The Document Viewer includes rich document features including text search, annotation, memory-efficient paging, inertial scrolling, scalable vector display, multi-page viewing, thumbnails and bookmarks. Additionally, the LEADTOOLS Document Viewer loads several document formats such as DOC, TIFF, and PDF without additional third-party plugins.

In addition to the PDF download format, we have also published this white paper on CodeProject.

Posted in Document Imaging, HTML5, PDF | Tagged , , , , , , | Leave a comment

LEAD Technologies and National Health IT Week 2015

We are proud to be a part of the 10th annual National Health IT Week (October 5 – 9, 2015). National Health IT Week is the premier event offering all healthcare stakeholders an opportunity to unite under one banner, expressing the benefits that health information technology (IT) brings to U.S. healthcare. “One Voice, One Vision.”

LEAD Technologies will join together with the other hundreds of companies around the country to celebrate progress and add to the conversation of how Health Information Technology is growing and improving people’s health.

At its core, healthcare is performed by the many great doctors, nurses, EMTs, radiologists, and more that are directly serving their patients. However, every great front-line worker has a great supporting cast, within which Health IT gets to play a major role. The successful application of medicine and care is greatly enhanced through Electronic Health Records (EHR), Picture Archival and Communication Systems (PACS), advanced imaging technologies, infrastructure and so on. These important pieces of the overall healthcare system provide improved patient safety, fewer medical errors, earlier detection, and stronger patient/provider relationships.

Visit www.HealthITWeek.org for a full list of partners and updates on the Week’s activities. Working together with our growing coalition of stakeholders, LEAD Technologies is helping to transform healthcare for all.

Also watch out for out #NHITWeek contributions in the coming weeks on our Twitter feed and social media profiles!

LEAD Technologies’ Contribution to the Healthcare Industry

LEAD Technologies, Inc. provides a variety of products and services that are advancing Health IT.

LEADTOOLS Medical Imaging SDKs

Our primary product, LEADTOOLS, is a family of imaging toolkits for Medical, Document, Raster and Multimedia imaging. Our Medical Imaging, PACS Imaging, and Medical Imaging Suite developer toolkits are some of the most heavily awarded, programmer-friendly, fully-featured and best-selling toolkits in the world. With comprehensive DICOM and PACS technology along with high-end 2D and 3D viewer controls with support for .NET, CDLL, HTML5 / JavaScript, WinRT, iOS, OS X, Android and more, LEADTOOLS lives up to its reputation as the World Leader in Imaging SDKs. Beyond our medical product line, the document and multimedia products we provide have their place in Health IT as well. OCR, Forms Recognition, Barcode, PDF, Video Streaming and more are all part of a global healthcare infrastructure that is more organized, digital and connected than ever before.

Medicor Imaging

Medicor Imaging is a division of LEAD Technologies created to provide the medical imaging community with products and professional services that facilitate a more rapid transition into the digital era. Powered by LEADTOOLS, Medicor Imaging’s DICOM and PACS solutions (MiPACS) are used world-wide in Multi-Clinic Dental Organizations, Schools, ENT Practices, Hospitals, Imaging Centers and the US Department of Veteran Affairs.

Posted in News | Tagged , | Leave a comment