Separate RGB layers of a RAW image

I am trying to separate the RGB layers of a RAW image. I'm able to get the red layer using rawr=img(:,:,1), but when I'm trying to get the green and blue layer using the command rawg=img(:,:,2) and rawb=img(:,:,3) respectively, I get this error, ??? Index exceeds matrix dimensions. Anyone knows how I can fix this problem? thanks

답변 (3개)

Wayne King
Wayne King 2012년 3월 4일

0 개 추천

Are you sure that you have an RGB image that is MxNx3
If you enter
>>whos img
what is returned?

댓글 수: 1

Natsu
Natsu 2012년 3월 5일
name img
size 3516x5344
bytes 37579008
class uint16
attributes --

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2012년 3월 4일

0 개 추천

If it's really a raw image from a digital camera, you'll have twice as many green pixels as red or blue pixels (look up Bayer pattern). The format may be very different than a standard RGB image like you'd get from imread() - you'll have to look up the documentation for the function you used to read the raw image. You could have 4 NxM arrays all strung together in one tall 4N by M 2D array, or who knows what.

댓글 수: 3

Walter Roberson
Walter Roberson 2012년 3월 4일
Not all digital cameras use Bayer patterns internally, though.
Image Analyst
Image Analyst 2012년 3월 4일
That's true. Just to expand on that....Some have three CCD's, one for each color. Others like the Fuji use a Bayer-like pattern which is hexagonal rather than rectangular. And the Foveon camera uses a single chip RGB co-site sensor where every location has all 3 color pixels at different depths (levels) into the sensor. There is no one single "RAW" format agreed to by everyone. He could have a raw camera image, or he could have a RAW image that someone output from some other program that is simply all the pixels strung together in some fashion, maybe with or without some header info. He needs to find out the actual format of his image, like you also suggested.
Walter Roberson
Walter Roberson 2012년 3월 5일
The Foveon was the one I had in mind; I had read about it when it was released, but had lost the name in the intervening time.

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2012년 3월 4일

0 개 추천

"raw" image formats are manufacturer-specific and sometimes model-specific. Some ad-hoc standards for raw images are evolving, but they are not widespread yet. Do a google search for the raw image format for your camera model.

카테고리

도움말 센터File Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기

질문:

2012년 3월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by