Bug 313 : video / camera input images on intel macs appear blue because their colors are flipped
Last modified: 2006-09-15 05:28




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
fry
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2006-03-27 05:44
isight cameras (and prolly others) have images that come out funny because
instead of ARGB data, the colors are coming back BGRA. need to figure out
if this is an apple/qtjava issue or our own problem. even if the latter, we
need a workaround.

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Collaboration;action=display;num=1137337064
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=VideoCamera;action=display;num=1143274712
Additional Comment #1 From fry 2006-05-12 09:42
fixed in release 0115 (i think) or in quicktime 7.1 (if not).
Additional Comment #2 From rodemer 2006-09-12 12:23
I'm playing back a QT movie that plays in correct colors in QT 7.1.2, but is all blue in
Processing 0115. Any solution in sight?

Thanks! Processing is fabulous!

Michael Rodemer
University of Michigan

http://www.umich.edu/~rodemer/RodemerScreenshotBlue.jpg
Additional Comment #3 From fry 2006-09-12 12:25
this should be fixed, what sort of machine are you running on?
Additional Comment #4 From coeyes 2006-09-14 09:16
i think this isn't fixed release 0115.

Camera image was fixed but video is not.

this is my workaround until fix bug.

[code]
.
.
boolean intelmac;
.
.
void setup() {
.
.
intelmac = isIntelMac();
}
.
.
void movieEvent(Movie myMovie) {
myMovie.read();
if(intelmac) convertMovie(myMovie.pixels);
}
.
.
//
// detect intel mac
//
boolean isIntelMac() {
String os_name = System.getProperty("os.name");
String os_arch = System.getProperty("os.arch");

if(os_name.equals("Mac OS X") && os_arch.equals("i386"))
return true;
else
return false;
}
//
// convert movie image
//
void convertMovie(int[] pixels) {
for(int i=0; i < pixels.length;i++) {
pixels[i] = convertPixel(pixels[i]);
}
}

//
// convert BGRA to ARGB
//
int convertPixel(int data) {
int a = ((data & 0x000000FF) << 24) & 0xFF000000;
int r = ((data & 0x0000FF00) << 8) & 0x00FF0000;
int g = ((data & 0x00FF0000) >> 8) & 0x0000FF00;
int b = ((data & 0xFF000000) >> 24) & 0x000000FF;

return a | r | g | b;
}
.
.
.
[/code]


Additional Comment #5 From fry 2006-09-15 05:28
got it, fixed for 0116. thanks for posting, i hadn't realized that it was
also a problem for movies.