Matlab and Aptina ApBaseCOM Integration
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a Micron Camera and I tried to take some images from it and processing them. I am using the ApBase interface from Aptina Software but, when I try to get the image, I received a raw matrix and rgb and I cannot draw the image again.
I based on the guide https://aptina.atlassian.net/wiki/display/DEVS/ApBase+COM+Development+Guide I executed:
apbase = actxserver('apbaseCom.ApBase');
camera = apbase.Create(0);
camera.LoadIniPreset('', '');
raw = camera.GrabFrame;
rgb = camera.ColorPipe(raw);
i = reshape(rgb,2592,1944);
I attached a capture about the workspace. I do not know how interpret the values of the matrix i and when I use imshow(i) on it I am not getting the image.

The guide said that the output is normally 32 bits per pixel with B – G – R – X byte order. What is mean the "X"?
Regards, Matías.
0 个评论
采纳的回答
Image Analyst
2014-6-2
It's a 32 bit (4 byte) image with the red, green, and blue values packed into the lower 3 bytes and the 4th byte unused and probably zero. You're going to have to mask and shift the value to extract the individual color channels. To mask, use the & operator to "AND" the array with 000000ff, 0000ff00, and 00ff0000. Then divide the upper byte images by 256 and 65536 to bring then down into the 0-255 range of uint8. But they may still be int32 or double at that point so you need to explicitly cast them to uint8 with the uint8() function.
3 个评论
Image Analyst
2014-6-2
Try this:
% Pack 200 in the lowest byte, 175 in the next lowest byte,
% 150 in byte 3, and the highest byte will be all zeros
int32Bit = uint32(150 * 2^16 + 175 * 2^8 + 200)
inBinary = dec2bin(int32Bit) % Just to show you the binary version
% Now recover the numbers from the bytes
redValue = bitand(int32Bit, 2^8-1)
greenValue = bitand(int32Bit, 2^16-1) / 2^8 - 1
blueValue = bitand(int32Bit, 2^32-1) / 2^16 - 1
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

