dealing with ljpeg (lossless jpeg) using matlab - matlab

I am dealing now with DDSM database (Digital Database for Screening Mammography) .. its disadvantage is its extension. It is extension is ljpeg (lossless jpeg) which it is very poorly supported extension. I want to read them using matlab or converting them to any other type which is widely supported. thank

I know there is a working version of DDSM's jpeg program for linux at http://www.cs.unibo.it/~roffilli/sw.html
I compiled and tested it. I used the MATLAB code as described here to view the images.
It displays correctly only for some scanners.
As described in the paper http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.111.3846
When properly compiled, the DDSM software outputs the image data as a stream of raw bytes; one then has to normalise these according to the model of digitiser used to image the original films and then create an image file that is readable by one’s image analysis software environment.
*EDIT: *
I found a complete solution that downloads, normalizes (based on the scanner) and converts the DDSM image to PNG format. Dr. Chris Rose wrote that program, please download it on his website
http://microserf.org.uk/academic/Software.html

Related

Convert pixel array to DNG in SWIFT ... without libtiff/libjpeg?

I have raw image data, a pixel array (actually a single string of data) that I want to convert to the most basic and minimal DNG format/file. I saw different approaches utilizing libtiff and libjpeg.
Is there a simpler and more straight forward way to do this in SWIFT using Core Graphics, Core Image or yet another SWIFT API?
The image data are still in the original Bayer matrix format (CFA pattern is RGGB) without any tags.
I downloaded the over 100 pages of the latest Adobe DNG format specification, but I cannot find the actual byte order or structure of the DNG file in there... I am pretty lost with this document.
Any help and hints are highly appreciated.

Training tesseract 4 with images instead of font

I have some questions about making tiff/box files for tesseract 4.
In TrainingTesseract 4.00 document written:
Making Box Files As with base Tesseract, there is a choice between
rendering synthetic training data from fonts, or labeling some
pre-existing images (like ancient manuscripts for example).
But it did not explain how to train with pre-existing images.
I want to train for the Persian language in tesseract 4 (lstm). I have some images from ancient manuscripts and want to train with images and texts instead of font. So I can’t use text2image command. I know that the old format box files will not work for LSTM training.
How can I make tif/box for tessearct 4 lstm then label them and
how to change tesseract commands?
Should I use other tools for generating box files (Given that Persian
language is right to left )?
Should I use fine tuning or train from Scratch?
I was struggling just like you, until I found this github repository:
https://github.com/OCR-D/ocrd-train
It will make your life super easy. All you need to do is to put your images in tif format and your text should have the same image name with extension .gt.txt. It will take care of all the rest for you. (you might need to update the Makefile according to your local machine)
Whether to train from scratch or fine-tune depends on your own language, data and the problem you are trying to solve. For me the fine tunining is what I need cause I am happy with the current performance but need to add upon it.
All the useful details you might need can be found in this answer
1) Use below command to make lstmbox:
tesseract test.tif test-lstmbox -l eng --psm 6 lstmbox
It will make a lstmbox for you but you have to correct the character in box file.
2) You require enough data for training from Scratch So I suggest fine tuning is better option.

Use SVG plots when Publish-ing to HTML

This question was posted on Matlab Central (http://goo.gl/MkU8P) but hasn't gotten any answer. I thought someone here might have a lead.
I use publish() quite a bit to produce online class notes. It's working well but frankly, I find the PNG plots to be of awful quality. I've tried setting figureSnapMethod='antialiased' and that's a bit better but I mostly find the result fuzzy.
What would be awesome is to produce SVG plots. Is there any way to do that? I suppose it would have to involve plot2svg somehow (also from File Exchange) since SVG output seems to be only supported for Simulink models. Or perhaps someone has a better solution using some other high quality format.
before using publish you should set some options to change imageForamt. by default it is set to PNG format which is not good for reports, papers, etc. what you need is a vector graphic image, something like an eps or emf file formats. (in such case it does not matter how much you zoom in , it never becomes fuzzy or low resolution).
Any image format that your installed version of Microsoft Office can import, including 'png' , 'jpg', 'bmp',and 'tiff'. If the 'figureSnapMethod' is 'print',then you can also specify 'eps', 'epsc', 'eps2', 'ill', 'meta',and 'pdf'
for HTML output any format publishes successfully
for latex output any format publishes successfully
I suggest you to use eps, it is the best. and remember SVG is not supported in publish. ;)
you should add this part to your command:
'imageFormat','eps'

image and video compression

What are similar compressors to the RAR algorithm?
I'm interested in compressing videos (for example, avi) and images (for example, jpg)
Winrar reduced an avi video (1 frame/sec) to .88% of it's original size (i.e. it was 49.8MB, and it went down to 442KB)
It finished the compression in less than 4 seconds.
So, I'm looking to a similar (open) algorithm. I don't care about decompression time.
Compressing "already compressed" formats are meaningless. Because, you can't get anything further. Even some archivers refuse to compress such files and stores as it is. If you really need to compress image and video files you need to "recompress" them. It's not meant to simply convert file format. I mean decode image or video file to some extent (not require to fully decoding), and apply your specific models instead of formats' model with a stronger entropy coder. There are several good attempts for such usages. Here is a few list:
PackJPG: Open source and fast performer JPEG recompressor.
Dell's Experimental MPEG1 and MPEG2 Compressor: Closed source and proprietry. But, you can at least test that experimental compressor strength.
Precomp: Closed source free software (but, it'll be open in near future). It recompress GIF, BZIP2, JPEG (with PackJPG) and Deflate (only generated with ZLIB library) streams.
Note that recompression is usually very time consuming process. Because, you have to ensure bit-identical restoration. Some programs even check every possible parameter to ensure stability (like Precomp). Also, their models have to be more and more complex to gain something negligible.
Compressed formats like (jpg) can't really be compressed anymore since they have reached entropy; however, uncompressed formats like bmp, wav, and avi can.
Take a look at LZMA

Force MATLAB mmreader or avireader to use a different codec?

How do I force MATLAB functions to use a different codec when I need to play an AVI file?
I am using windows7 and I find that indeo5 codec is not working properly because of the OS.
All code works fine on XP.
Thanks!
If your question is about how to play an avi using a codec other than the one used to create it, you'll have to use some kind of image conversion software ( RAD video tools aka bink and smacker is popular and free ) to recompress the movie using the new codec. There may be some loss of video quality.
If your question is how to tell MATLAB to create an avi using a different codec, type help avifile to see the full documentation.
If your problem is that MATLAB is choking on a codec it says it supports and if you're using 64 bit MATLAB, I've had this problem. The short answer, unfortunately, is that there are no 64 bit codecs that work with MATLAB. There are two workarounds, and they both suck. One is to install 32 bit MATLAB and use that when you need to access an avi. The other is to use some kind of image conversion software to convert your avi to an image stack, then load that with MATLAB.
(EDIT: In newer versions of MATLAB, you can use the VideoWriter object to write MP4 and other compressed formats in 64 bit windows)