MATLAB <---> Image editor with support for layers - matlab

I was wondering if anybody knows of an API, toolbox, or library that extracts layers from an image format that is supported by a free editor such as Paint.NET (native format: .pdn)
Motivation: An interface to an image with layers that can be edited in a free image editor would be of interest for those of us who do computer vision and machine learning in MATLAB. For example, it could facilitate the automatic collection of manual pixel annotations for supervised learning.

I suggest using the .PSD Photoshop file format, which has layers support and is also implemented by many non-Adobe applications.
The PSD plugin for Paint.NET allows you to open and save PSD images: http://www.psdplugin.com/
You can then use Imagemagick to extract the layers to a format that MATLAB can read:
convert filename.psd filename-%d.png

Almost nothing can read a .pdn file. http://extension.nirsoft.net/pdn
So, you are left with the following options.
Use GIMP to read in the file, and export it into something matlab supports: http://www.mathworks.com/help/techdoc/ref/imread.html.
Use GIMP to read in the file, and export it into something ImageMagick supports:http://www.imagemagick.org/script/formats.php and then convert it into something matlab supports.
Export the data from Paint.NET into a matlab friendly format.
Note, the Matlab links are for the image processing toolbox, if you don't have that, the options are more limited.

Related

Converting georeferenced .png files to .ecw using IrfanView

Is there anyway I can preserve image georeferencing information after processing or converting the image via IrfanView?
I have a couple of .png files with spatial reference and I'm trying to save them as ecw images. Unfortunately this process destroys the spatial reference vital for using the images in GIS software. If there was a way around this problem it would be a great help.
Thanks.
I would recommend using gdal_translate to handle all your geospatial translation needs.
Assuming that you have a PNG with a world file associated then you can easily convert to ecw (providing that the propitiatory ecw driver is compiled in).

Convert text from image into text file

I have an image and I want to convert it text file to use in word processing software. 1) Can it be done in any software. 2) Is it possible to write a program in Matlab or any other language that can convert it to text. The font is really poor in the image file.
You're talking about OCR where there are existing libraries that can be used for this. I suggest you take a look at Leadtools OCR. I used it in .NET environment and it can convert images to text.
Yes, it can be converted into text by using softwares like Microsoft OneNote or others. You can also write programmes for creating an OCR in most of the programming languages.

Tesseract - train with different image format than used for primary OCR

As discussed on this SO Question, tesseract often operates better with .png files than with .tiff files. (I have also experienced this directly myself). Unfortunately, there are fewer box editors available that can handle .png files. I therefore am tempted to train my data using .tiff files but then use .png files for my main OCR work. Will doing so reduce the effectiveness of the training? If so, are there any ways to address it (other than just finding a box editor that can accept .png files)?
Some editors such as jTessBoxEditor (Tesseract AddOns page) support both TIFF and PNG formats. Since TIFF can be multi-page image, it can have a lot more samples for your character set than single-page PNG.
https://github.com/tesseract-ocr/tesseract/wiki/TrainingTesseract

standard test videos for video processing

So.. In image processing, lena is the standard image for testing out algorithms in the research community. Similarly.. Are there any standard videos for testing out MATLAB codes for video processing?
There are also commonly used video sequences – though to a degree it depends on the type of video algorithm you're developing (reflected in the level of motion, type of motion, resolution etc.) and the file type you want (e.g. YUV, compressed).
As a starting point, foreman.yuv, Carphone.yuv, akiyo.yuv, bus.yuv, coastguard.yuv, flower.yuv.
For example googling the above turned up a reasonable looking repositories at the following:
YUV Video Sequences – ASU
Derf's Test Video Collection at xiph.org
Lately, the Blender clips Big Buck Bunny, Tears of Steel and Sintel have been more frequently used, as they are available in HD and 4K resolutions as well as in stereo 3D.
/Too long for a comment/
I came across some builtin sample/demo files in a matlab blog post: http://blogs.mathworks.com/loren/2007/01/10/colormap-manipulations/
Apparently the files clown and cameraman are builtin and you can just load them using load clown or load cameraman.
It depends however on the installed toolboxes: clown is from the wavelet toolbox and cameraman from the image processing toolbox. They both can be found on the matlab path of course, so you can always look around there. You'll also there find the files: autumn, board, canoe, cell, circbw, circuit,...
EDIT: also: http://www.mathworks.com/matlabcentral/answers/1376-finding-example-images-in-the-distribution
But for video I personally haven't seen anything like that in matlab
EDIT2:
I stand corrected: in the vision toolbox, there are some example videos, in the visiondemos subdirectory of the toolbox. Just search for avi files on the matlab install directory

adding text to TIFF

I need to add text string to a TIFF image. I am planning to use libTIFF for editing the TIFF image. The plan is to convert text to image using freetype2 and then somehow render the text image on to TIFF. Is this the right approach?
Any pointers on how to convert text to image? I saw the sample code of ft2 - initialising the library, creating face and then setting character sizes. But not sure what to do next? any pointers appreaciated.
One way could be using ImageMagick. They have tools for image composition and text rendering. (and many more)
Although ImageMagick is primarily used from the command line (especially in web environments) several language interfaces are available, too. Java, C, C++, ...
ImgSource is a really nice library for C/C++ on Windows, and it can do this out of the box.
http://www.smalleranimals.com/isource.htm
It's not free, but it's pretty cheap ($59)
You don't tell us which language you need to use, should it be portable or for a given platform, etc.
Using a ready to use existing graphic library, like the (big!) ImageMagick or others like libGD or DevIL might be the easiest way, lot of them have binding for lot of languages.
if youre on windows and in c++ then it's pretty easy to use gdiplus for drawing fonts. you have access to any installed font and you can save the raster out as tiff or jpeg etc as well using the one api.
of course you could also use some combo of freetype and libtiff, but you'll have to build those libs for win32. not that its hard, just more fussing around you may not want to do.