Single Channel Mosaicked Image in Matlab - matlab

I'm trying to convert a 3-channel rgb raw image to a one channel image in Matlab (or any other conversion software for that matter). I've tried concatenating but that was still unsuccessful. Any other suggestions?
The raw image I found online and I personally don't care which format it's in (whether NEX/ARW/etc). Just need to get it to one channel.
Thanks

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.

How to extract digits (number) using Matlab

At work I have to record a lot of data from png data. Every time I have to manually record the digits (e.g. mean\SD 101.1\11) on the excel sheet and read it with Matlab. Would it be possible that Matlab could directly read the digits from the PNG image, so that lots of work could be saved?
I know it might involve pattern recognition, but still hope that there may be someone who has done this before.
You can make use of Optical Character Recognition (OCR). The code for it is available here

An error while importing an image as a variable into Matlab

I wanted to import a tif image into Matlab workspace as a variable using File/import data tool. But I got the following error "Warning: The datatype for tag SamplesPerPixel should be TIFF_SHORT instead of TIFF_LONG. This may cause data corruption". The image type is float single, 32 bit. and size is really big (4144,12619,7). Can matlab read and display such an image. What does this error mean? and how can I correct it?
Thank you so much
Read the TIFF specification.
From the warning message it appears there's some problem with the format chosen. When reading a TIFF file, each IFD has many entries, one of them being SamplesPerPixel (see page 24 of the specification). This should be of type SHORT (see page 15 for the list of types and what they are). However, apparently, you have type LONG there. That seems to be causing problem. Either matlab is identifying it incorrectly, or the software you used to save the image is not following the TIFF specification.

Alternative to sws_scale

I am performing encoding of the captured windows screen with x264 using libavcodec. Since, the input is RGB, i am converting it to YUV to make it compatible with x264. I am using the sws_scale function for the same.
My question is if there is any alternate for this function since i don't need any scaling to be done in my case. Also, it would be useful if someone could throw light on the workflow of this function.
P.S: I am assuming x264 operates only in YUV color space. If this assumption is incorrect, please inform me on the same.
Thanks in advance.
I could not find an alternative to swscale and it seems except the fast bilinear algorithm (for scaling) all other algorithms used in the library provide a fairly negligible color shift.
Also, it is mathematically impossible to convert from RGB to YUV color space without any color shift (due to the approximations in the equations).
P.S: I could not use the RGB version of libx264 / libavcodec. If you have details on how to implement and how to build a corresponding version on windows, please post links/info for the same.
P.S: I am assuming x264 operates only in YUV color space. If this assumption is incorrect, please inform me on the same.
libx264 supports I420/YV12/NV12/I422/YV16/NV16/I444/YV24/BGR24/BGR32/RGB24 input colorspaces which are encoded as YUV 4:2:0/YUV 4:2:2/YUV 4:4:4/RGB (which should be specified in params). But anything except YUV 4:2:0 will need support from decoder because they are not part of High profile but newer profiles (High 4:2:2 and High 4:4:4 profiles).

dealing with ljpeg (lossless jpeg) using 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