How to process an array of image data?

Hello. I am new to image processing so any help is appreciated. I have been trying to figure out how to use the image data from a camera and display it with Matlab. The image data was all initially given to me as a very long array of 230400 numbers that ranged from 0 to 255. Several different sources make it seem like this image could be rgb8 or ycbcr. I originally divided the picture to be 240x960 but noticed vertical lines and realized that the image probably needed to be divided into separate blocks. I then made the 230400 array into a 240x320x3 matrix. Each of the 3 sections do show up as if they are the same image but with different variations. I used image() and imshow() to display the 240x320x3 image but it doesn't appear as I wish. Below is the final image and the separate sections.
If the images don't appear, I'm sorry, and will try to fix them.
If there are any suggestions on how to get my image to be more clear, please let me know. Thanks.

Answers (1)

Image Analyst
Image Analyst on 26 Jun 2013
How are you displaying these? It looks like you used imagesc() which applies some weird colormap by default. If you used image() or imshow() then you applied some colormap - what was it? Or maybe it is ycbcr and combined it just looks bizarre because imshow assumes the color channels are R, G, and B, not Y, Cb, and Cr. There is a function ycbcr2rgb you could try before displaying it. Make sure the image is uint8 before you display it.

6 Comments

Walter
Walter on 27 Jun 2013
Edited: Walter on 27 Jun 2013
The first image is displayed with imshow() but looks identical if displayed with image(). The three sections are displayed with image() but when displayed with imshow() they only show what seems to be like particles on a white background. I took another image that seems to be more clear but I'm not sure why there seems to be so much noise or something in the image. Should I somehow try to change the resolution of the camera or is it just a strange colormap feature.
Below is the final image with colors almost showing up correctly. The color of most of the objects are correct but there is a strange fogginess on half the image and strange random colors everywhere.
Below is the image() function on the first section of the image
Below is the imshow() function on the first section of the image
I have the other sections as image() and imshow() but they are similar in concept as the first.
I used ycbcr2rgb on the image and even rearranged the order of the sections to see if that would help it but every single attempt led to a pinkish image as seen below.
I'm not sure what is causing this glitch with the camera. I also just calibrated the camera again but that didn't seem to change anything. It seems like it is rgb8 because the colors are coming out correctly but the image seems messed up. I also can get the camera to display clearly on other software so the camera itself isn't broken. Thanks for the help.
After observing the pictures, I think that my problem is related to lighting. Do you know if there is anything built into matlab for lighting problems?
I don't think it's a lighting issue - I think it's a colormap or colorspace issue. Are you using the Image Acquisition Toolbox? If so, what are the video modes that are listed? By the way, to display pictures you need to get something that ends in .jpg or some other format. I fixed your original question by clicking on the images in the links you posted until the URL showed an image file, not something ending in 5/ or something like that. Then I replaced your original URL with the one ending in .jpg. I think you're picking the wrong URL from tinypic. You want the last one that says "Direct Link for Layouts", not the one above it. Or for something simpler, use http://snag.gy where you simply paste the image in (copy the image to the clipboard first with ALt-PrintScreen).
Walter
Walter on 27 Jun 2013
Edited: Walter on 27 Jun 2013
I actually cannot see my device through the Image Acquisition Toolbox probably because it is being processed through another program. My overall goal is to use Matlab to map and localize an area with the AR Drone. I am using ROS to get data from an AR drone. The data is then sent through a program that allows Matlab to speak with ROS topics. So from Matlab I just get a 230400 array of data that comes from a topic on ROS. There is no file but only data from the camera. Is there any simple way that you know of that connects the Image Acquisition Toolbox to the AR Drone so that I can see if the camera seems to display properly on there? imaqfind doens't find any connections so I'm not sure what to do to fix that issue.
It might be possible if you can connect your camera to your computer but if you don't have the correct drivers for it, and the correct video adapter for the MATLAB interface, then it might show up with a generic winvideo adapter (that is if windows device manager even sees it, which is required first before MATLAB has any hope of seeing it). If it shows up with a winvideo adapter, then there may be several modes available to use, and there's no guarantee that the one you picked is the same as the one used to create the videos you were given. Your best bet is to do some more research to find out what is the format of the file you were given.
Thanks for the help but I finally found the problem was with other software that I was using. There was an overflow problem that made the data not show up as intended.

Sign in to comment.

Asked:

on 26 Jun 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!