Code covered by the BSD License  

Highlights from
ImagePatchTool

Be the first to rate this file! 13 Downloads (last 30 days) File Size: 336.04 KB File ID: #25111
image thumbnail

ImagePatchTool

by Amitabh Verma

 

23 Aug 2009 (Updated 17 Jun 2010)

Patching technique for text/image without losing on the pixel information in the rest of the image.

| Watch this File

File Information
Description

ImagePatchTool ver. 1.31©
Amitabh Verma
amtukv@gmail.com

This script is to demonstrate how to place text/image or label an image without losing on the pixel information in the rest of the image. The main purpose of the script is for appending text information on the image before being saved after an image capture or processing step. The patching speed is in 'ms' enough for real time operations.

I have built a GUI for an easy demonstration and labeling stand alone pics. Final images are saved in Uncompressed tif files. Images can be RGB or grayscale. This script will not work with gifs and nor have I tested in depth how matlab handles gifs.

Howto:
1. Default patch text information is loaded on program startup (you can save your own startup defaults)
2. Enter your text (for special characters you can use copy-paste function ctrl+c/ctrl+v)
3. Make Label
4. Load Image
5. Patch Image
6. Save Image
7. Find Difference button will count number of pixels used by the patch (basically the count of pixel information difference between the original and the patched).

(Only required when style of patch needs to be changed NOT for a new label)
If you wish to customize your patch style
1. Enter RGB values between (0 to 1).
2. Chose font
3. Initialize
4. Rest of the steps as above

Features:
1. Customizable font type, size, color
2. Customizable background color
3. Transparent patching of text with merging
4. Customizable location of patch
5. No Loss of pixel information, currently some suggested methods use getframe/gcf
6. Fast ~0.001 sec. for real time applications
7. RGB as well as grayscale support
8. External image support to add image legend, company logo, etc. with transparency support.

Limitations:
1. Single line feed (no. of characters per line is [image width/font width])

Future Versions
1. Multiple line support

Please report bugs, feature request, comments and suggestions to Amitabh Verma <amtukv@gmail.com>
Thank you for evaluating ImagePatchTool©

Note: Being a new MATLAB user I am eager to learn ways which can speed up the implementation of this code. Your feedback is highly appreciated.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Display the fusion of two images, Convert Text to an image, Patchwork, Save text in image format
This submission has inspired the following:
Label Image

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.10 (2010a)
Other requirements It should work on any platform, but has been tested only on Windows XP-SP3. You will need 7.x or later MATLAB version because GUI FIG-files/Mat-files that are created with MATLAB 7.x are not automatically compatible with earlier versions.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
16 Jun 2010 Rob Campbell

In the GUI, "make text label" results in an error:

Error in ==> ImagePatchTool>pushbutton2_Callback at 203
    seq(y)=unicode2native(t);
Error in ==> gui_mainfcn at 96
        feval(varargin{:});
Error in ==> ImagePatchTool at 43
    gui_mainfcn(gui_State, varargin{:});

16 Jun 2010 Amitabh Verma

Hi Rob,
       Code runs fine on 2010a. Could you please try the following in Matlab and which version are you running btw. Thanks !

>> unicode2native('abc')

17 Jun 2010 Amitabh Verma

The above error Rob pointed is most probably due to the default character encoding in Matlab set to something other than 'Windows-1252'.

With the below correction it should work fine.
native2unicode('string', 'Windows-1252')
unicode2native('string', 'Windows-1252')

An update has been submitted.

Please login to add a comment or rating.
Updates
28 Aug 2009

Changes in ver 1.1
1. Supports '{ } \ _ ^' characters
2. Saves text in save defaults
3. Typo
4. Background changes (Switch instead of if)

20 Oct 2009

Changes in ver 1.2
1. € © ® etc. characters now available

Changes in ver 1.1
1. Supports '{ } \ _ ^' characters
2. Saves text in save defaults
3. Typo
4. Background changes (Switch instead of if)

15 Jun 2010

Changes in ver 1.3
1. Removes empty lines
2. Define custom spacing
3. Font display
4. Loaded Image Display
5. Minor fixes and changes

17 Jun 2010

Changes in ver 1.31
1. Fix for Matlab's default character encoding
2. Fixed special characters bug
3. Error message for no text

Tag Activity for this File
Tag Applied By Date/Time
text Amitabh Verma 24 Aug 2009 13:25:45
image Amitabh Verma 24 Aug 2009 13:25:45
patching Amitabh Verma 24 Aug 2009 13:25:45
stitching Amitabh Verma 31 Aug 2009 13:19:28
overlay Amitabh Verma 08 Sep 2009 22:40:27
timestamp Amitabh Verma 08 Sep 2009 22:40:54
label Amitabh Verma 08 Sep 2009 22:41:02
watermark Amitabh Verma 08 Sep 2009 22:41:11
stitching Jessica 12 Sep 2010 23:50:19
stitching Einat Kidron 21 Aug 2011 03:09:20

Contact us at files@mathworks.com